Re: [patch] Performance Counters for Linux, v3

Tony Luck
2008-12-11T19:11:21Z

> /*
> * Special "software" counters provided by the kernel, even if
> * the hardware does not support performance counters. These
> * counters measure various physical and sw events of the
> * kernel (and allow the profiling of them as well):
> */
> PERF_COUNT_CPU_CLOCK = -1,
> PERF_COUNT_TASK_CLOCK = -2,
> /*
> * Future software events:
> */
> /* PERF_COUNT_PAGE_FAULTS = -3,
> PERF_COUNT_CONTEXT_SWITCHES = -4, */

...
> +[ Note: more hw_event_types are supported as well, but they are CPU
> + specific and are enumerated via /sys on a per CPU basis. Raw hw event
> + types can be passed in as negative numbers. For example, to count
> + "External bus cycles while bus lock signal asserted" events on Intel
> + Core CPUs, pass in a -0x4064 event type value. ]

It looks like you have an overlap here. You are using some negative numbers
to denote your special software events, but also as "raw" hardware events.
What if these conflict?

-Tony