Update autogen.sh and comment out --enable-compile-warnings
[memprof.git] / perfctr.h
blobf93548ef51fadb851fa253ce13d179775b275d25
1 /* Extracts from the perfctr sources of the parts of the
2 * linux/perfctr.h and asm-i386/perfctr.h that we need.
3 *
4 * Trying to depend on the user-space library for perfctr
5 * looks like it will be more trouble than its worth,
6 * and doesn't really isolate us from the hard parts.
8 * Copyright (C) 1999-2002 Mikael Pettersson
9 */
11 struct perfctr_sum_ctrs {
12 unsigned long long tsc;
13 unsigned long long pmc[18];
16 struct perfctr_low_ctrs {
17 unsigned int tsc;
18 unsigned int pmc[18];
21 struct perfctr_cpu_control {
22 unsigned int tsc_on;
23 unsigned int nractrs; /* # of a-mode counters */
24 unsigned int nrictrs; /* # of i-mode counters */
25 unsigned int pmc_map[18];
26 unsigned int evntsel[18]; /* one per counter, even on P5 */
27 unsigned int evntsel_aux[18]; /* e.g. P4 ESCR contents */
28 struct {
29 unsigned int pebs_enable; /* for replay tagging */
30 unsigned int pebs_matrix_vert; /* for replay tagging */
31 } p4;
32 int ireset[18]; /* <= 0, for i-mode counters */
35 struct perfctr_cpu_state {
36 unsigned int cstatus;
37 union {
38 unsigned int p5_cesr;
39 unsigned int id; /* cache owner id */
40 } k1;
41 struct perfctr_sum_ctrs sum;
42 struct perfctr_low_ctrs start;
43 struct perfctr_cpu_control control;
44 struct {
45 unsigned int p4_escr_map[18];
46 const void *isuspend_cpu;
47 } k2;
50 struct perfctr_info {
51 char version[32];
52 unsigned char nrcpus;
53 unsigned char cpu_type;
54 unsigned char cpu_features;
55 unsigned long cpu_khz;
58 /* cpu_type values */
59 #define PERFCTR_X86_GENERIC 0 /* any x86 with rdtsc */
60 #define PERFCTR_X86_INTEL_P5 1 /* no rdpmc */
61 #define PERFCTR_X86_INTEL_P5MMX 2
62 #define PERFCTR_X86_INTEL_P6 3
63 #define PERFCTR_X86_INTEL_PII 4
64 #define PERFCTR_X86_INTEL_PIII 5
65 #define PERFCTR_X86_CYRIX_MII 6
66 #define PERFCTR_X86_WINCHIP_C6 7 /* no rdtsc */
67 #define PERFCTR_X86_WINCHIP_2 8 /* no rdtsc */
68 #define PERFCTR_X86_AMD_K7 9
69 #define PERFCTR_X86_VIA_C3 10 /* no pmc0 */
70 #define PERFCTR_X86_INTEL_P4 11 /* model 0 and 1 */
71 #define PERFCTR_X86_INTEL_P4M2 12 /* model 2 and above */
73 /* cpu_features flag bits */
74 #define PERFCTR_FEATURE_RDPMC 0x01
75 #define PERFCTR_FEATURE_RDTSC 0x02
76 #define PERFCTR_FEATURE_PCINT 0x04
78 /* user's view of mmap:ed virtual perfctr */
79 struct vperfctr_state {
80 unsigned int magic;
81 int si_signo;
82 struct perfctr_cpu_state cpu_state;
85 /* `struct vperfctr_state' binary layout version number */
86 #define VPERFCTR_STATE_MAGIC 0x0201 /* 2.1 */
87 #define VPERFCTR_MAGIC ((VPERFCTR_STATE_MAGIC<<16)|PERFCTR_CPU_STATE_MAGIC)
89 /* parameter in VPERFCTR_CONTROL command */
90 struct vperfctr_control {
91 int si_signo;
92 struct perfctr_cpu_control cpu_control;
95 #include <linux/ioctl.h>
96 #define _PERFCTR_IOCTL 0xD0 /* 'P'+128, currently unassigned */
98 #define PERFCTR_INFO _IOR(_PERFCTR_IOCTL,0,struct perfctr_info)
100 #define VPERFCTR_SAMPLE _IO(_PERFCTR_IOCTL,1)
101 #define VPERFCTR_UNLINK _IO(_PERFCTR_IOCTL,2)
102 #define VPERFCTR_CONTROL _IOW(_PERFCTR_IOCTL,3,struct vperfctr_control)
103 #define VPERFCTR_STOP _IO(_PERFCTR_IOCTL,4)
104 #define VPERFCTR_IRESUME _IO(_PERFCTR_IOCTL,5)