public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: David Ahern <dsahern@gmail.com>
To: Stephane Eranian <eranian@google.com>
Cc: linux-kernel@vger.kernel.org, peterz@infradead.org,
	mingo@elte.hu, acme@redhat.com, ming.m.lin@intel.com
Subject: Re: [PATCH] perf: collect multiplexing timing information in perf record
Date: Fri, 26 Aug 2011 13:17:56 -0600	[thread overview]
Message-ID: <4E57F164.6020406@gmail.com> (raw)
In-Reply-To: <CABPqkBTDG_DcJTPpB-126HyuT8yR+w_JOssN=ix0rAP3tjzpuw@mail.gmail.com>


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


      reply	other threads:[~2011-08-26 19:18 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-26 15:22 [PATCH] perf: collect multiplexing timing information in perf record Stephane Eranian
2011-08-26 16:32 ` David Ahern
2011-08-26 18:02   ` Stephane Eranian
2011-08-26 19:17     ` David Ahern [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4E57F164.6020406@gmail.com \
    --to=dsahern@gmail.com \
    --cc=acme@redhat.com \
    --cc=eranian@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ming.m.lin@intel.com \
    --cc=mingo@elte.hu \
    --cc=peterz@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox