Re: [PATCH] perf report: Display per-thread event counters

Brice Goglin
2009-08-08T16:10:24Z

Ingo Molnar wrote:
>> [...] But I don't see yet where I am suppose to get something like
>> PERF_READ_EVENT in builtin-stat.c so I haven't touched it yet.
>>
>
> Yeah. 'perf stat' is not really getting events but is doing a
> read-out of the counter value(s) and constructs its 'read event'
> that way. So you wont find PERF_READ_EVENT in builtin-stat.c, you'll
> find:
>
> res = read(fd[cpu][counter], single_count, nv * sizeof(u64));
>
> in read_counter(). The printout is then done in print_counter().
>

Is there a way to get per-thread counters there? I wrote the code to
gather per-cpu counters there, but I don't see any way to get the
corresponding thread-id.

I looked at perf record to get some help. But I don't see where the
PERF_EVENT_READ are generated. I guess they are directly generated by
the kernel, read by perf record, and written as is to the output file?

thanks,
Brice