Frederic Weisbecker | 1b290d6 | 2009-11-23 15:42:35 +0100 | [diff] [blame] | 1 | #include "../../../include/linux/hw_breakpoint.h" |
Ingo Molnar | 8ad8db3 | 2009-05-26 11:10:09 +0200 | [diff] [blame] | 2 | #include "util.h" |
Ulrich Drepper | 6b58e7f | 2009-09-04 16:39:51 -0300 | [diff] [blame] | 3 | #include "../perf.h" |
Ingo Molnar | 8ad8db3 | 2009-05-26 11:10:09 +0200 | [diff] [blame] | 4 | #include "parse-options.h" |
| 5 | #include "parse-events.h" |
| 6 | #include "exec_cmd.h" |
Arnaldo Carvalho de Melo | a0055ae | 2009-06-01 17:50:19 -0300 | [diff] [blame] | 7 | #include "string.h" |
Jason Baron | 5beeded | 2009-07-21 14:16:29 -0400 | [diff] [blame] | 8 | #include "cache.h" |
Arjan van de Ven | 8755a8f | 2009-09-12 07:52:51 +0200 | [diff] [blame] | 9 | #include "header.h" |
Clark Williams | 549104f | 2009-11-08 09:03:07 -0600 | [diff] [blame] | 10 | #include "debugfs.h" |
Ingo Molnar | 8ad8db3 | 2009-05-26 11:10:09 +0200 | [diff] [blame] | 11 | |
Li Zefan | c171b55 | 2009-10-15 11:22:07 +0800 | [diff] [blame] | 12 | int nr_counters; |
Ingo Molnar | 8ad8db3 | 2009-05-26 11:10:09 +0200 | [diff] [blame] | 13 | |
Ingo Molnar | cdd6c48 | 2009-09-21 12:02:48 +0200 | [diff] [blame] | 14 | struct perf_event_attr attrs[MAX_COUNTERS]; |
Li Zefan | c171b55 | 2009-10-15 11:22:07 +0800 | [diff] [blame] | 15 | char *filters[MAX_COUNTERS]; |
Ingo Molnar | 8ad8db3 | 2009-05-26 11:10:09 +0200 | [diff] [blame] | 16 | |
| 17 | struct event_symbol { |
Ingo Molnar | 83a0944 | 2009-08-15 12:26:57 +0200 | [diff] [blame] | 18 | u8 type; |
| 19 | u64 config; |
| 20 | const char *symbol; |
| 21 | const char *alias; |
Ingo Molnar | 8ad8db3 | 2009-05-26 11:10:09 +0200 | [diff] [blame] | 22 | }; |
| 23 | |
Frederic Weisbecker | bcd3279 | 2009-09-11 23:19:45 +0200 | [diff] [blame] | 24 | enum event_result { |
| 25 | EVT_FAILED, |
| 26 | EVT_HANDLED, |
| 27 | EVT_HANDLED_ALL |
| 28 | }; |
| 29 | |
Jason Baron | 5beeded | 2009-07-21 14:16:29 -0400 | [diff] [blame] | 30 | char debugfs_path[MAXPATHLEN]; |
| 31 | |
Jaswinder Singh Rajput | 51e2684 | 2009-06-22 16:43:14 +0530 | [diff] [blame] | 32 | #define CHW(x) .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_##x |
| 33 | #define CSW(x) .type = PERF_TYPE_SOFTWARE, .config = PERF_COUNT_SW_##x |
Ingo Molnar | 8ad8db3 | 2009-05-26 11:10:09 +0200 | [diff] [blame] | 34 | |
Ingo Molnar | a21ca2c | 2009-06-06 09:58:57 +0200 | [diff] [blame] | 35 | static struct event_symbol event_symbols[] = { |
Jaswinder Singh Rajput | 74d5b58 | 2009-06-22 16:44:28 +0530 | [diff] [blame] | 36 | { CHW(CPU_CYCLES), "cpu-cycles", "cycles" }, |
| 37 | { CHW(INSTRUCTIONS), "instructions", "" }, |
| 38 | { CHW(CACHE_REFERENCES), "cache-references", "" }, |
| 39 | { CHW(CACHE_MISSES), "cache-misses", "" }, |
| 40 | { CHW(BRANCH_INSTRUCTIONS), "branch-instructions", "branches" }, |
| 41 | { CHW(BRANCH_MISSES), "branch-misses", "" }, |
| 42 | { CHW(BUS_CYCLES), "bus-cycles", "" }, |
Ingo Molnar | a21ca2c | 2009-06-06 09:58:57 +0200 | [diff] [blame] | 43 | |
Jaswinder Singh Rajput | 74d5b58 | 2009-06-22 16:44:28 +0530 | [diff] [blame] | 44 | { CSW(CPU_CLOCK), "cpu-clock", "" }, |
| 45 | { CSW(TASK_CLOCK), "task-clock", "" }, |
Jaswinder Singh Rajput | c0c22db | 2009-06-22 20:47:26 +0530 | [diff] [blame] | 46 | { CSW(PAGE_FAULTS), "page-faults", "faults" }, |
Jaswinder Singh Rajput | 74d5b58 | 2009-06-22 16:44:28 +0530 | [diff] [blame] | 47 | { CSW(PAGE_FAULTS_MIN), "minor-faults", "" }, |
| 48 | { CSW(PAGE_FAULTS_MAJ), "major-faults", "" }, |
| 49 | { CSW(CONTEXT_SWITCHES), "context-switches", "cs" }, |
| 50 | { CSW(CPU_MIGRATIONS), "cpu-migrations", "migrations" }, |
Anton Blanchard | f7d7986 | 2009-10-18 01:09:29 +0000 | [diff] [blame] | 51 | { CSW(ALIGNMENT_FAULTS), "alignment-faults", "" }, |
| 52 | { CSW(EMULATION_FAULTS), "emulation-faults", "" }, |
Ingo Molnar | 8ad8db3 | 2009-05-26 11:10:09 +0200 | [diff] [blame] | 53 | }; |
| 54 | |
Ingo Molnar | cdd6c48 | 2009-09-21 12:02:48 +0200 | [diff] [blame] | 55 | #define __PERF_EVENT_FIELD(config, name) \ |
| 56 | ((config & PERF_EVENT_##name##_MASK) >> PERF_EVENT_##name##_SHIFT) |
Ingo Molnar | 5242519 | 2009-05-26 09:17:18 +0200 | [diff] [blame] | 57 | |
Ingo Molnar | cdd6c48 | 2009-09-21 12:02:48 +0200 | [diff] [blame] | 58 | #define PERF_EVENT_RAW(config) __PERF_EVENT_FIELD(config, RAW) |
| 59 | #define PERF_EVENT_CONFIG(config) __PERF_EVENT_FIELD(config, CONFIG) |
| 60 | #define PERF_EVENT_TYPE(config) __PERF_EVENT_FIELD(config, TYPE) |
| 61 | #define PERF_EVENT_ID(config) __PERF_EVENT_FIELD(config, EVENT) |
Ingo Molnar | 5242519 | 2009-05-26 09:17:18 +0200 | [diff] [blame] | 62 | |
Ingo Molnar | 83a0944 | 2009-08-15 12:26:57 +0200 | [diff] [blame] | 63 | static const char *hw_event_names[] = { |
Ingo Molnar | 8faf3b5 | 2009-06-06 13:58:12 +0200 | [diff] [blame] | 64 | "cycles", |
Ingo Molnar | 5242519 | 2009-05-26 09:17:18 +0200 | [diff] [blame] | 65 | "instructions", |
Ingo Molnar | 8faf3b5 | 2009-06-06 13:58:12 +0200 | [diff] [blame] | 66 | "cache-references", |
| 67 | "cache-misses", |
Ingo Molnar | 5242519 | 2009-05-26 09:17:18 +0200 | [diff] [blame] | 68 | "branches", |
Ingo Molnar | 8faf3b5 | 2009-06-06 13:58:12 +0200 | [diff] [blame] | 69 | "branch-misses", |
| 70 | "bus-cycles", |
Ingo Molnar | 5242519 | 2009-05-26 09:17:18 +0200 | [diff] [blame] | 71 | }; |
| 72 | |
Ingo Molnar | 83a0944 | 2009-08-15 12:26:57 +0200 | [diff] [blame] | 73 | static const char *sw_event_names[] = { |
Ingo Molnar | 44175b6 | 2009-06-13 13:35:00 +0200 | [diff] [blame] | 74 | "cpu-clock-msecs", |
| 75 | "task-clock-msecs", |
Ingo Molnar | 8faf3b5 | 2009-06-06 13:58:12 +0200 | [diff] [blame] | 76 | "page-faults", |
| 77 | "context-switches", |
| 78 | "CPU-migrations", |
| 79 | "minor-faults", |
| 80 | "major-faults", |
Anton Blanchard | f7d7986 | 2009-10-18 01:09:29 +0000 | [diff] [blame] | 81 | "alignment-faults", |
| 82 | "emulation-faults", |
Ingo Molnar | 5242519 | 2009-05-26 09:17:18 +0200 | [diff] [blame] | 83 | }; |
| 84 | |
Ingo Molnar | 8326f44 | 2009-06-05 20:22:46 +0200 | [diff] [blame] | 85 | #define MAX_ALIASES 8 |
| 86 | |
Ingo Molnar | 83a0944 | 2009-08-15 12:26:57 +0200 | [diff] [blame] | 87 | static const char *hw_cache[][MAX_ALIASES] = { |
Anton Blanchard | 9590b7b | 2009-07-06 22:01:31 +1000 | [diff] [blame] | 88 | { "L1-dcache", "l1-d", "l1d", "L1-data", }, |
| 89 | { "L1-icache", "l1-i", "l1i", "L1-instruction", }, |
Jaswinder Singh Rajput | e5c5954 | 2009-06-25 18:25:22 +0530 | [diff] [blame] | 90 | { "LLC", "L2" }, |
| 91 | { "dTLB", "d-tlb", "Data-TLB", }, |
| 92 | { "iTLB", "i-tlb", "Instruction-TLB", }, |
| 93 | { "branch", "branches", "bpu", "btb", "bpc", }, |
Ingo Molnar | 8326f44 | 2009-06-05 20:22:46 +0200 | [diff] [blame] | 94 | }; |
| 95 | |
Ingo Molnar | 83a0944 | 2009-08-15 12:26:57 +0200 | [diff] [blame] | 96 | static const char *hw_cache_op[][MAX_ALIASES] = { |
Jaswinder Singh Rajput | e5c5954 | 2009-06-25 18:25:22 +0530 | [diff] [blame] | 97 | { "load", "loads", "read", }, |
| 98 | { "store", "stores", "write", }, |
| 99 | { "prefetch", "prefetches", "speculative-read", "speculative-load", }, |
Ingo Molnar | 8326f44 | 2009-06-05 20:22:46 +0200 | [diff] [blame] | 100 | }; |
| 101 | |
Ingo Molnar | 83a0944 | 2009-08-15 12:26:57 +0200 | [diff] [blame] | 102 | static const char *hw_cache_result[][MAX_ALIASES] = { |
Jaswinder Singh Rajput | e5c5954 | 2009-06-25 18:25:22 +0530 | [diff] [blame] | 103 | { "refs", "Reference", "ops", "access", }, |
| 104 | { "misses", "miss", }, |
Ingo Molnar | 8326f44 | 2009-06-05 20:22:46 +0200 | [diff] [blame] | 105 | }; |
| 106 | |
Jaswinder Singh Rajput | 06813f6 | 2009-06-25 17:16:07 +0530 | [diff] [blame] | 107 | #define C(x) PERF_COUNT_HW_CACHE_##x |
| 108 | #define CACHE_READ (1 << C(OP_READ)) |
| 109 | #define CACHE_WRITE (1 << C(OP_WRITE)) |
| 110 | #define CACHE_PREFETCH (1 << C(OP_PREFETCH)) |
| 111 | #define COP(x) (1 << x) |
| 112 | |
| 113 | /* |
| 114 | * cache operartion stat |
| 115 | * L1I : Read and prefetch only |
| 116 | * ITLB and BPU : Read-only |
| 117 | */ |
| 118 | static unsigned long hw_cache_stat[C(MAX)] = { |
| 119 | [C(L1D)] = (CACHE_READ | CACHE_WRITE | CACHE_PREFETCH), |
| 120 | [C(L1I)] = (CACHE_READ | CACHE_PREFETCH), |
| 121 | [C(LL)] = (CACHE_READ | CACHE_WRITE | CACHE_PREFETCH), |
| 122 | [C(DTLB)] = (CACHE_READ | CACHE_WRITE | CACHE_PREFETCH), |
| 123 | [C(ITLB)] = (CACHE_READ), |
| 124 | [C(BPU)] = (CACHE_READ), |
| 125 | }; |
| 126 | |
Ulrich Drepper | 6b58e7f | 2009-09-04 16:39:51 -0300 | [diff] [blame] | 127 | #define for_each_subsystem(sys_dir, sys_dirent, sys_next) \ |
Jason Baron | f6bdafe | 2009-07-21 12:20:22 -0400 | [diff] [blame] | 128 | while (!readdir_r(sys_dir, &sys_dirent, &sys_next) && sys_next) \ |
Ulrich Drepper | 6b58e7f | 2009-09-04 16:39:51 -0300 | [diff] [blame] | 129 | if (sys_dirent.d_type == DT_DIR && \ |
Jason Baron | f6bdafe | 2009-07-21 12:20:22 -0400 | [diff] [blame] | 130 | (strcmp(sys_dirent.d_name, ".")) && \ |
| 131 | (strcmp(sys_dirent.d_name, ".."))) |
| 132 | |
Peter Zijlstra | ae07b63 | 2009-08-06 16:48:54 +0200 | [diff] [blame] | 133 | static int tp_event_has_id(struct dirent *sys_dir, struct dirent *evt_dir) |
| 134 | { |
| 135 | char evt_path[MAXPATHLEN]; |
| 136 | int fd; |
| 137 | |
| 138 | snprintf(evt_path, MAXPATHLEN, "%s/%s/%s/id", debugfs_path, |
| 139 | sys_dir->d_name, evt_dir->d_name); |
| 140 | fd = open(evt_path, O_RDONLY); |
| 141 | if (fd < 0) |
| 142 | return -EINVAL; |
| 143 | close(fd); |
| 144 | |
| 145 | return 0; |
| 146 | } |
| 147 | |
Ulrich Drepper | 6b58e7f | 2009-09-04 16:39:51 -0300 | [diff] [blame] | 148 | #define for_each_event(sys_dirent, evt_dir, evt_dirent, evt_next) \ |
Jason Baron | f6bdafe | 2009-07-21 12:20:22 -0400 | [diff] [blame] | 149 | while (!readdir_r(evt_dir, &evt_dirent, &evt_next) && evt_next) \ |
Ulrich Drepper | 6b58e7f | 2009-09-04 16:39:51 -0300 | [diff] [blame] | 150 | if (evt_dirent.d_type == DT_DIR && \ |
Jason Baron | f6bdafe | 2009-07-21 12:20:22 -0400 | [diff] [blame] | 151 | (strcmp(evt_dirent.d_name, ".")) && \ |
Peter Zijlstra | ae07b63 | 2009-08-06 16:48:54 +0200 | [diff] [blame] | 152 | (strcmp(evt_dirent.d_name, "..")) && \ |
| 153 | (!tp_event_has_id(&sys_dirent, &evt_dirent))) |
Jason Baron | f6bdafe | 2009-07-21 12:20:22 -0400 | [diff] [blame] | 154 | |
Li Zefan | 270bbbe | 2009-09-17 16:34:51 +0800 | [diff] [blame] | 155 | #define MAX_EVENT_LENGTH 512 |
Jason Baron | f6bdafe | 2009-07-21 12:20:22 -0400 | [diff] [blame] | 156 | |
Jason Baron | f6bdafe | 2009-07-21 12:20:22 -0400 | [diff] [blame] | 157 | |
Frederic Weisbecker | 1ef2ed1 | 2009-08-28 03:09:58 +0200 | [diff] [blame] | 158 | struct tracepoint_path *tracepoint_id_to_path(u64 config) |
Jason Baron | f6bdafe | 2009-07-21 12:20:22 -0400 | [diff] [blame] | 159 | { |
Frederic Weisbecker | 1ef2ed1 | 2009-08-28 03:09:58 +0200 | [diff] [blame] | 160 | struct tracepoint_path *path = NULL; |
Jason Baron | f6bdafe | 2009-07-21 12:20:22 -0400 | [diff] [blame] | 161 | DIR *sys_dir, *evt_dir; |
| 162 | struct dirent *sys_next, *evt_next, sys_dirent, evt_dirent; |
Jason Baron | f6bdafe | 2009-07-21 12:20:22 -0400 | [diff] [blame] | 163 | char id_buf[4]; |
Eric Dumazet | 725b136 | 2009-09-24 15:39:09 +0200 | [diff] [blame] | 164 | int fd; |
Jason Baron | f6bdafe | 2009-07-21 12:20:22 -0400 | [diff] [blame] | 165 | u64 id; |
| 166 | char evt_path[MAXPATHLEN]; |
Eric Dumazet | 725b136 | 2009-09-24 15:39:09 +0200 | [diff] [blame] | 167 | char dir_path[MAXPATHLEN]; |
Jason Baron | f6bdafe | 2009-07-21 12:20:22 -0400 | [diff] [blame] | 168 | |
Clark Williams | 549104f | 2009-11-08 09:03:07 -0600 | [diff] [blame] | 169 | if (debugfs_valid_mountpoint(debugfs_path)) |
Frederic Weisbecker | 1ef2ed1 | 2009-08-28 03:09:58 +0200 | [diff] [blame] | 170 | return NULL; |
Jason Baron | f6bdafe | 2009-07-21 12:20:22 -0400 | [diff] [blame] | 171 | |
Jason Baron | 5beeded | 2009-07-21 14:16:29 -0400 | [diff] [blame] | 172 | sys_dir = opendir(debugfs_path); |
Jason Baron | f6bdafe | 2009-07-21 12:20:22 -0400 | [diff] [blame] | 173 | if (!sys_dir) |
Eric Dumazet | 725b136 | 2009-09-24 15:39:09 +0200 | [diff] [blame] | 174 | return NULL; |
Jason Baron | f6bdafe | 2009-07-21 12:20:22 -0400 | [diff] [blame] | 175 | |
Ulrich Drepper | 6b58e7f | 2009-09-04 16:39:51 -0300 | [diff] [blame] | 176 | for_each_subsystem(sys_dir, sys_dirent, sys_next) { |
Eric Dumazet | 725b136 | 2009-09-24 15:39:09 +0200 | [diff] [blame] | 177 | |
| 178 | snprintf(dir_path, MAXPATHLEN, "%s/%s", debugfs_path, |
| 179 | sys_dirent.d_name); |
| 180 | evt_dir = opendir(dir_path); |
| 181 | if (!evt_dir) |
Ulrich Drepper | 6b58e7f | 2009-09-04 16:39:51 -0300 | [diff] [blame] | 182 | continue; |
Eric Dumazet | 725b136 | 2009-09-24 15:39:09 +0200 | [diff] [blame] | 183 | |
Ulrich Drepper | 6b58e7f | 2009-09-04 16:39:51 -0300 | [diff] [blame] | 184 | for_each_event(sys_dirent, evt_dir, evt_dirent, evt_next) { |
Eric Dumazet | 725b136 | 2009-09-24 15:39:09 +0200 | [diff] [blame] | 185 | |
| 186 | snprintf(evt_path, MAXPATHLEN, "%s/%s/id", dir_path, |
Jason Baron | f6bdafe | 2009-07-21 12:20:22 -0400 | [diff] [blame] | 187 | evt_dirent.d_name); |
Eric Dumazet | 725b136 | 2009-09-24 15:39:09 +0200 | [diff] [blame] | 188 | fd = open(evt_path, O_RDONLY); |
Jason Baron | f6bdafe | 2009-07-21 12:20:22 -0400 | [diff] [blame] | 189 | if (fd < 0) |
| 190 | continue; |
| 191 | if (read(fd, id_buf, sizeof(id_buf)) < 0) { |
| 192 | close(fd); |
| 193 | continue; |
| 194 | } |
| 195 | close(fd); |
| 196 | id = atoll(id_buf); |
| 197 | if (id == config) { |
| 198 | closedir(evt_dir); |
| 199 | closedir(sys_dir); |
Julia Lawall | 59b4cae | 2009-12-06 10:16:30 +0100 | [diff] [blame] | 200 | path = zalloc(sizeof(*path)); |
Frederic Weisbecker | 1ef2ed1 | 2009-08-28 03:09:58 +0200 | [diff] [blame] | 201 | path->system = malloc(MAX_EVENT_LENGTH); |
| 202 | if (!path->system) { |
| 203 | free(path); |
| 204 | return NULL; |
| 205 | } |
| 206 | path->name = malloc(MAX_EVENT_LENGTH); |
| 207 | if (!path->name) { |
| 208 | free(path->system); |
| 209 | free(path); |
| 210 | return NULL; |
| 211 | } |
| 212 | strncpy(path->system, sys_dirent.d_name, |
| 213 | MAX_EVENT_LENGTH); |
| 214 | strncpy(path->name, evt_dirent.d_name, |
| 215 | MAX_EVENT_LENGTH); |
| 216 | return path; |
Jason Baron | f6bdafe | 2009-07-21 12:20:22 -0400 | [diff] [blame] | 217 | } |
| 218 | } |
| 219 | closedir(evt_dir); |
| 220 | } |
| 221 | |
Jason Baron | f6bdafe | 2009-07-21 12:20:22 -0400 | [diff] [blame] | 222 | closedir(sys_dir); |
Frederic Weisbecker | 1ef2ed1 | 2009-08-28 03:09:58 +0200 | [diff] [blame] | 223 | return NULL; |
| 224 | } |
| 225 | |
| 226 | #define TP_PATH_LEN (MAX_EVENT_LENGTH * 2 + 1) |
| 227 | static const char *tracepoint_id_to_name(u64 config) |
| 228 | { |
| 229 | static char buf[TP_PATH_LEN]; |
| 230 | struct tracepoint_path *path; |
| 231 | |
| 232 | path = tracepoint_id_to_path(config); |
| 233 | if (path) { |
| 234 | snprintf(buf, TP_PATH_LEN, "%s:%s", path->system, path->name); |
| 235 | free(path->name); |
| 236 | free(path->system); |
| 237 | free(path); |
| 238 | } else |
| 239 | snprintf(buf, TP_PATH_LEN, "%s:%s", "unknown", "unknown"); |
| 240 | |
| 241 | return buf; |
Jason Baron | f6bdafe | 2009-07-21 12:20:22 -0400 | [diff] [blame] | 242 | } |
| 243 | |
Jaswinder Singh Rajput | 06813f6 | 2009-06-25 17:16:07 +0530 | [diff] [blame] | 244 | static int is_cache_op_valid(u8 cache_type, u8 cache_op) |
| 245 | { |
| 246 | if (hw_cache_stat[cache_type] & COP(cache_op)) |
| 247 | return 1; /* valid */ |
| 248 | else |
| 249 | return 0; /* invalid */ |
| 250 | } |
| 251 | |
Jaswinder Singh Rajput | e5c5954 | 2009-06-25 18:25:22 +0530 | [diff] [blame] | 252 | static char *event_cache_name(u8 cache_type, u8 cache_op, u8 cache_result) |
| 253 | { |
| 254 | static char name[50]; |
| 255 | |
| 256 | if (cache_result) { |
| 257 | sprintf(name, "%s-%s-%s", hw_cache[cache_type][0], |
| 258 | hw_cache_op[cache_op][0], |
| 259 | hw_cache_result[cache_result][0]); |
| 260 | } else { |
| 261 | sprintf(name, "%s-%s", hw_cache[cache_type][0], |
| 262 | hw_cache_op[cache_op][1]); |
| 263 | } |
| 264 | |
| 265 | return name; |
| 266 | } |
| 267 | |
Ingo Molnar | 83a0944 | 2009-08-15 12:26:57 +0200 | [diff] [blame] | 268 | const char *event_name(int counter) |
Ingo Molnar | 5242519 | 2009-05-26 09:17:18 +0200 | [diff] [blame] | 269 | { |
Paul Mackerras | 9cffa8d | 2009-06-19 22:21:42 +1000 | [diff] [blame] | 270 | u64 config = attrs[counter].config; |
Ingo Molnar | a21ca2c | 2009-06-06 09:58:57 +0200 | [diff] [blame] | 271 | int type = attrs[counter].type; |
Peter Zijlstra | 8f18aec | 2009-08-06 19:40:28 +0200 | [diff] [blame] | 272 | |
| 273 | return __event_name(type, config); |
| 274 | } |
| 275 | |
Ingo Molnar | 83a0944 | 2009-08-15 12:26:57 +0200 | [diff] [blame] | 276 | const char *__event_name(int type, u64 config) |
Peter Zijlstra | 8f18aec | 2009-08-06 19:40:28 +0200 | [diff] [blame] | 277 | { |
Ingo Molnar | 5242519 | 2009-05-26 09:17:18 +0200 | [diff] [blame] | 278 | static char buf[32]; |
| 279 | |
Peter Zijlstra | 8f18aec | 2009-08-06 19:40:28 +0200 | [diff] [blame] | 280 | if (type == PERF_TYPE_RAW) { |
Ingo Molnar | a21ca2c | 2009-06-06 09:58:57 +0200 | [diff] [blame] | 281 | sprintf(buf, "raw 0x%llx", config); |
Ingo Molnar | 5242519 | 2009-05-26 09:17:18 +0200 | [diff] [blame] | 282 | return buf; |
| 283 | } |
| 284 | |
| 285 | switch (type) { |
| 286 | case PERF_TYPE_HARDWARE: |
Peter Zijlstra | f4dbfa8 | 2009-06-11 14:06:28 +0200 | [diff] [blame] | 287 | if (config < PERF_COUNT_HW_MAX) |
Ingo Molnar | a21ca2c | 2009-06-06 09:58:57 +0200 | [diff] [blame] | 288 | return hw_event_names[config]; |
Ingo Molnar | 5242519 | 2009-05-26 09:17:18 +0200 | [diff] [blame] | 289 | return "unknown-hardware"; |
| 290 | |
Ingo Molnar | 8326f44 | 2009-06-05 20:22:46 +0200 | [diff] [blame] | 291 | case PERF_TYPE_HW_CACHE: { |
Paul Mackerras | 9cffa8d | 2009-06-19 22:21:42 +1000 | [diff] [blame] | 292 | u8 cache_type, cache_op, cache_result; |
Ingo Molnar | 8326f44 | 2009-06-05 20:22:46 +0200 | [diff] [blame] | 293 | |
| 294 | cache_type = (config >> 0) & 0xff; |
| 295 | if (cache_type > PERF_COUNT_HW_CACHE_MAX) |
| 296 | return "unknown-ext-hardware-cache-type"; |
| 297 | |
| 298 | cache_op = (config >> 8) & 0xff; |
Ingo Molnar | 8faf3b5 | 2009-06-06 13:58:12 +0200 | [diff] [blame] | 299 | if (cache_op > PERF_COUNT_HW_CACHE_OP_MAX) |
| 300 | return "unknown-ext-hardware-cache-op"; |
Ingo Molnar | 8326f44 | 2009-06-05 20:22:46 +0200 | [diff] [blame] | 301 | |
| 302 | cache_result = (config >> 16) & 0xff; |
Ingo Molnar | 8faf3b5 | 2009-06-06 13:58:12 +0200 | [diff] [blame] | 303 | if (cache_result > PERF_COUNT_HW_CACHE_RESULT_MAX) |
| 304 | return "unknown-ext-hardware-cache-result"; |
Ingo Molnar | 8326f44 | 2009-06-05 20:22:46 +0200 | [diff] [blame] | 305 | |
Jaswinder Singh Rajput | 06813f6 | 2009-06-25 17:16:07 +0530 | [diff] [blame] | 306 | if (!is_cache_op_valid(cache_type, cache_op)) |
| 307 | return "invalid-cache"; |
Ingo Molnar | 8326f44 | 2009-06-05 20:22:46 +0200 | [diff] [blame] | 308 | |
Jaswinder Singh Rajput | e5c5954 | 2009-06-25 18:25:22 +0530 | [diff] [blame] | 309 | return event_cache_name(cache_type, cache_op, cache_result); |
Ingo Molnar | 8326f44 | 2009-06-05 20:22:46 +0200 | [diff] [blame] | 310 | } |
| 311 | |
Ingo Molnar | 5242519 | 2009-05-26 09:17:18 +0200 | [diff] [blame] | 312 | case PERF_TYPE_SOFTWARE: |
Peter Zijlstra | f4dbfa8 | 2009-06-11 14:06:28 +0200 | [diff] [blame] | 313 | if (config < PERF_COUNT_SW_MAX) |
Ingo Molnar | a21ca2c | 2009-06-06 09:58:57 +0200 | [diff] [blame] | 314 | return sw_event_names[config]; |
Ingo Molnar | 5242519 | 2009-05-26 09:17:18 +0200 | [diff] [blame] | 315 | return "unknown-software"; |
| 316 | |
Jason Baron | f6bdafe | 2009-07-21 12:20:22 -0400 | [diff] [blame] | 317 | case PERF_TYPE_TRACEPOINT: |
| 318 | return tracepoint_id_to_name(config); |
| 319 | |
Ingo Molnar | 5242519 | 2009-05-26 09:17:18 +0200 | [diff] [blame] | 320 | default: |
| 321 | break; |
| 322 | } |
| 323 | |
| 324 | return "unknown"; |
| 325 | } |
| 326 | |
Ingo Molnar | 83a0944 | 2009-08-15 12:26:57 +0200 | [diff] [blame] | 327 | static int parse_aliases(const char **str, const char *names[][MAX_ALIASES], int size) |
Ingo Molnar | 8326f44 | 2009-06-05 20:22:46 +0200 | [diff] [blame] | 328 | { |
| 329 | int i, j; |
Paul Mackerras | 61c4598 | 2009-07-01 13:04:34 +1000 | [diff] [blame] | 330 | int n, longest = -1; |
Ingo Molnar | 8326f44 | 2009-06-05 20:22:46 +0200 | [diff] [blame] | 331 | |
| 332 | for (i = 0; i < size; i++) { |
Paul Mackerras | 61c4598 | 2009-07-01 13:04:34 +1000 | [diff] [blame] | 333 | for (j = 0; j < MAX_ALIASES && names[i][j]; j++) { |
| 334 | n = strlen(names[i][j]); |
| 335 | if (n > longest && !strncasecmp(*str, names[i][j], n)) |
| 336 | longest = n; |
| 337 | } |
| 338 | if (longest > 0) { |
| 339 | *str += longest; |
| 340 | return i; |
Ingo Molnar | 8326f44 | 2009-06-05 20:22:46 +0200 | [diff] [blame] | 341 | } |
| 342 | } |
| 343 | |
Ingo Molnar | 8953645 | 2009-06-06 21:04:17 +0200 | [diff] [blame] | 344 | return -1; |
Ingo Molnar | 8326f44 | 2009-06-05 20:22:46 +0200 | [diff] [blame] | 345 | } |
| 346 | |
Frederic Weisbecker | bcd3279 | 2009-09-11 23:19:45 +0200 | [diff] [blame] | 347 | static enum event_result |
Ingo Molnar | cdd6c48 | 2009-09-21 12:02:48 +0200 | [diff] [blame] | 348 | parse_generic_hw_event(const char **str, struct perf_event_attr *attr) |
Ingo Molnar | 8326f44 | 2009-06-05 20:22:46 +0200 | [diff] [blame] | 349 | { |
Paul Mackerras | 61c4598 | 2009-07-01 13:04:34 +1000 | [diff] [blame] | 350 | const char *s = *str; |
| 351 | int cache_type = -1, cache_op = -1, cache_result = -1; |
Ingo Molnar | 8326f44 | 2009-06-05 20:22:46 +0200 | [diff] [blame] | 352 | |
Paul Mackerras | 61c4598 | 2009-07-01 13:04:34 +1000 | [diff] [blame] | 353 | cache_type = parse_aliases(&s, hw_cache, PERF_COUNT_HW_CACHE_MAX); |
Ingo Molnar | 8326f44 | 2009-06-05 20:22:46 +0200 | [diff] [blame] | 354 | /* |
| 355 | * No fallback - if we cannot get a clear cache type |
| 356 | * then bail out: |
| 357 | */ |
| 358 | if (cache_type == -1) |
Frederic Weisbecker | bcd3279 | 2009-09-11 23:19:45 +0200 | [diff] [blame] | 359 | return EVT_FAILED; |
Ingo Molnar | 8326f44 | 2009-06-05 20:22:46 +0200 | [diff] [blame] | 360 | |
Paul Mackerras | 61c4598 | 2009-07-01 13:04:34 +1000 | [diff] [blame] | 361 | while ((cache_op == -1 || cache_result == -1) && *s == '-') { |
| 362 | ++s; |
| 363 | |
| 364 | if (cache_op == -1) { |
| 365 | cache_op = parse_aliases(&s, hw_cache_op, |
| 366 | PERF_COUNT_HW_CACHE_OP_MAX); |
| 367 | if (cache_op >= 0) { |
| 368 | if (!is_cache_op_valid(cache_type, cache_op)) |
| 369 | return 0; |
| 370 | continue; |
| 371 | } |
| 372 | } |
| 373 | |
| 374 | if (cache_result == -1) { |
| 375 | cache_result = parse_aliases(&s, hw_cache_result, |
| 376 | PERF_COUNT_HW_CACHE_RESULT_MAX); |
| 377 | if (cache_result >= 0) |
| 378 | continue; |
| 379 | } |
| 380 | |
| 381 | /* |
| 382 | * Can't parse this as a cache op or result, so back up |
| 383 | * to the '-'. |
| 384 | */ |
| 385 | --s; |
| 386 | break; |
| 387 | } |
| 388 | |
Ingo Molnar | 8326f44 | 2009-06-05 20:22:46 +0200 | [diff] [blame] | 389 | /* |
| 390 | * Fall back to reads: |
| 391 | */ |
Ingo Molnar | 8953645 | 2009-06-06 21:04:17 +0200 | [diff] [blame] | 392 | if (cache_op == -1) |
| 393 | cache_op = PERF_COUNT_HW_CACHE_OP_READ; |
Ingo Molnar | 8326f44 | 2009-06-05 20:22:46 +0200 | [diff] [blame] | 394 | |
Ingo Molnar | 8326f44 | 2009-06-05 20:22:46 +0200 | [diff] [blame] | 395 | /* |
| 396 | * Fall back to accesses: |
| 397 | */ |
| 398 | if (cache_result == -1) |
| 399 | cache_result = PERF_COUNT_HW_CACHE_RESULT_ACCESS; |
| 400 | |
| 401 | attr->config = cache_type | (cache_op << 8) | (cache_result << 16); |
| 402 | attr->type = PERF_TYPE_HW_CACHE; |
| 403 | |
Paul Mackerras | 61c4598 | 2009-07-01 13:04:34 +1000 | [diff] [blame] | 404 | *str = s; |
Frederic Weisbecker | bcd3279 | 2009-09-11 23:19:45 +0200 | [diff] [blame] | 405 | return EVT_HANDLED; |
Ingo Molnar | 8326f44 | 2009-06-05 20:22:46 +0200 | [diff] [blame] | 406 | } |
| 407 | |
Frederic Weisbecker | bcd3279 | 2009-09-11 23:19:45 +0200 | [diff] [blame] | 408 | static enum event_result |
| 409 | parse_single_tracepoint_event(char *sys_name, |
| 410 | const char *evt_name, |
| 411 | unsigned int evt_length, |
| 412 | char *flags, |
Ingo Molnar | cdd6c48 | 2009-09-21 12:02:48 +0200 | [diff] [blame] | 413 | struct perf_event_attr *attr, |
Frederic Weisbecker | bcd3279 | 2009-09-11 23:19:45 +0200 | [diff] [blame] | 414 | const char **strp) |
| 415 | { |
| 416 | char evt_path[MAXPATHLEN]; |
| 417 | char id_buf[4]; |
| 418 | u64 id; |
| 419 | int fd; |
| 420 | |
| 421 | if (flags) { |
Li Zefan | 1281a49 | 2009-09-17 16:49:43 +0800 | [diff] [blame] | 422 | if (!strncmp(flags, "record", strlen(flags))) { |
Frederic Weisbecker | bcd3279 | 2009-09-11 23:19:45 +0200 | [diff] [blame] | 423 | attr->sample_type |= PERF_SAMPLE_RAW; |
Li Zefan | 1281a49 | 2009-09-17 16:49:43 +0800 | [diff] [blame] | 424 | attr->sample_type |= PERF_SAMPLE_TIME; |
| 425 | attr->sample_type |= PERF_SAMPLE_CPU; |
| 426 | } |
Frederic Weisbecker | bcd3279 | 2009-09-11 23:19:45 +0200 | [diff] [blame] | 427 | } |
| 428 | |
| 429 | snprintf(evt_path, MAXPATHLEN, "%s/%s/%s/id", debugfs_path, |
| 430 | sys_name, evt_name); |
| 431 | |
| 432 | fd = open(evt_path, O_RDONLY); |
| 433 | if (fd < 0) |
| 434 | return EVT_FAILED; |
| 435 | |
| 436 | if (read(fd, id_buf, sizeof(id_buf)) < 0) { |
| 437 | close(fd); |
| 438 | return EVT_FAILED; |
| 439 | } |
| 440 | |
| 441 | close(fd); |
| 442 | id = atoll(id_buf); |
| 443 | attr->config = id; |
| 444 | attr->type = PERF_TYPE_TRACEPOINT; |
| 445 | *strp = evt_name + evt_length; |
| 446 | |
| 447 | return EVT_HANDLED; |
| 448 | } |
| 449 | |
| 450 | /* sys + ':' + event + ':' + flags*/ |
| 451 | #define MAX_EVOPT_LEN (MAX_EVENT_LENGTH * 2 + 2 + 128) |
| 452 | static enum event_result |
Masami Hiramatsu | fb1d2ed | 2010-01-05 17:47:17 -0500 | [diff] [blame] | 453 | parse_multiple_tracepoint_event(char *sys_name, const char *evt_exp, |
| 454 | char *flags) |
Frederic Weisbecker | bcd3279 | 2009-09-11 23:19:45 +0200 | [diff] [blame] | 455 | { |
| 456 | char evt_path[MAXPATHLEN]; |
| 457 | struct dirent *evt_ent; |
| 458 | DIR *evt_dir; |
| 459 | |
| 460 | snprintf(evt_path, MAXPATHLEN, "%s/%s", debugfs_path, sys_name); |
| 461 | evt_dir = opendir(evt_path); |
| 462 | |
| 463 | if (!evt_dir) { |
| 464 | perror("Can't open event dir"); |
| 465 | return EVT_FAILED; |
| 466 | } |
| 467 | |
| 468 | while ((evt_ent = readdir(evt_dir))) { |
| 469 | char event_opt[MAX_EVOPT_LEN + 1]; |
| 470 | int len; |
Frederic Weisbecker | bcd3279 | 2009-09-11 23:19:45 +0200 | [diff] [blame] | 471 | |
| 472 | if (!strcmp(evt_ent->d_name, ".") |
| 473 | || !strcmp(evt_ent->d_name, "..") |
| 474 | || !strcmp(evt_ent->d_name, "enable") |
| 475 | || !strcmp(evt_ent->d_name, "filter")) |
| 476 | continue; |
| 477 | |
Masami Hiramatsu | fb1d2ed | 2010-01-05 17:47:17 -0500 | [diff] [blame] | 478 | if (!strglobmatch(evt_ent->d_name, evt_exp)) |
| 479 | continue; |
| 480 | |
Ulrich Drepper | 180570f | 2009-12-06 13:25:30 -0500 | [diff] [blame] | 481 | len = snprintf(event_opt, MAX_EVOPT_LEN, "%s:%s%s%s", sys_name, |
| 482 | evt_ent->d_name, flags ? ":" : "", |
| 483 | flags ?: ""); |
Frederic Weisbecker | bcd3279 | 2009-09-11 23:19:45 +0200 | [diff] [blame] | 484 | if (len < 0) |
| 485 | return EVT_FAILED; |
| 486 | |
Frederic Weisbecker | bcd3279 | 2009-09-11 23:19:45 +0200 | [diff] [blame] | 487 | if (parse_events(NULL, event_opt, 0)) |
| 488 | return EVT_FAILED; |
| 489 | } |
| 490 | |
| 491 | return EVT_HANDLED_ALL; |
| 492 | } |
| 493 | |
| 494 | |
| 495 | static enum event_result parse_tracepoint_event(const char **strp, |
Ingo Molnar | cdd6c48 | 2009-09-21 12:02:48 +0200 | [diff] [blame] | 496 | struct perf_event_attr *attr) |
Jason Baron | f6bdafe | 2009-07-21 12:20:22 -0400 | [diff] [blame] | 497 | { |
| 498 | const char *evt_name; |
Frederic Weisbecker | 3a9f131 | 2009-08-13 10:27:18 +0200 | [diff] [blame] | 499 | char *flags; |
Jason Baron | f6bdafe | 2009-07-21 12:20:22 -0400 | [diff] [blame] | 500 | char sys_name[MAX_EVENT_LENGTH]; |
Jason Baron | f6bdafe | 2009-07-21 12:20:22 -0400 | [diff] [blame] | 501 | unsigned int sys_length, evt_length; |
Jason Baron | f6bdafe | 2009-07-21 12:20:22 -0400 | [diff] [blame] | 502 | |
Clark Williams | 549104f | 2009-11-08 09:03:07 -0600 | [diff] [blame] | 503 | if (debugfs_valid_mountpoint(debugfs_path)) |
Jason Baron | f6bdafe | 2009-07-21 12:20:22 -0400 | [diff] [blame] | 504 | return 0; |
| 505 | |
| 506 | evt_name = strchr(*strp, ':'); |
| 507 | if (!evt_name) |
Frederic Weisbecker | bcd3279 | 2009-09-11 23:19:45 +0200 | [diff] [blame] | 508 | return EVT_FAILED; |
Jason Baron | f6bdafe | 2009-07-21 12:20:22 -0400 | [diff] [blame] | 509 | |
| 510 | sys_length = evt_name - *strp; |
| 511 | if (sys_length >= MAX_EVENT_LENGTH) |
| 512 | return 0; |
| 513 | |
| 514 | strncpy(sys_name, *strp, sys_length); |
| 515 | sys_name[sys_length] = '\0'; |
| 516 | evt_name = evt_name + 1; |
Frederic Weisbecker | 3a9f131 | 2009-08-13 10:27:18 +0200 | [diff] [blame] | 517 | |
| 518 | flags = strchr(evt_name, ':'); |
| 519 | if (flags) { |
Ingo Molnar | 1fc35b2 | 2009-09-13 09:44:29 +0200 | [diff] [blame] | 520 | /* split it out: */ |
| 521 | evt_name = strndup(evt_name, flags - evt_name); |
Frederic Weisbecker | 3a9f131 | 2009-08-13 10:27:18 +0200 | [diff] [blame] | 522 | flags++; |
Frederic Weisbecker | 3a9f131 | 2009-08-13 10:27:18 +0200 | [diff] [blame] | 523 | } |
| 524 | |
Jason Baron | f6bdafe | 2009-07-21 12:20:22 -0400 | [diff] [blame] | 525 | evt_length = strlen(evt_name); |
| 526 | if (evt_length >= MAX_EVENT_LENGTH) |
Frederic Weisbecker | bcd3279 | 2009-09-11 23:19:45 +0200 | [diff] [blame] | 527 | return EVT_FAILED; |
Jason Baron | f6bdafe | 2009-07-21 12:20:22 -0400 | [diff] [blame] | 528 | |
Masami Hiramatsu | fb1d2ed | 2010-01-05 17:47:17 -0500 | [diff] [blame] | 529 | if (strpbrk(evt_name, "*?")) { |
Frederic Weisbecker | bcd3279 | 2009-09-11 23:19:45 +0200 | [diff] [blame] | 530 | *strp = evt_name + evt_length; |
Masami Hiramatsu | fb1d2ed | 2010-01-05 17:47:17 -0500 | [diff] [blame] | 531 | return parse_multiple_tracepoint_event(sys_name, evt_name, |
| 532 | flags); |
Frederic Weisbecker | bcd3279 | 2009-09-11 23:19:45 +0200 | [diff] [blame] | 533 | } else |
| 534 | return parse_single_tracepoint_event(sys_name, evt_name, |
| 535 | evt_length, flags, |
| 536 | attr, strp); |
Jason Baron | f6bdafe | 2009-07-21 12:20:22 -0400 | [diff] [blame] | 537 | } |
| 538 | |
Frederic Weisbecker | 1b290d6 | 2009-11-23 15:42:35 +0100 | [diff] [blame] | 539 | static enum event_result |
| 540 | parse_breakpoint_type(const char *type, const char **strp, |
| 541 | struct perf_event_attr *attr) |
| 542 | { |
| 543 | int i; |
| 544 | |
| 545 | for (i = 0; i < 3; i++) { |
| 546 | if (!type[i]) |
| 547 | break; |
| 548 | |
| 549 | switch (type[i]) { |
| 550 | case 'r': |
| 551 | attr->bp_type |= HW_BREAKPOINT_R; |
| 552 | break; |
| 553 | case 'w': |
| 554 | attr->bp_type |= HW_BREAKPOINT_W; |
| 555 | break; |
| 556 | case 'x': |
| 557 | attr->bp_type |= HW_BREAKPOINT_X; |
| 558 | break; |
| 559 | default: |
| 560 | return EVT_FAILED; |
| 561 | } |
| 562 | } |
| 563 | if (!attr->bp_type) /* Default */ |
| 564 | attr->bp_type = HW_BREAKPOINT_R | HW_BREAKPOINT_W; |
| 565 | |
| 566 | *strp = type + i; |
| 567 | |
| 568 | return EVT_HANDLED; |
| 569 | } |
| 570 | |
| 571 | static enum event_result |
| 572 | parse_breakpoint_event(const char **strp, struct perf_event_attr *attr) |
| 573 | { |
| 574 | const char *target; |
| 575 | const char *type; |
| 576 | char *endaddr; |
| 577 | u64 addr; |
| 578 | enum event_result err; |
| 579 | |
| 580 | target = strchr(*strp, ':'); |
| 581 | if (!target) |
| 582 | return EVT_FAILED; |
| 583 | |
| 584 | if (strncmp(*strp, "mem", target - *strp) != 0) |
| 585 | return EVT_FAILED; |
| 586 | |
| 587 | target++; |
| 588 | |
| 589 | addr = strtoull(target, &endaddr, 0); |
| 590 | if (target == endaddr) |
| 591 | return EVT_FAILED; |
| 592 | |
| 593 | attr->bp_addr = addr; |
| 594 | *strp = endaddr; |
| 595 | |
| 596 | type = strchr(target, ':'); |
| 597 | |
| 598 | /* If no type is defined, just rw as default */ |
| 599 | if (!type) { |
| 600 | attr->bp_type = HW_BREAKPOINT_R | HW_BREAKPOINT_W; |
| 601 | } else { |
| 602 | err = parse_breakpoint_type(++type, strp, attr); |
| 603 | if (err == EVT_FAILED) |
| 604 | return EVT_FAILED; |
| 605 | } |
| 606 | |
| 607 | /* We should find a nice way to override the access type */ |
| 608 | attr->bp_len = HW_BREAKPOINT_LEN_4; |
| 609 | attr->type = PERF_TYPE_BREAKPOINT; |
| 610 | |
| 611 | return EVT_HANDLED; |
| 612 | } |
| 613 | |
Jaswinder Singh Rajput | 74d5b58 | 2009-06-22 16:44:28 +0530 | [diff] [blame] | 614 | static int check_events(const char *str, unsigned int i) |
| 615 | { |
Paul Mackerras | 61c4598 | 2009-07-01 13:04:34 +1000 | [diff] [blame] | 616 | int n; |
Jaswinder Singh Rajput | 74d5b58 | 2009-06-22 16:44:28 +0530 | [diff] [blame] | 617 | |
Paul Mackerras | 61c4598 | 2009-07-01 13:04:34 +1000 | [diff] [blame] | 618 | n = strlen(event_symbols[i].symbol); |
| 619 | if (!strncmp(str, event_symbols[i].symbol, n)) |
| 620 | return n; |
| 621 | |
| 622 | n = strlen(event_symbols[i].alias); |
| 623 | if (n) |
| 624 | if (!strncmp(str, event_symbols[i].alias, n)) |
| 625 | return n; |
| 626 | return 0; |
| 627 | } |
| 628 | |
Frederic Weisbecker | bcd3279 | 2009-09-11 23:19:45 +0200 | [diff] [blame] | 629 | static enum event_result |
Ingo Molnar | cdd6c48 | 2009-09-21 12:02:48 +0200 | [diff] [blame] | 630 | parse_symbolic_event(const char **strp, struct perf_event_attr *attr) |
Paul Mackerras | 61c4598 | 2009-07-01 13:04:34 +1000 | [diff] [blame] | 631 | { |
| 632 | const char *str = *strp; |
| 633 | unsigned int i; |
| 634 | int n; |
| 635 | |
| 636 | for (i = 0; i < ARRAY_SIZE(event_symbols); i++) { |
| 637 | n = check_events(str, i); |
| 638 | if (n > 0) { |
| 639 | attr->type = event_symbols[i].type; |
| 640 | attr->config = event_symbols[i].config; |
| 641 | *strp = str + n; |
Frederic Weisbecker | bcd3279 | 2009-09-11 23:19:45 +0200 | [diff] [blame] | 642 | return EVT_HANDLED; |
Paul Mackerras | 61c4598 | 2009-07-01 13:04:34 +1000 | [diff] [blame] | 643 | } |
| 644 | } |
Frederic Weisbecker | bcd3279 | 2009-09-11 23:19:45 +0200 | [diff] [blame] | 645 | return EVT_FAILED; |
Paul Mackerras | 61c4598 | 2009-07-01 13:04:34 +1000 | [diff] [blame] | 646 | } |
| 647 | |
Frederic Weisbecker | bcd3279 | 2009-09-11 23:19:45 +0200 | [diff] [blame] | 648 | static enum event_result |
Ingo Molnar | cdd6c48 | 2009-09-21 12:02:48 +0200 | [diff] [blame] | 649 | parse_raw_event(const char **strp, struct perf_event_attr *attr) |
Paul Mackerras | 61c4598 | 2009-07-01 13:04:34 +1000 | [diff] [blame] | 650 | { |
| 651 | const char *str = *strp; |
| 652 | u64 config; |
| 653 | int n; |
| 654 | |
| 655 | if (*str != 'r') |
Frederic Weisbecker | bcd3279 | 2009-09-11 23:19:45 +0200 | [diff] [blame] | 656 | return EVT_FAILED; |
Paul Mackerras | 61c4598 | 2009-07-01 13:04:34 +1000 | [diff] [blame] | 657 | n = hex2u64(str + 1, &config); |
| 658 | if (n > 0) { |
| 659 | *strp = str + n + 1; |
| 660 | attr->type = PERF_TYPE_RAW; |
| 661 | attr->config = config; |
Frederic Weisbecker | bcd3279 | 2009-09-11 23:19:45 +0200 | [diff] [blame] | 662 | return EVT_HANDLED; |
Paul Mackerras | 61c4598 | 2009-07-01 13:04:34 +1000 | [diff] [blame] | 663 | } |
Frederic Weisbecker | bcd3279 | 2009-09-11 23:19:45 +0200 | [diff] [blame] | 664 | return EVT_FAILED; |
Paul Mackerras | 61c4598 | 2009-07-01 13:04:34 +1000 | [diff] [blame] | 665 | } |
| 666 | |
Frederic Weisbecker | bcd3279 | 2009-09-11 23:19:45 +0200 | [diff] [blame] | 667 | static enum event_result |
Ingo Molnar | cdd6c48 | 2009-09-21 12:02:48 +0200 | [diff] [blame] | 668 | parse_numeric_event(const char **strp, struct perf_event_attr *attr) |
Paul Mackerras | 61c4598 | 2009-07-01 13:04:34 +1000 | [diff] [blame] | 669 | { |
| 670 | const char *str = *strp; |
| 671 | char *endp; |
| 672 | unsigned long type; |
| 673 | u64 config; |
| 674 | |
| 675 | type = strtoul(str, &endp, 0); |
| 676 | if (endp > str && type < PERF_TYPE_MAX && *endp == ':') { |
| 677 | str = endp + 1; |
| 678 | config = strtoul(str, &endp, 0); |
| 679 | if (endp > str) { |
| 680 | attr->type = type; |
| 681 | attr->config = config; |
| 682 | *strp = endp; |
Frederic Weisbecker | bcd3279 | 2009-09-11 23:19:45 +0200 | [diff] [blame] | 683 | return EVT_HANDLED; |
Paul Mackerras | 61c4598 | 2009-07-01 13:04:34 +1000 | [diff] [blame] | 684 | } |
| 685 | } |
Frederic Weisbecker | bcd3279 | 2009-09-11 23:19:45 +0200 | [diff] [blame] | 686 | return EVT_FAILED; |
Paul Mackerras | 61c4598 | 2009-07-01 13:04:34 +1000 | [diff] [blame] | 687 | } |
| 688 | |
Frederic Weisbecker | bcd3279 | 2009-09-11 23:19:45 +0200 | [diff] [blame] | 689 | static enum event_result |
Ingo Molnar | cdd6c48 | 2009-09-21 12:02:48 +0200 | [diff] [blame] | 690 | parse_event_modifier(const char **strp, struct perf_event_attr *attr) |
Paul Mackerras | 61c4598 | 2009-07-01 13:04:34 +1000 | [diff] [blame] | 691 | { |
| 692 | const char *str = *strp; |
| 693 | int eu = 1, ek = 1, eh = 1; |
| 694 | |
| 695 | if (*str++ != ':') |
| 696 | return 0; |
| 697 | while (*str) { |
| 698 | if (*str == 'u') |
| 699 | eu = 0; |
| 700 | else if (*str == 'k') |
| 701 | ek = 0; |
| 702 | else if (*str == 'h') |
| 703 | eh = 0; |
| 704 | else |
| 705 | break; |
| 706 | ++str; |
| 707 | } |
| 708 | if (str >= *strp + 2) { |
| 709 | *strp = str; |
| 710 | attr->exclude_user = eu; |
| 711 | attr->exclude_kernel = ek; |
| 712 | attr->exclude_hv = eh; |
| 713 | return 1; |
| 714 | } |
Jaswinder Singh Rajput | 74d5b58 | 2009-06-22 16:44:28 +0530 | [diff] [blame] | 715 | return 0; |
| 716 | } |
| 717 | |
Ingo Molnar | 8ad8db3 | 2009-05-26 11:10:09 +0200 | [diff] [blame] | 718 | /* |
| 719 | * Each event can have multiple symbolic names. |
| 720 | * Symbolic names are (almost) exactly matched. |
| 721 | */ |
Frederic Weisbecker | bcd3279 | 2009-09-11 23:19:45 +0200 | [diff] [blame] | 722 | static enum event_result |
Ingo Molnar | cdd6c48 | 2009-09-21 12:02:48 +0200 | [diff] [blame] | 723 | parse_event_symbols(const char **str, struct perf_event_attr *attr) |
Ingo Molnar | 8ad8db3 | 2009-05-26 11:10:09 +0200 | [diff] [blame] | 724 | { |
Frederic Weisbecker | bcd3279 | 2009-09-11 23:19:45 +0200 | [diff] [blame] | 725 | enum event_result ret; |
Ingo Molnar | 8ad8db3 | 2009-05-26 11:10:09 +0200 | [diff] [blame] | 726 | |
Frederic Weisbecker | bcd3279 | 2009-09-11 23:19:45 +0200 | [diff] [blame] | 727 | ret = parse_tracepoint_event(str, attr); |
| 728 | if (ret != EVT_FAILED) |
| 729 | goto modifier; |
| 730 | |
| 731 | ret = parse_raw_event(str, attr); |
| 732 | if (ret != EVT_FAILED) |
| 733 | goto modifier; |
| 734 | |
| 735 | ret = parse_numeric_event(str, attr); |
| 736 | if (ret != EVT_FAILED) |
| 737 | goto modifier; |
| 738 | |
| 739 | ret = parse_symbolic_event(str, attr); |
| 740 | if (ret != EVT_FAILED) |
| 741 | goto modifier; |
| 742 | |
| 743 | ret = parse_generic_hw_event(str, attr); |
| 744 | if (ret != EVT_FAILED) |
| 745 | goto modifier; |
| 746 | |
Frederic Weisbecker | 1b290d6 | 2009-11-23 15:42:35 +0100 | [diff] [blame] | 747 | ret = parse_breakpoint_event(str, attr); |
| 748 | if (ret != EVT_FAILED) |
| 749 | goto modifier; |
| 750 | |
Marti Raudsepp | 85df6f6 | 2009-10-27 00:33:04 +0000 | [diff] [blame] | 751 | fprintf(stderr, "invalid or unsupported event: '%s'\n", *str); |
| 752 | fprintf(stderr, "Run 'perf list' for a list of valid events\n"); |
Frederic Weisbecker | bcd3279 | 2009-09-11 23:19:45 +0200 | [diff] [blame] | 753 | return EVT_FAILED; |
| 754 | |
| 755 | modifier: |
Paul Mackerras | 61c4598 | 2009-07-01 13:04:34 +1000 | [diff] [blame] | 756 | parse_event_modifier(str, attr); |
Ingo Molnar | a21ca2c | 2009-06-06 09:58:57 +0200 | [diff] [blame] | 757 | |
Frederic Weisbecker | bcd3279 | 2009-09-11 23:19:45 +0200 | [diff] [blame] | 758 | return ret; |
Ingo Molnar | 8ad8db3 | 2009-05-26 11:10:09 +0200 | [diff] [blame] | 759 | } |
| 760 | |
Arnaldo Carvalho de Melo | ae99fb2 | 2009-12-28 22:48:33 -0200 | [diff] [blame] | 761 | static int store_event_type(const char *orgname) |
Arjan van de Ven | 8755a8f | 2009-09-12 07:52:51 +0200 | [diff] [blame] | 762 | { |
| 763 | char filename[PATH_MAX], *c; |
| 764 | FILE *file; |
Arnaldo Carvalho de Melo | ae99fb2 | 2009-12-28 22:48:33 -0200 | [diff] [blame] | 765 | int id, n; |
Arjan van de Ven | 8755a8f | 2009-09-12 07:52:51 +0200 | [diff] [blame] | 766 | |
Ashwin Chaugule | 63c9e01 | 2009-10-04 15:49:34 -0700 | [diff] [blame] | 767 | sprintf(filename, "%s/", debugfs_path); |
| 768 | strncat(filename, orgname, strlen(orgname)); |
| 769 | strcat(filename, "/id"); |
| 770 | |
Arjan van de Ven | 8755a8f | 2009-09-12 07:52:51 +0200 | [diff] [blame] | 771 | c = strchr(filename, ':'); |
| 772 | if (c) |
| 773 | *c = '/'; |
| 774 | |
| 775 | file = fopen(filename, "r"); |
| 776 | if (!file) |
Arnaldo Carvalho de Melo | ae99fb2 | 2009-12-28 22:48:33 -0200 | [diff] [blame] | 777 | return 0; |
| 778 | n = fscanf(file, "%i", &id); |
Arjan van de Ven | 8755a8f | 2009-09-12 07:52:51 +0200 | [diff] [blame] | 779 | fclose(file); |
Arnaldo Carvalho de Melo | ae99fb2 | 2009-12-28 22:48:33 -0200 | [diff] [blame] | 780 | if (n < 1) { |
| 781 | pr_err("cannot store event ID\n"); |
| 782 | return -EINVAL; |
| 783 | } |
| 784 | return perf_header__push_event(id, orgname); |
Arjan van de Ven | 8755a8f | 2009-09-12 07:52:51 +0200 | [diff] [blame] | 785 | } |
| 786 | |
Ingo Molnar | f37a291 | 2009-07-01 12:37:06 +0200 | [diff] [blame] | 787 | int parse_events(const struct option *opt __used, const char *str, int unset __used) |
Ingo Molnar | 8ad8db3 | 2009-05-26 11:10:09 +0200 | [diff] [blame] | 788 | { |
Ingo Molnar | cdd6c48 | 2009-09-21 12:02:48 +0200 | [diff] [blame] | 789 | struct perf_event_attr attr; |
Frederic Weisbecker | bcd3279 | 2009-09-11 23:19:45 +0200 | [diff] [blame] | 790 | enum event_result ret; |
Ingo Molnar | 8ad8db3 | 2009-05-26 11:10:09 +0200 | [diff] [blame] | 791 | |
Arjan van de Ven | 8755a8f | 2009-09-12 07:52:51 +0200 | [diff] [blame] | 792 | if (strchr(str, ':')) |
Arnaldo Carvalho de Melo | ae99fb2 | 2009-12-28 22:48:33 -0200 | [diff] [blame] | 793 | if (store_event_type(str) < 0) |
| 794 | return -1; |
Arjan van de Ven | 8755a8f | 2009-09-12 07:52:51 +0200 | [diff] [blame] | 795 | |
Paul Mackerras | 61c4598 | 2009-07-01 13:04:34 +1000 | [diff] [blame] | 796 | for (;;) { |
| 797 | if (nr_counters == MAX_COUNTERS) |
| 798 | return -1; |
Ingo Molnar | 8ad8db3 | 2009-05-26 11:10:09 +0200 | [diff] [blame] | 799 | |
Paul Mackerras | 61c4598 | 2009-07-01 13:04:34 +1000 | [diff] [blame] | 800 | memset(&attr, 0, sizeof(attr)); |
Frederic Weisbecker | bcd3279 | 2009-09-11 23:19:45 +0200 | [diff] [blame] | 801 | ret = parse_event_symbols(&str, &attr); |
| 802 | if (ret == EVT_FAILED) |
Paul Mackerras | 61c4598 | 2009-07-01 13:04:34 +1000 | [diff] [blame] | 803 | return -1; |
Ingo Molnar | 8ad8db3 | 2009-05-26 11:10:09 +0200 | [diff] [blame] | 804 | |
Paul Mackerras | 61c4598 | 2009-07-01 13:04:34 +1000 | [diff] [blame] | 805 | if (!(*str == 0 || *str == ',' || isspace(*str))) |
| 806 | return -1; |
Ingo Molnar | 8ad8db3 | 2009-05-26 11:10:09 +0200 | [diff] [blame] | 807 | |
Frederic Weisbecker | bcd3279 | 2009-09-11 23:19:45 +0200 | [diff] [blame] | 808 | if (ret != EVT_HANDLED_ALL) { |
| 809 | attrs[nr_counters] = attr; |
| 810 | nr_counters++; |
| 811 | } |
Paul Mackerras | 61c4598 | 2009-07-01 13:04:34 +1000 | [diff] [blame] | 812 | |
| 813 | if (*str == 0) |
| 814 | break; |
| 815 | if (*str == ',') |
| 816 | ++str; |
| 817 | while (isspace(*str)) |
| 818 | ++str; |
Ingo Molnar | 8ad8db3 | 2009-05-26 11:10:09 +0200 | [diff] [blame] | 819 | } |
| 820 | |
| 821 | return 0; |
| 822 | } |
| 823 | |
Li Zefan | c171b55 | 2009-10-15 11:22:07 +0800 | [diff] [blame] | 824 | int parse_filter(const struct option *opt __used, const char *str, |
| 825 | int unset __used) |
| 826 | { |
| 827 | int i = nr_counters - 1; |
| 828 | int len = strlen(str); |
| 829 | |
| 830 | if (i < 0 || attrs[i].type != PERF_TYPE_TRACEPOINT) { |
| 831 | fprintf(stderr, |
| 832 | "-F option should follow a -e tracepoint option\n"); |
| 833 | return -1; |
| 834 | } |
| 835 | |
| 836 | filters[i] = malloc(len + 1); |
| 837 | if (!filters[i]) { |
| 838 | fprintf(stderr, "not enough memory to hold filter string\n"); |
| 839 | return -1; |
| 840 | } |
| 841 | strcpy(filters[i], str); |
| 842 | |
| 843 | return 0; |
| 844 | } |
| 845 | |
Thomas Gleixner | 86847b6 | 2009-06-06 12:24:17 +0200 | [diff] [blame] | 846 | static const char * const event_type_descriptors[] = { |
Thomas Gleixner | 86847b6 | 2009-06-06 12:24:17 +0200 | [diff] [blame] | 847 | "Hardware event", |
| 848 | "Software event", |
| 849 | "Tracepoint event", |
| 850 | "Hardware cache event", |
Liming Wang | 41bdcb2 | 2009-12-29 16:37:07 +0800 | [diff] [blame] | 851 | "Raw hardware event descriptor", |
| 852 | "Hardware breakpoint", |
Thomas Gleixner | 86847b6 | 2009-06-06 12:24:17 +0200 | [diff] [blame] | 853 | }; |
| 854 | |
Ingo Molnar | 8ad8db3 | 2009-05-26 11:10:09 +0200 | [diff] [blame] | 855 | /* |
Jason Baron | f6bdafe | 2009-07-21 12:20:22 -0400 | [diff] [blame] | 856 | * Print the events from <debugfs_mount_point>/tracing/events |
| 857 | */ |
| 858 | |
| 859 | static void print_tracepoint_events(void) |
| 860 | { |
| 861 | DIR *sys_dir, *evt_dir; |
| 862 | struct dirent *sys_next, *evt_next, sys_dirent, evt_dirent; |
Jason Baron | f6bdafe | 2009-07-21 12:20:22 -0400 | [diff] [blame] | 863 | char evt_path[MAXPATHLEN]; |
Eric Dumazet | 725b136 | 2009-09-24 15:39:09 +0200 | [diff] [blame] | 864 | char dir_path[MAXPATHLEN]; |
Jason Baron | f6bdafe | 2009-07-21 12:20:22 -0400 | [diff] [blame] | 865 | |
Clark Williams | 549104f | 2009-11-08 09:03:07 -0600 | [diff] [blame] | 866 | if (debugfs_valid_mountpoint(debugfs_path)) |
Jason Baron | f6bdafe | 2009-07-21 12:20:22 -0400 | [diff] [blame] | 867 | return; |
| 868 | |
Jason Baron | 5beeded | 2009-07-21 14:16:29 -0400 | [diff] [blame] | 869 | sys_dir = opendir(debugfs_path); |
Jason Baron | f6bdafe | 2009-07-21 12:20:22 -0400 | [diff] [blame] | 870 | if (!sys_dir) |
Eric Dumazet | 725b136 | 2009-09-24 15:39:09 +0200 | [diff] [blame] | 871 | return; |
Jason Baron | f6bdafe | 2009-07-21 12:20:22 -0400 | [diff] [blame] | 872 | |
Ulrich Drepper | 6b58e7f | 2009-09-04 16:39:51 -0300 | [diff] [blame] | 873 | for_each_subsystem(sys_dir, sys_dirent, sys_next) { |
Eric Dumazet | 725b136 | 2009-09-24 15:39:09 +0200 | [diff] [blame] | 874 | |
| 875 | snprintf(dir_path, MAXPATHLEN, "%s/%s", debugfs_path, |
| 876 | sys_dirent.d_name); |
| 877 | evt_dir = opendir(dir_path); |
| 878 | if (!evt_dir) |
Ulrich Drepper | 6b58e7f | 2009-09-04 16:39:51 -0300 | [diff] [blame] | 879 | continue; |
Eric Dumazet | 725b136 | 2009-09-24 15:39:09 +0200 | [diff] [blame] | 880 | |
Ulrich Drepper | 6b58e7f | 2009-09-04 16:39:51 -0300 | [diff] [blame] | 881 | for_each_event(sys_dirent, evt_dir, evt_dirent, evt_next) { |
Jason Baron | f6bdafe | 2009-07-21 12:20:22 -0400 | [diff] [blame] | 882 | snprintf(evt_path, MAXPATHLEN, "%s:%s", |
| 883 | sys_dirent.d_name, evt_dirent.d_name); |
Marti Raudsepp | 689d301 | 2009-10-27 00:33:05 +0000 | [diff] [blame] | 884 | printf(" %-42s [%s]\n", evt_path, |
Liming Wang | 41bdcb2 | 2009-12-29 16:37:07 +0800 | [diff] [blame] | 885 | event_type_descriptors[PERF_TYPE_TRACEPOINT]); |
Jason Baron | f6bdafe | 2009-07-21 12:20:22 -0400 | [diff] [blame] | 886 | } |
| 887 | closedir(evt_dir); |
| 888 | } |
Jason Baron | f6bdafe | 2009-07-21 12:20:22 -0400 | [diff] [blame] | 889 | closedir(sys_dir); |
| 890 | } |
| 891 | |
| 892 | /* |
Thomas Gleixner | 86847b6 | 2009-06-06 12:24:17 +0200 | [diff] [blame] | 893 | * Print the help text for the event symbols: |
Ingo Molnar | 8ad8db3 | 2009-05-26 11:10:09 +0200 | [diff] [blame] | 894 | */ |
Thomas Gleixner | 86847b6 | 2009-06-06 12:24:17 +0200 | [diff] [blame] | 895 | void print_events(void) |
Ingo Molnar | 8ad8db3 | 2009-05-26 11:10:09 +0200 | [diff] [blame] | 896 | { |
Thomas Gleixner | 86847b6 | 2009-06-06 12:24:17 +0200 | [diff] [blame] | 897 | struct event_symbol *syms = event_symbols; |
Jaswinder Singh Rajput | 73c24cb8 | 2009-07-01 18:36:18 +0530 | [diff] [blame] | 898 | unsigned int i, type, op, prev_type = -1; |
Jaswinder Singh Rajput | 74d5b58 | 2009-06-22 16:44:28 +0530 | [diff] [blame] | 899 | char name[40]; |
Ingo Molnar | 8ad8db3 | 2009-05-26 11:10:09 +0200 | [diff] [blame] | 900 | |
Marti Raudsepp | 689d301 | 2009-10-27 00:33:05 +0000 | [diff] [blame] | 901 | printf("\n"); |
| 902 | printf("List of pre-defined events (to be used in -e):\n"); |
Ingo Molnar | 8ad8db3 | 2009-05-26 11:10:09 +0200 | [diff] [blame] | 903 | |
Thomas Gleixner | 86847b6 | 2009-06-06 12:24:17 +0200 | [diff] [blame] | 904 | for (i = 0; i < ARRAY_SIZE(event_symbols); i++, syms++) { |
Liming Wang | 41bdcb2 | 2009-12-29 16:37:07 +0800 | [diff] [blame] | 905 | type = syms->type; |
Ingo Molnar | 8ad8db3 | 2009-05-26 11:10:09 +0200 | [diff] [blame] | 906 | |
Thomas Gleixner | 86847b6 | 2009-06-06 12:24:17 +0200 | [diff] [blame] | 907 | if (type != prev_type) |
Marti Raudsepp | 689d301 | 2009-10-27 00:33:05 +0000 | [diff] [blame] | 908 | printf("\n"); |
Ingo Molnar | 8ad8db3 | 2009-05-26 11:10:09 +0200 | [diff] [blame] | 909 | |
Jaswinder Singh Rajput | 74d5b58 | 2009-06-22 16:44:28 +0530 | [diff] [blame] | 910 | if (strlen(syms->alias)) |
| 911 | sprintf(name, "%s OR %s", syms->symbol, syms->alias); |
| 912 | else |
| 913 | strcpy(name, syms->symbol); |
Marti Raudsepp | 689d301 | 2009-10-27 00:33:05 +0000 | [diff] [blame] | 914 | printf(" %-42s [%s]\n", name, |
Thomas Gleixner | 86847b6 | 2009-06-06 12:24:17 +0200 | [diff] [blame] | 915 | event_type_descriptors[type]); |
Ingo Molnar | 8ad8db3 | 2009-05-26 11:10:09 +0200 | [diff] [blame] | 916 | |
Thomas Gleixner | 86847b6 | 2009-06-06 12:24:17 +0200 | [diff] [blame] | 917 | prev_type = type; |
Ingo Molnar | 8ad8db3 | 2009-05-26 11:10:09 +0200 | [diff] [blame] | 918 | } |
| 919 | |
Marti Raudsepp | 689d301 | 2009-10-27 00:33:05 +0000 | [diff] [blame] | 920 | printf("\n"); |
Jaswinder Singh Rajput | 73c24cb8 | 2009-07-01 18:36:18 +0530 | [diff] [blame] | 921 | for (type = 0; type < PERF_COUNT_HW_CACHE_MAX; type++) { |
| 922 | for (op = 0; op < PERF_COUNT_HW_CACHE_OP_MAX; op++) { |
| 923 | /* skip invalid cache type */ |
| 924 | if (!is_cache_op_valid(type, op)) |
| 925 | continue; |
| 926 | |
| 927 | for (i = 0; i < PERF_COUNT_HW_CACHE_RESULT_MAX; i++) { |
Marti Raudsepp | 689d301 | 2009-10-27 00:33:05 +0000 | [diff] [blame] | 928 | printf(" %-42s [%s]\n", |
Jaswinder Singh Rajput | 73c24cb8 | 2009-07-01 18:36:18 +0530 | [diff] [blame] | 929 | event_cache_name(type, op, i), |
Liming Wang | 41bdcb2 | 2009-12-29 16:37:07 +0800 | [diff] [blame] | 930 | event_type_descriptors[PERF_TYPE_HW_CACHE]); |
Jaswinder Singh Rajput | 73c24cb8 | 2009-07-01 18:36:18 +0530 | [diff] [blame] | 931 | } |
| 932 | } |
| 933 | } |
| 934 | |
Marti Raudsepp | 689d301 | 2009-10-27 00:33:05 +0000 | [diff] [blame] | 935 | printf("\n"); |
Liming Wang | 41bdcb2 | 2009-12-29 16:37:07 +0800 | [diff] [blame] | 936 | printf(" %-42s [%s]\n", |
| 937 | "rNNN", event_type_descriptors[PERF_TYPE_RAW]); |
Marti Raudsepp | 689d301 | 2009-10-27 00:33:05 +0000 | [diff] [blame] | 938 | printf("\n"); |
Thomas Gleixner | 86847b6 | 2009-06-06 12:24:17 +0200 | [diff] [blame] | 939 | |
Liming Wang | 41bdcb2 | 2009-12-29 16:37:07 +0800 | [diff] [blame] | 940 | printf(" %-42s [%s]\n", |
| 941 | "mem:<addr>[:access]", |
| 942 | event_type_descriptors[PERF_TYPE_BREAKPOINT]); |
Frederic Weisbecker | 1b290d6 | 2009-11-23 15:42:35 +0100 | [diff] [blame] | 943 | printf("\n"); |
| 944 | |
Jason Baron | f6bdafe | 2009-07-21 12:20:22 -0400 | [diff] [blame] | 945 | print_tracepoint_events(); |
| 946 | |
Thomas Gleixner | 86847b6 | 2009-06-06 12:24:17 +0200 | [diff] [blame] | 947 | exit(129); |
Ingo Molnar | 8ad8db3 | 2009-05-26 11:10:09 +0200 | [diff] [blame] | 948 | } |