lkml.org 
[lkml]   [2012]   [Feb]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: Question about resetting a sampling counter in kernel
From
Date
On Sun, 2012-02-12 at 12:37 -0600, heechul Yun wrote:
> Hello,
>
> I have a question about controlling performance counter in kernel.
>
> I created a kernel counter which generates an interrupt at every
> 10000 cache-misses as shown below.
>
> struct perf_event_attr sched_perf_hw_attr = {
> .type = PERF_TYPE_HARDWARE,
> .config = PERF_COUNT_HW_CACHE_MISSES,
> .sample_period = 10000,
> .size = sizeof(struct perf_event_attr),
> .pinned = 1,
> .disbled = 1,
> }
>
> event = perf_event_create_kernel_counter(&sched_perf_hw_attr, cpu,
> NULL, event_overflow_callback, NULL);
>
> What I would like to do is to "reset" the counter before the
> overflow interrupt occurs (e.g, reset at 5000th event),
> and then to restart the sampling from 0.
>
> I found perf_event_enable() and perf_event_disable() only
> start/stop the counting but couln't figure out how to reset the
> sampling as I described above.
>
> I would be really thankful if you explain how I can efficiently reset the
> sampling counter.

Expose and use perf_event_reset().


\
 
 \ /
  Last update: 2012-02-15 14:03    [W:0.049 / U:0.040 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site