Re: perf: some questions about perf software events

From: Franck Bui-Huu
Date: Thu Dec 02 2010 - 15:52:27 EST


Peter Zijlstra <a.p.zijlstra@xxxxxxxxx> writes:

> On Sat, 2010-11-27 at 14:28 +0100, Franck Bui-Huu wrote:

[...]

>>
>> Does it make sense to adjust the period for both of them ?
>>
>> Also, when creating a task clock event, passing 'pid=-1' to
>> sys_perf_event_open() doesn't really make sense, does it ?
>>
>> Same with cpu clock and 'pid=n': whatever <n> value, the event measure
>> the cpu wall time clock.
>>
>> Perhaps proposing only one clock in the API and internally bind this
>> clock to the cpu or task clock depending on pid or cpu parameters would
>> have been better ?
>>
>
> No, it actually makes sense to count both cpu and task clock on a task
> (cpu clock basically being wall-time).
>

But a task can create several instances of the same events, no ?

For HW events, they'll use counters that support the type of these
events and if there are not enough of them then those events will share
the counters in a round robin fashion.

For SW events, there's no limit at all.

So doing:

attr.type = PERF_TYPE_SOFTWARE;
attr.config = PERF_COUNT_SW_ClOCK;
/* ... */
tsk_clock_fd = sys_perf_event_open(&attr, 0, -1, -1, 0);
cpu_clock_fd = sys_perf_event_open(&attr, -1, 0, -1, 0);

should be allowed.

No ?
--
Franck
--
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/