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

From: Namhyung Kim
Date: Wed May 15 2013 - 22:43:19 EST


On Wed, 15 May 2013 23:21:39 +0200, Jiri Olsa wrote:
> On Tue, May 14, 2013 at 07:13:53PM +0900, Namhyung Kim wrote:
>> From: Namhyung Kim <namhyung.kim@xxxxxxx>
>>
>> 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
>> "perf.data.dir" and the first two (i.e. "perf.data") can be changed
>> with -o option. The structure of the directory looks like:
>>
>> $ tree perf.data.dir
>> perf.data.dir/
>> |-- 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 perf.data format and
>> contains usual event information, feature mask and sample data. The
>> sample data is synthesized to indicate given cpu has a record file.
>
> so AFAICS we store sample event for each cpu we recorded (in record
> command) and by processing those samples (show/report) we get data
> files names for each cpu

Correct.

>
> hum, I might have missed some discussion about this, but seems
> like header feature fits better for this, as long as we store
> only cpus.. FTRACE_CPUS or something like thius with simple array

Well, there's no discussion on this side so far. :)

I wanted not to add a new header feature only for this but use existing
method (sample event) so that it also can be recognized - at least to
have very rough idea - by an incompatible version of the perf tool.
Maybe the event has more information like total number of samples as a
period.

>
> or if we are going to use event, maybe user event via
> enum perf_user_event_type fits better

IIRC some people don't want to add more user event types.

Thanks,
Namhyung
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/