Re: [PATCH 09/14] perf ftrace: Add 'record' sub-command

From: Jiri Olsa
Date: Wed Apr 24 2013 - 10:13:08 EST

On Tue, Apr 23, 2013 at 05:31:07PM +0900, Namhyung Kim wrote:
> From: Namhyung Kim <>
> The ftrace record command is for saving raw ftrace buffer contents
> which can be get from per_cpu/cpuX/trace_pipe_raw.
> Since ftrace events are generated very frequently so single thread for
> recording mostly resulted in buffer overruns. Thus it uses per-cpu
> recorder thread to prevent such cases and they save the contents to
> their own files.
> These per-cpu data files are saved in a directory so that they can be
> easily found when needed. I chose the default directory name as
> "" and the first two (i.e. "") can be changed
> with -o option. The structure of the directory looks like:
> $ tree
> |-- perf.header
> |-- trace-cpu0.buf
> |-- trace-cpu1.buf
> |-- trace-cpu2.buf
> `-- trace-cpu3.buf
> In addition to trace-cpuX.buf files, it has perf.header file also.
> The perf.header file is compatible with existing format and
> contains usual event information, feature mask and sample data. The
> sample data is synthesized to indicate given cpu has a record file.

I got following lockup for record command:

# ./perf --no-pager ftrace record ls

in other terminal:

# pstack 14237
Thread 2 (Thread 0x7f3f1aa1d700 (LWP 14241)):
#0 0x0000003cec20b595 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/
#1 0x0000000000446ebe in record_ftrace_raw_buffer (arg=0x21f9ce0) at builtin-ftrace.c:451
#2 0x0000003cec207d14 in start_thread () from /lib64/
#3 0x0000003cebaf168d in clone () from /lib64/
Thread 1 (Thread 0x7f3f1ba209c0 (LWP 14237)):
#0 0x0000003cec208e60 in pthread_join () from /lib64/
#1 0x0000000000449c8c in do_ftrace_record (ftrace=ftrace@entry=0x7fff1377d240) at builtin-ftrace.c:682
#2 0x000000000044a57b in __cmd_ftrace_record (argv=0x7fff1377d818, argc=<optimized out>, ftrace=0x7fff1377d240) at builtin-ftrace.c:1535
#3 cmd_ftrace (argc=2, argv=0x7fff1377d818, prefix=<optimized out>) at builtin-ftrace.c:1655
#4 0x000000000041a763 in run_builtin (p=p@entry=0x7d58a0, argc=argc@entry=3, argv=argv@entry=0x7fff1377d818) at perf.c:320
#5 0x0000000000419faf in handle_internal_command (argv=0x7fff1377d818, argc=3) at perf.c:377
#6 run_argv (argv=0x7fff1377d600, argcp=0x7fff1377d60c) at perf.c:421
#7 main (argc=3, argv=0x7fff1377d818) at perf.c:522

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at