trace_waitpid() loop hogs one CPU during trace-cmd record. Add a sleep(1) there to slow down the loop, to reduce the CPU load. Signed-off-by: Vincent Stehlé <vincent.stehle@xxxxxxxxxxxxx> --- Dear Linux trace folks, While using trace-cmd, I remarked that I had each time the first trace-cmd process hogging one CPU completely. This is seen on PC or ARM with trace-cmd v2.5, for example, with: sudo ./trace-cmd record -e irq sleep 3 With this patch, the load is greatly reduced and there is idle time again on all CPUs and no event is dropped. What is your opinion on this, please? I am not sure this can be integrated right away though, as hardcoding a one second delay does not sound really right. Would that make sense to use the same sleep value as for the `-s' option? Thank you for trace-cmd! Best regards, V. trace-record.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/trace-record.c b/trace-record.c index e9ad5e1..f55224e 100644 --- a/trace-record.c +++ b/trace-record.c @@ -841,6 +841,9 @@ static pid_t trace_waitpid(enum trace_type type, pid_t pid, int *status, int opt if (type & TRACE_TYPE_STREAM) trace_stream_read(pids, recorder_threads, &tv, profile); + + sleep(1); + } while (1); } #ifndef NO_PTRACE -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-trace-users" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html