lkml.org 
[lkml]   [2011]   [Aug]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] perf: collect multiplexing timing information in perf record

On 08/26/2011 12:02 PM, Stephane Eranian wrote:

>>> +static int
>>> +sample_read2u64(const u64 *array, u64 fmt)
>>> +{
>>> + u64 nr = 1;
>>> + int ret = 1; /* nr or value */
>>> +
>>> + if (fmt & PERF_FORMAT_TOTAL_TIME_ENABLED)
>>> + ret++;
>>> +
>>> + if (fmt & PERF_FORMAT_TOTAL_TIME_RUNNING)
>>> + ret++;
>>> +
>>> + if (fmt & PERF_FORMAT_GROUP) {
>>> + nr = *(u64 *)array;
>>> + ret += nr;
>>> + }
>>> +
>>> + if (fmt & PERF_FORMAT_ID)
>>> + ret += nr;
>>
>> Why not add
>> struct read_format {
>> u64 value;
>> u64 time_enabled;
>> u64 time_running;
>> u64 id;
>> };
>>
>> to perf_sample and save the data there?
>>
> I am not following you here.
> Are you talking about the kernel API or perf tool internals?
>
> The only way to have timing saved in each sample is via
> PERF_SAMPLE_READ and a read_format which includes
> time_enabled + time_running.

I meant in that function you added above -- sample_read2u64. You are
moving the array pointer forward and essentially throwing away data that
was pushed to userspace. Why not add a struct and save that data for use
elsewhere in the builtin code? And the order of the data is a function
of whether PERF_FORMAT_GROUP is set (see perf_event.h file).

David



\
 
 \ /
  Last update: 2011-08-26 21:21    [W:0.039 / U:0.284 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site