Lines Matching +full:down +full:- +full:counters
2 Performance Counters for Linux
3 ------------------------------
5 Performance counters are special hardware registers available on most modern
7 as instructions executed, cachemisses suffered, or branches mis-predicted -
8 without slowing down the kernel or applications. These registers can also
9 trigger interrupts when a threshold number of events have passed - and can
13 hardware capabilities. It provides per task and per CPU counters, counter
15 provides "virtual" 64-bit counters, regardless of the width of the
16 underlying hardware counters.
18 Performance counters are accessed via special file descriptors.
32 Multiple counters can be kept open at a time, and the counters
72 is divided into 3 bit-fields:
80 machine-specific.
112 on all CPUs that implement Performance Counters support under Linux,
116 will return -EINVAL.
118 More hw_event_types are supported as well, but they are CPU-specific
127 * Special "software" counters provided by the kernel, even if the hardware
128 * does not support performance counters. These counters measure various
144 Counters of the type PERF_TYPE_TRACEPOINT are available when the ftrace event
149 Counters come in two flavours: counting counters and sampling
150 counters. A "counting" counter is one that is used for counting the
170 particular counter allowing one to take the round-robin scheduling effect
192 Such (and other) events will be recorded in a ring-buffer, which is
193 available to user-space using mmap() (see below).
206 on the CPU if at all possible. It only applies to hardware counters
208 CPU (e.g. because there are not enough hardware counters or because of
210 'error' state, where reads return end-of-file (i.e. read() returns 0)
214 is on the CPU, it should be the only group using the CPU's counters.
219 counters.
232 these events are recorded in the ring-buffer (see below).
235 This too is recorded in the ring-buffer (see below).
246 pid < 0: all tasks are counted (per cpu counters)
251 cpu == -1: the counter counts on all CPUs
253 (Note: the combination of 'pid == -1' and 'cpu == -1' is not valid.)
255 A 'pid > 0' and 'cpu == -1' counter is a per task counter that counts
257 gets schedule to. Per task counters can be created by any user, for
260 A 'pid == -1' and 'cpu == x' counter is a per CPU counter that counts
261 all events on CPU-x. Per CPU counters need CAP_PERFMON or CAP_SYS_ADMIN
268 is created first, with group_fd = -1 in the sys_perf_event_open call
271 (A single counter on its own is created with group_fd = -1 and is
275 only be put onto the CPU if all of the counters in the group can be
276 put onto the CPU. This means that the values of the member counters
283 tracking are logged into a ring-buffer. This ring-buffer is created and
286 The mmap size should be 1+2^n pages, where the first page is a meta-data page
288 as where the ring-buffer head is.
298 * Bits needed to read the hw counters in user-space.
304 * seq = pc->lock;
307 * if (pc->index) {
308 * count = pmc_read(pc->index - 1);
309 * count += pc->offset;
314 * } while (pc->lock != seq);
316 * NOTE: for obvious reason this only works on self-monitoring
326 * User-space reading this value should issue an rmb(), on SMP capable
327 * platforms, after reading this value -- see perf_event_wakeup().
332 NOTE: the hw-counter userspace bits are arch specific and are currently only
335 The following 2^n pages are the ring-buffer which contains events of the form:
410 Future work will include a splice() interface to the ring-buffer.
413 Counters can be enabled and disabled in two ways: via ioctl and via
428 counters in the group will count. Enabling or disabling a member of a
429 group other than the leader only affects that counter - disabling an
430 non-leader stops that counter from counting but doesn't affect any
433 Additionally, non-inherited overflow counters can use
446 This applies to all counters on the current process, whether created
447 by this process or by another, and doesn't affect any counters that
453 -----------------
456 still use the generic software counters based on hrtimers for sampling.
460 - asm/perf_event.h - a basic stub will suffice at first
461 - support for atomic64 types (and associated helper functions)
464 weak stub hw_perf_event_init() to register hardware counters.
466 Architectures that have d-cache aliassing issues, such as Sparc and ARM,