Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 1 | |
| 2 | #include "parse-events.h" |
| 3 | #include "evsel.h" |
| 4 | #include "evlist.h" |
Borislav Petkov | cd0cfad | 2013-12-09 17:14:24 +0100 | [diff] [blame] | 5 | #include <api/fs/fs.h> |
Steven Rostedt (Red Hat) | 23773ca | 2015-02-02 14:35:07 -0500 | [diff] [blame] | 6 | #include <api/fs/tracefs.h> |
Borislav Petkov | 553873e | 2013-12-09 17:14:23 +0100 | [diff] [blame] | 7 | #include <api/fs/debugfs.h> |
Jiri Olsa | c81251e | 2012-11-10 01:46:51 +0100 | [diff] [blame] | 8 | #include "tests.h" |
Jiri Olsa | 84f5d36 | 2014-07-14 23:46:48 +0200 | [diff] [blame] | 9 | #include "debug.h" |
David Howells | d2709c7 | 2012-11-19 22:21:03 +0000 | [diff] [blame] | 10 | #include <linux/hw_breakpoint.h> |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 11 | |
Jiri Olsa | 30f31c0 | 2012-08-01 14:48:58 +0200 | [diff] [blame] | 12 | #define PERF_TP_SAMPLE_TYPE (PERF_SAMPLE_RAW | PERF_SAMPLE_TIME | \ |
| 13 | PERF_SAMPLE_CPU | PERF_SAMPLE_PERIOD) |
| 14 | |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 15 | static int test__checkevent_tracepoint(struct perf_evlist *evlist) |
| 16 | { |
Arnaldo Carvalho de Melo | 0c21f73 | 2012-08-14 16:42:15 -0300 | [diff] [blame] | 17 | struct perf_evsel *evsel = perf_evlist__first(evlist); |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 18 | |
| 19 | TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->nr_entries); |
Namhyung Kim | 8d7d847 | 2013-01-22 18:09:30 +0900 | [diff] [blame] | 20 | TEST_ASSERT_VAL("wrong number of groups", 0 == evlist->nr_groups); |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 21 | TEST_ASSERT_VAL("wrong type", PERF_TYPE_TRACEPOINT == evsel->attr.type); |
| 22 | TEST_ASSERT_VAL("wrong sample_type", |
Jiri Olsa | 30f31c0 | 2012-08-01 14:48:58 +0200 | [diff] [blame] | 23 | PERF_TP_SAMPLE_TYPE == evsel->attr.sample_type); |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 24 | TEST_ASSERT_VAL("wrong sample_period", 1 == evsel->attr.sample_period); |
| 25 | return 0; |
| 26 | } |
| 27 | |
| 28 | static int test__checkevent_tracepoint_multi(struct perf_evlist *evlist) |
| 29 | { |
| 30 | struct perf_evsel *evsel; |
| 31 | |
| 32 | TEST_ASSERT_VAL("wrong number of entries", evlist->nr_entries > 1); |
Namhyung Kim | 8d7d847 | 2013-01-22 18:09:30 +0900 | [diff] [blame] | 33 | TEST_ASSERT_VAL("wrong number of groups", 0 == evlist->nr_groups); |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 34 | |
Arnaldo Carvalho de Melo | 0050f7a | 2014-01-10 10:37:27 -0300 | [diff] [blame] | 35 | evlist__for_each(evlist, evsel) { |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 36 | TEST_ASSERT_VAL("wrong type", |
| 37 | PERF_TYPE_TRACEPOINT == evsel->attr.type); |
| 38 | TEST_ASSERT_VAL("wrong sample_type", |
Jiri Olsa | 30f31c0 | 2012-08-01 14:48:58 +0200 | [diff] [blame] | 39 | PERF_TP_SAMPLE_TYPE == evsel->attr.sample_type); |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 40 | TEST_ASSERT_VAL("wrong sample_period", |
| 41 | 1 == evsel->attr.sample_period); |
| 42 | } |
| 43 | return 0; |
| 44 | } |
| 45 | |
| 46 | static int test__checkevent_raw(struct perf_evlist *evlist) |
| 47 | { |
Arnaldo Carvalho de Melo | 0c21f73 | 2012-08-14 16:42:15 -0300 | [diff] [blame] | 48 | struct perf_evsel *evsel = perf_evlist__first(evlist); |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 49 | |
| 50 | TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->nr_entries); |
| 51 | TEST_ASSERT_VAL("wrong type", PERF_TYPE_RAW == evsel->attr.type); |
| 52 | TEST_ASSERT_VAL("wrong config", 0x1a == evsel->attr.config); |
| 53 | return 0; |
| 54 | } |
| 55 | |
| 56 | static int test__checkevent_numeric(struct perf_evlist *evlist) |
| 57 | { |
Arnaldo Carvalho de Melo | 0c21f73 | 2012-08-14 16:42:15 -0300 | [diff] [blame] | 58 | struct perf_evsel *evsel = perf_evlist__first(evlist); |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 59 | |
| 60 | TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->nr_entries); |
| 61 | TEST_ASSERT_VAL("wrong type", 1 == evsel->attr.type); |
| 62 | TEST_ASSERT_VAL("wrong config", 1 == evsel->attr.config); |
| 63 | return 0; |
| 64 | } |
| 65 | |
| 66 | static int test__checkevent_symbolic_name(struct perf_evlist *evlist) |
| 67 | { |
Arnaldo Carvalho de Melo | 0c21f73 | 2012-08-14 16:42:15 -0300 | [diff] [blame] | 68 | struct perf_evsel *evsel = perf_evlist__first(evlist); |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 69 | |
| 70 | TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->nr_entries); |
| 71 | TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->attr.type); |
| 72 | TEST_ASSERT_VAL("wrong config", |
| 73 | PERF_COUNT_HW_INSTRUCTIONS == evsel->attr.config); |
| 74 | return 0; |
| 75 | } |
| 76 | |
| 77 | static int test__checkevent_symbolic_name_config(struct perf_evlist *evlist) |
| 78 | { |
Arnaldo Carvalho de Melo | 0c21f73 | 2012-08-14 16:42:15 -0300 | [diff] [blame] | 79 | struct perf_evsel *evsel = perf_evlist__first(evlist); |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 80 | |
| 81 | TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->nr_entries); |
| 82 | TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->attr.type); |
| 83 | TEST_ASSERT_VAL("wrong config", |
| 84 | PERF_COUNT_HW_CPU_CYCLES == evsel->attr.config); |
| 85 | TEST_ASSERT_VAL("wrong period", |
| 86 | 100000 == evsel->attr.sample_period); |
| 87 | TEST_ASSERT_VAL("wrong config1", |
| 88 | 0 == evsel->attr.config1); |
| 89 | TEST_ASSERT_VAL("wrong config2", |
| 90 | 1 == evsel->attr.config2); |
| 91 | return 0; |
| 92 | } |
| 93 | |
| 94 | static int test__checkevent_symbolic_alias(struct perf_evlist *evlist) |
| 95 | { |
Arnaldo Carvalho de Melo | 0c21f73 | 2012-08-14 16:42:15 -0300 | [diff] [blame] | 96 | struct perf_evsel *evsel = perf_evlist__first(evlist); |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 97 | |
| 98 | TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->nr_entries); |
| 99 | TEST_ASSERT_VAL("wrong type", PERF_TYPE_SOFTWARE == evsel->attr.type); |
| 100 | TEST_ASSERT_VAL("wrong config", |
| 101 | PERF_COUNT_SW_PAGE_FAULTS == evsel->attr.config); |
| 102 | return 0; |
| 103 | } |
| 104 | |
| 105 | static int test__checkevent_genhw(struct perf_evlist *evlist) |
| 106 | { |
Arnaldo Carvalho de Melo | 0c21f73 | 2012-08-14 16:42:15 -0300 | [diff] [blame] | 107 | struct perf_evsel *evsel = perf_evlist__first(evlist); |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 108 | |
| 109 | TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->nr_entries); |
| 110 | TEST_ASSERT_VAL("wrong type", PERF_TYPE_HW_CACHE == evsel->attr.type); |
| 111 | TEST_ASSERT_VAL("wrong config", (1 << 16) == evsel->attr.config); |
| 112 | return 0; |
| 113 | } |
| 114 | |
| 115 | static int test__checkevent_breakpoint(struct perf_evlist *evlist) |
| 116 | { |
Arnaldo Carvalho de Melo | 0c21f73 | 2012-08-14 16:42:15 -0300 | [diff] [blame] | 117 | struct perf_evsel *evsel = perf_evlist__first(evlist); |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 118 | |
| 119 | TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->nr_entries); |
| 120 | TEST_ASSERT_VAL("wrong type", PERF_TYPE_BREAKPOINT == evsel->attr.type); |
| 121 | TEST_ASSERT_VAL("wrong config", 0 == evsel->attr.config); |
| 122 | TEST_ASSERT_VAL("wrong bp_type", (HW_BREAKPOINT_R | HW_BREAKPOINT_W) == |
| 123 | evsel->attr.bp_type); |
| 124 | TEST_ASSERT_VAL("wrong bp_len", HW_BREAKPOINT_LEN_4 == |
| 125 | evsel->attr.bp_len); |
| 126 | return 0; |
| 127 | } |
| 128 | |
| 129 | static int test__checkevent_breakpoint_x(struct perf_evlist *evlist) |
| 130 | { |
Arnaldo Carvalho de Melo | 0c21f73 | 2012-08-14 16:42:15 -0300 | [diff] [blame] | 131 | struct perf_evsel *evsel = perf_evlist__first(evlist); |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 132 | |
| 133 | TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->nr_entries); |
| 134 | TEST_ASSERT_VAL("wrong type", PERF_TYPE_BREAKPOINT == evsel->attr.type); |
| 135 | TEST_ASSERT_VAL("wrong config", 0 == evsel->attr.config); |
| 136 | TEST_ASSERT_VAL("wrong bp_type", |
| 137 | HW_BREAKPOINT_X == evsel->attr.bp_type); |
| 138 | TEST_ASSERT_VAL("wrong bp_len", sizeof(long) == evsel->attr.bp_len); |
| 139 | return 0; |
| 140 | } |
| 141 | |
| 142 | static int test__checkevent_breakpoint_r(struct perf_evlist *evlist) |
| 143 | { |
Arnaldo Carvalho de Melo | 0c21f73 | 2012-08-14 16:42:15 -0300 | [diff] [blame] | 144 | struct perf_evsel *evsel = perf_evlist__first(evlist); |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 145 | |
| 146 | TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->nr_entries); |
| 147 | TEST_ASSERT_VAL("wrong type", |
| 148 | PERF_TYPE_BREAKPOINT == evsel->attr.type); |
| 149 | TEST_ASSERT_VAL("wrong config", 0 == evsel->attr.config); |
| 150 | TEST_ASSERT_VAL("wrong bp_type", |
| 151 | HW_BREAKPOINT_R == evsel->attr.bp_type); |
| 152 | TEST_ASSERT_VAL("wrong bp_len", |
| 153 | HW_BREAKPOINT_LEN_4 == evsel->attr.bp_len); |
| 154 | return 0; |
| 155 | } |
| 156 | |
| 157 | static int test__checkevent_breakpoint_w(struct perf_evlist *evlist) |
| 158 | { |
Arnaldo Carvalho de Melo | 0c21f73 | 2012-08-14 16:42:15 -0300 | [diff] [blame] | 159 | struct perf_evsel *evsel = perf_evlist__first(evlist); |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 160 | |
| 161 | TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->nr_entries); |
| 162 | TEST_ASSERT_VAL("wrong type", |
| 163 | PERF_TYPE_BREAKPOINT == evsel->attr.type); |
| 164 | TEST_ASSERT_VAL("wrong config", 0 == evsel->attr.config); |
| 165 | TEST_ASSERT_VAL("wrong bp_type", |
| 166 | HW_BREAKPOINT_W == evsel->attr.bp_type); |
| 167 | TEST_ASSERT_VAL("wrong bp_len", |
| 168 | HW_BREAKPOINT_LEN_4 == evsel->attr.bp_len); |
| 169 | return 0; |
| 170 | } |
| 171 | |
Jiri Olsa | 7582732 | 2012-06-29 09:22:54 +0200 | [diff] [blame] | 172 | static int test__checkevent_breakpoint_rw(struct perf_evlist *evlist) |
| 173 | { |
Arnaldo Carvalho de Melo | 0c21f73 | 2012-08-14 16:42:15 -0300 | [diff] [blame] | 174 | struct perf_evsel *evsel = perf_evlist__first(evlist); |
Jiri Olsa | 7582732 | 2012-06-29 09:22:54 +0200 | [diff] [blame] | 175 | |
| 176 | TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->nr_entries); |
| 177 | TEST_ASSERT_VAL("wrong type", |
| 178 | PERF_TYPE_BREAKPOINT == evsel->attr.type); |
| 179 | TEST_ASSERT_VAL("wrong config", 0 == evsel->attr.config); |
| 180 | TEST_ASSERT_VAL("wrong bp_type", |
| 181 | (HW_BREAKPOINT_R|HW_BREAKPOINT_W) == evsel->attr.bp_type); |
| 182 | TEST_ASSERT_VAL("wrong bp_len", |
| 183 | HW_BREAKPOINT_LEN_4 == evsel->attr.bp_len); |
| 184 | return 0; |
| 185 | } |
| 186 | |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 187 | static int test__checkevent_tracepoint_modifier(struct perf_evlist *evlist) |
| 188 | { |
Arnaldo Carvalho de Melo | 0c21f73 | 2012-08-14 16:42:15 -0300 | [diff] [blame] | 189 | struct perf_evsel *evsel = perf_evlist__first(evlist); |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 190 | |
| 191 | TEST_ASSERT_VAL("wrong exclude_user", evsel->attr.exclude_user); |
| 192 | TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->attr.exclude_kernel); |
| 193 | TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv); |
| 194 | TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip); |
| 195 | |
| 196 | return test__checkevent_tracepoint(evlist); |
| 197 | } |
| 198 | |
| 199 | static int |
| 200 | test__checkevent_tracepoint_multi_modifier(struct perf_evlist *evlist) |
| 201 | { |
| 202 | struct perf_evsel *evsel; |
| 203 | |
| 204 | TEST_ASSERT_VAL("wrong number of entries", evlist->nr_entries > 1); |
| 205 | |
Arnaldo Carvalho de Melo | 0050f7a | 2014-01-10 10:37:27 -0300 | [diff] [blame] | 206 | evlist__for_each(evlist, evsel) { |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 207 | TEST_ASSERT_VAL("wrong exclude_user", |
| 208 | !evsel->attr.exclude_user); |
| 209 | TEST_ASSERT_VAL("wrong exclude_kernel", |
| 210 | evsel->attr.exclude_kernel); |
| 211 | TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv); |
| 212 | TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip); |
| 213 | } |
| 214 | |
| 215 | return test__checkevent_tracepoint_multi(evlist); |
| 216 | } |
| 217 | |
| 218 | static int test__checkevent_raw_modifier(struct perf_evlist *evlist) |
| 219 | { |
Arnaldo Carvalho de Melo | 0c21f73 | 2012-08-14 16:42:15 -0300 | [diff] [blame] | 220 | struct perf_evsel *evsel = perf_evlist__first(evlist); |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 221 | |
| 222 | TEST_ASSERT_VAL("wrong exclude_user", evsel->attr.exclude_user); |
| 223 | TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->attr.exclude_kernel); |
| 224 | TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv); |
| 225 | TEST_ASSERT_VAL("wrong precise_ip", evsel->attr.precise_ip); |
| 226 | |
| 227 | return test__checkevent_raw(evlist); |
| 228 | } |
| 229 | |
| 230 | static int test__checkevent_numeric_modifier(struct perf_evlist *evlist) |
| 231 | { |
Arnaldo Carvalho de Melo | 0c21f73 | 2012-08-14 16:42:15 -0300 | [diff] [blame] | 232 | struct perf_evsel *evsel = perf_evlist__first(evlist); |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 233 | |
| 234 | TEST_ASSERT_VAL("wrong exclude_user", evsel->attr.exclude_user); |
| 235 | TEST_ASSERT_VAL("wrong exclude_kernel", evsel->attr.exclude_kernel); |
| 236 | TEST_ASSERT_VAL("wrong exclude_hv", !evsel->attr.exclude_hv); |
| 237 | TEST_ASSERT_VAL("wrong precise_ip", evsel->attr.precise_ip); |
| 238 | |
| 239 | return test__checkevent_numeric(evlist); |
| 240 | } |
| 241 | |
| 242 | static int test__checkevent_symbolic_name_modifier(struct perf_evlist *evlist) |
| 243 | { |
Arnaldo Carvalho de Melo | 0c21f73 | 2012-08-14 16:42:15 -0300 | [diff] [blame] | 244 | struct perf_evsel *evsel = perf_evlist__first(evlist); |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 245 | |
| 246 | TEST_ASSERT_VAL("wrong exclude_user", evsel->attr.exclude_user); |
| 247 | TEST_ASSERT_VAL("wrong exclude_kernel", evsel->attr.exclude_kernel); |
| 248 | TEST_ASSERT_VAL("wrong exclude_hv", !evsel->attr.exclude_hv); |
| 249 | TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip); |
| 250 | |
| 251 | return test__checkevent_symbolic_name(evlist); |
| 252 | } |
| 253 | |
| 254 | static int test__checkevent_exclude_host_modifier(struct perf_evlist *evlist) |
| 255 | { |
Arnaldo Carvalho de Melo | 0c21f73 | 2012-08-14 16:42:15 -0300 | [diff] [blame] | 256 | struct perf_evsel *evsel = perf_evlist__first(evlist); |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 257 | |
| 258 | TEST_ASSERT_VAL("wrong exclude guest", !evsel->attr.exclude_guest); |
| 259 | TEST_ASSERT_VAL("wrong exclude host", evsel->attr.exclude_host); |
| 260 | |
| 261 | return test__checkevent_symbolic_name(evlist); |
| 262 | } |
| 263 | |
| 264 | static int test__checkevent_exclude_guest_modifier(struct perf_evlist *evlist) |
| 265 | { |
Arnaldo Carvalho de Melo | 0c21f73 | 2012-08-14 16:42:15 -0300 | [diff] [blame] | 266 | struct perf_evsel *evsel = perf_evlist__first(evlist); |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 267 | |
| 268 | TEST_ASSERT_VAL("wrong exclude guest", evsel->attr.exclude_guest); |
| 269 | TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host); |
| 270 | |
| 271 | return test__checkevent_symbolic_name(evlist); |
| 272 | } |
| 273 | |
| 274 | static int test__checkevent_symbolic_alias_modifier(struct perf_evlist *evlist) |
| 275 | { |
Arnaldo Carvalho de Melo | 0c21f73 | 2012-08-14 16:42:15 -0300 | [diff] [blame] | 276 | struct perf_evsel *evsel = perf_evlist__first(evlist); |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 277 | |
| 278 | TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user); |
| 279 | TEST_ASSERT_VAL("wrong exclude_kernel", evsel->attr.exclude_kernel); |
| 280 | TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv); |
| 281 | TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip); |
| 282 | |
| 283 | return test__checkevent_symbolic_alias(evlist); |
| 284 | } |
| 285 | |
| 286 | static int test__checkevent_genhw_modifier(struct perf_evlist *evlist) |
| 287 | { |
Arnaldo Carvalho de Melo | 0c21f73 | 2012-08-14 16:42:15 -0300 | [diff] [blame] | 288 | struct perf_evsel *evsel = perf_evlist__first(evlist); |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 289 | |
| 290 | TEST_ASSERT_VAL("wrong exclude_user", evsel->attr.exclude_user); |
| 291 | TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->attr.exclude_kernel); |
| 292 | TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv); |
| 293 | TEST_ASSERT_VAL("wrong precise_ip", evsel->attr.precise_ip); |
| 294 | |
| 295 | return test__checkevent_genhw(evlist); |
| 296 | } |
| 297 | |
Jiri Olsa | a1e12da | 2015-04-07 23:25:14 +0200 | [diff] [blame] | 298 | static int test__checkevent_exclude_idle_modifier(struct perf_evlist *evlist) |
| 299 | { |
| 300 | struct perf_evsel *evsel = perf_evlist__first(evlist); |
| 301 | |
| 302 | TEST_ASSERT_VAL("wrong exclude idle", evsel->attr.exclude_idle); |
| 303 | TEST_ASSERT_VAL("wrong exclude guest", !evsel->attr.exclude_guest); |
| 304 | TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host); |
| 305 | TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user); |
| 306 | TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->attr.exclude_kernel); |
| 307 | TEST_ASSERT_VAL("wrong exclude_hv", !evsel->attr.exclude_hv); |
| 308 | TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip); |
| 309 | |
| 310 | return test__checkevent_symbolic_name(evlist); |
| 311 | } |
| 312 | |
| 313 | static int test__checkevent_exclude_idle_modifier_1(struct perf_evlist *evlist) |
| 314 | { |
| 315 | struct perf_evsel *evsel = perf_evlist__first(evlist); |
| 316 | |
| 317 | TEST_ASSERT_VAL("wrong exclude idle", evsel->attr.exclude_idle); |
| 318 | TEST_ASSERT_VAL("wrong exclude guest", !evsel->attr.exclude_guest); |
| 319 | TEST_ASSERT_VAL("wrong exclude host", evsel->attr.exclude_host); |
| 320 | TEST_ASSERT_VAL("wrong exclude_user", evsel->attr.exclude_user); |
| 321 | TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->attr.exclude_kernel); |
| 322 | TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv); |
| 323 | TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip); |
| 324 | |
| 325 | return test__checkevent_symbolic_name(evlist); |
| 326 | } |
| 327 | |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 328 | static int test__checkevent_breakpoint_modifier(struct perf_evlist *evlist) |
| 329 | { |
Arnaldo Carvalho de Melo | 0c21f73 | 2012-08-14 16:42:15 -0300 | [diff] [blame] | 330 | struct perf_evsel *evsel = perf_evlist__first(evlist); |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 331 | |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 332 | |
| 333 | TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user); |
| 334 | TEST_ASSERT_VAL("wrong exclude_kernel", evsel->attr.exclude_kernel); |
| 335 | TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv); |
| 336 | TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip); |
Jiri Olsa | 287e74a | 2012-06-28 23:18:49 +0200 | [diff] [blame] | 337 | TEST_ASSERT_VAL("wrong name", |
Robert Richter | ac2ba9f | 2012-08-16 21:10:21 +0200 | [diff] [blame] | 338 | !strcmp(perf_evsel__name(evsel), "mem:0:u")); |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 339 | |
| 340 | return test__checkevent_breakpoint(evlist); |
| 341 | } |
| 342 | |
| 343 | static int test__checkevent_breakpoint_x_modifier(struct perf_evlist *evlist) |
| 344 | { |
Arnaldo Carvalho de Melo | 0c21f73 | 2012-08-14 16:42:15 -0300 | [diff] [blame] | 345 | struct perf_evsel *evsel = perf_evlist__first(evlist); |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 346 | |
| 347 | TEST_ASSERT_VAL("wrong exclude_user", evsel->attr.exclude_user); |
| 348 | TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->attr.exclude_kernel); |
| 349 | TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv); |
| 350 | TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip); |
Jiri Olsa | 287e74a | 2012-06-28 23:18:49 +0200 | [diff] [blame] | 351 | TEST_ASSERT_VAL("wrong name", |
Robert Richter | ac2ba9f | 2012-08-16 21:10:21 +0200 | [diff] [blame] | 352 | !strcmp(perf_evsel__name(evsel), "mem:0:x:k")); |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 353 | |
| 354 | return test__checkevent_breakpoint_x(evlist); |
| 355 | } |
| 356 | |
| 357 | static int test__checkevent_breakpoint_r_modifier(struct perf_evlist *evlist) |
| 358 | { |
Arnaldo Carvalho de Melo | 0c21f73 | 2012-08-14 16:42:15 -0300 | [diff] [blame] | 359 | struct perf_evsel *evsel = perf_evlist__first(evlist); |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 360 | |
| 361 | TEST_ASSERT_VAL("wrong exclude_user", evsel->attr.exclude_user); |
| 362 | TEST_ASSERT_VAL("wrong exclude_kernel", evsel->attr.exclude_kernel); |
| 363 | TEST_ASSERT_VAL("wrong exclude_hv", !evsel->attr.exclude_hv); |
| 364 | TEST_ASSERT_VAL("wrong precise_ip", evsel->attr.precise_ip); |
Jiri Olsa | 287e74a | 2012-06-28 23:18:49 +0200 | [diff] [blame] | 365 | TEST_ASSERT_VAL("wrong name", |
Robert Richter | ac2ba9f | 2012-08-16 21:10:21 +0200 | [diff] [blame] | 366 | !strcmp(perf_evsel__name(evsel), "mem:0:r:hp")); |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 367 | |
| 368 | return test__checkevent_breakpoint_r(evlist); |
| 369 | } |
| 370 | |
| 371 | static int test__checkevent_breakpoint_w_modifier(struct perf_evlist *evlist) |
| 372 | { |
Arnaldo Carvalho de Melo | 0c21f73 | 2012-08-14 16:42:15 -0300 | [diff] [blame] | 373 | struct perf_evsel *evsel = perf_evlist__first(evlist); |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 374 | |
| 375 | TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user); |
| 376 | TEST_ASSERT_VAL("wrong exclude_kernel", evsel->attr.exclude_kernel); |
| 377 | TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv); |
| 378 | TEST_ASSERT_VAL("wrong precise_ip", evsel->attr.precise_ip); |
Jiri Olsa | 287e74a | 2012-06-28 23:18:49 +0200 | [diff] [blame] | 379 | TEST_ASSERT_VAL("wrong name", |
Robert Richter | ac2ba9f | 2012-08-16 21:10:21 +0200 | [diff] [blame] | 380 | !strcmp(perf_evsel__name(evsel), "mem:0:w:up")); |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 381 | |
| 382 | return test__checkevent_breakpoint_w(evlist); |
| 383 | } |
| 384 | |
Jiri Olsa | 7582732 | 2012-06-29 09:22:54 +0200 | [diff] [blame] | 385 | static int test__checkevent_breakpoint_rw_modifier(struct perf_evlist *evlist) |
| 386 | { |
Arnaldo Carvalho de Melo | 0c21f73 | 2012-08-14 16:42:15 -0300 | [diff] [blame] | 387 | struct perf_evsel *evsel = perf_evlist__first(evlist); |
Jiri Olsa | 7582732 | 2012-06-29 09:22:54 +0200 | [diff] [blame] | 388 | |
| 389 | TEST_ASSERT_VAL("wrong exclude_user", evsel->attr.exclude_user); |
| 390 | TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->attr.exclude_kernel); |
| 391 | TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv); |
| 392 | TEST_ASSERT_VAL("wrong precise_ip", evsel->attr.precise_ip); |
Jiri Olsa | 287e74a | 2012-06-28 23:18:49 +0200 | [diff] [blame] | 393 | TEST_ASSERT_VAL("wrong name", |
Robert Richter | ac2ba9f | 2012-08-16 21:10:21 +0200 | [diff] [blame] | 394 | !strcmp(perf_evsel__name(evsel), "mem:0:rw:kp")); |
Jiri Olsa | 7582732 | 2012-06-29 09:22:54 +0200 | [diff] [blame] | 395 | |
| 396 | return test__checkevent_breakpoint_rw(evlist); |
| 397 | } |
| 398 | |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 399 | static int test__checkevent_pmu(struct perf_evlist *evlist) |
| 400 | { |
| 401 | |
Arnaldo Carvalho de Melo | 0c21f73 | 2012-08-14 16:42:15 -0300 | [diff] [blame] | 402 | struct perf_evsel *evsel = perf_evlist__first(evlist); |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 403 | |
| 404 | TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->nr_entries); |
| 405 | TEST_ASSERT_VAL("wrong type", PERF_TYPE_RAW == evsel->attr.type); |
| 406 | TEST_ASSERT_VAL("wrong config", 10 == evsel->attr.config); |
| 407 | TEST_ASSERT_VAL("wrong config1", 1 == evsel->attr.config1); |
| 408 | TEST_ASSERT_VAL("wrong config2", 3 == evsel->attr.config2); |
| 409 | TEST_ASSERT_VAL("wrong period", 1000 == evsel->attr.sample_period); |
| 410 | |
| 411 | return 0; |
| 412 | } |
| 413 | |
| 414 | static int test__checkevent_list(struct perf_evlist *evlist) |
| 415 | { |
Arnaldo Carvalho de Melo | 0c21f73 | 2012-08-14 16:42:15 -0300 | [diff] [blame] | 416 | struct perf_evsel *evsel = perf_evlist__first(evlist); |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 417 | |
| 418 | TEST_ASSERT_VAL("wrong number of entries", 3 == evlist->nr_entries); |
| 419 | |
| 420 | /* r1 */ |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 421 | TEST_ASSERT_VAL("wrong type", PERF_TYPE_RAW == evsel->attr.type); |
| 422 | TEST_ASSERT_VAL("wrong config", 1 == evsel->attr.config); |
| 423 | TEST_ASSERT_VAL("wrong config1", 0 == evsel->attr.config1); |
| 424 | TEST_ASSERT_VAL("wrong config2", 0 == evsel->attr.config2); |
| 425 | TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user); |
| 426 | TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->attr.exclude_kernel); |
| 427 | TEST_ASSERT_VAL("wrong exclude_hv", !evsel->attr.exclude_hv); |
| 428 | TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip); |
| 429 | |
Riku Voipio | 43f322b | 2015-04-16 16:52:53 +0300 | [diff] [blame^] | 430 | /* syscalls:sys_enter_openat:k */ |
Arnaldo Carvalho de Melo | 0c21f73 | 2012-08-14 16:42:15 -0300 | [diff] [blame] | 431 | evsel = perf_evsel__next(evsel); |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 432 | TEST_ASSERT_VAL("wrong type", PERF_TYPE_TRACEPOINT == evsel->attr.type); |
| 433 | TEST_ASSERT_VAL("wrong sample_type", |
Jiri Olsa | 30f31c0 | 2012-08-01 14:48:58 +0200 | [diff] [blame] | 434 | PERF_TP_SAMPLE_TYPE == evsel->attr.sample_type); |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 435 | TEST_ASSERT_VAL("wrong sample_period", 1 == evsel->attr.sample_period); |
| 436 | TEST_ASSERT_VAL("wrong exclude_user", evsel->attr.exclude_user); |
| 437 | TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->attr.exclude_kernel); |
| 438 | TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv); |
| 439 | TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip); |
| 440 | |
| 441 | /* 1:1:hp */ |
Arnaldo Carvalho de Melo | 0c21f73 | 2012-08-14 16:42:15 -0300 | [diff] [blame] | 442 | evsel = perf_evsel__next(evsel); |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 443 | TEST_ASSERT_VAL("wrong type", 1 == evsel->attr.type); |
| 444 | TEST_ASSERT_VAL("wrong config", 1 == evsel->attr.config); |
| 445 | TEST_ASSERT_VAL("wrong exclude_user", evsel->attr.exclude_user); |
| 446 | TEST_ASSERT_VAL("wrong exclude_kernel", evsel->attr.exclude_kernel); |
| 447 | TEST_ASSERT_VAL("wrong exclude_hv", !evsel->attr.exclude_hv); |
| 448 | TEST_ASSERT_VAL("wrong precise_ip", evsel->attr.precise_ip); |
| 449 | |
| 450 | return 0; |
| 451 | } |
| 452 | |
Jiri Olsa | 6b5fc39 | 2012-05-21 09:12:53 +0200 | [diff] [blame] | 453 | static int test__checkevent_pmu_name(struct perf_evlist *evlist) |
| 454 | { |
Arnaldo Carvalho de Melo | 0c21f73 | 2012-08-14 16:42:15 -0300 | [diff] [blame] | 455 | struct perf_evsel *evsel = perf_evlist__first(evlist); |
Jiri Olsa | 6b5fc39 | 2012-05-21 09:12:53 +0200 | [diff] [blame] | 456 | |
Jiri Olsa | 7a25b2d | 2012-06-21 12:25:16 +0200 | [diff] [blame] | 457 | /* cpu/config=1,name=krava/u */ |
Jiri Olsa | 6b5fc39 | 2012-05-21 09:12:53 +0200 | [diff] [blame] | 458 | TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->nr_entries); |
| 459 | TEST_ASSERT_VAL("wrong type", PERF_TYPE_RAW == evsel->attr.type); |
| 460 | TEST_ASSERT_VAL("wrong config", 1 == evsel->attr.config); |
Arnaldo Carvalho de Melo | 22c8b84 | 2012-06-12 13:55:13 -0300 | [diff] [blame] | 461 | TEST_ASSERT_VAL("wrong name", !strcmp(perf_evsel__name(evsel), "krava")); |
Jiri Olsa | 6b5fc39 | 2012-05-21 09:12:53 +0200 | [diff] [blame] | 462 | |
Jiri Olsa | 7a25b2d | 2012-06-21 12:25:16 +0200 | [diff] [blame] | 463 | /* cpu/config=2/u" */ |
Arnaldo Carvalho de Melo | 0c21f73 | 2012-08-14 16:42:15 -0300 | [diff] [blame] | 464 | evsel = perf_evsel__next(evsel); |
Jiri Olsa | 6b5fc39 | 2012-05-21 09:12:53 +0200 | [diff] [blame] | 465 | TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->nr_entries); |
| 466 | TEST_ASSERT_VAL("wrong type", PERF_TYPE_RAW == evsel->attr.type); |
| 467 | TEST_ASSERT_VAL("wrong config", 2 == evsel->attr.config); |
Jiri Olsa | 7a25b2d | 2012-06-21 12:25:16 +0200 | [diff] [blame] | 468 | TEST_ASSERT_VAL("wrong name", |
Robert Richter | ac2ba9f | 2012-08-16 21:10:21 +0200 | [diff] [blame] | 469 | !strcmp(perf_evsel__name(evsel), "cpu/config=2/u")); |
Jiri Olsa | 6b5fc39 | 2012-05-21 09:12:53 +0200 | [diff] [blame] | 470 | |
| 471 | return 0; |
| 472 | } |
| 473 | |
Jiri Olsa | 3f3a206 | 2012-10-10 14:53:18 +0200 | [diff] [blame] | 474 | static int test__checkevent_pmu_events(struct perf_evlist *evlist) |
| 475 | { |
Arnaldo Carvalho de Melo | 9a354cd | 2013-11-13 15:54:30 -0300 | [diff] [blame] | 476 | struct perf_evsel *evsel = perf_evlist__first(evlist); |
Jiri Olsa | 3f3a206 | 2012-10-10 14:53:18 +0200 | [diff] [blame] | 477 | |
Jiri Olsa | 3f3a206 | 2012-10-10 14:53:18 +0200 | [diff] [blame] | 478 | TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->nr_entries); |
| 479 | TEST_ASSERT_VAL("wrong type", PERF_TYPE_RAW == evsel->attr.type); |
| 480 | TEST_ASSERT_VAL("wrong exclude_user", |
| 481 | !evsel->attr.exclude_user); |
| 482 | TEST_ASSERT_VAL("wrong exclude_kernel", |
| 483 | evsel->attr.exclude_kernel); |
| 484 | TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv); |
| 485 | TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip); |
Michael Ellerman | c9ee780 | 2013-08-06 23:28:06 +1000 | [diff] [blame] | 486 | TEST_ASSERT_VAL("wrong pinned", !evsel->attr.pinned); |
Jiri Olsa | 3f3a206 | 2012-10-10 14:53:18 +0200 | [diff] [blame] | 487 | |
| 488 | return 0; |
| 489 | } |
| 490 | |
Kan Liang | ffe5978 | 2014-10-07 11:08:52 -0400 | [diff] [blame] | 491 | |
| 492 | static int test__checkevent_pmu_events_mix(struct perf_evlist *evlist) |
| 493 | { |
| 494 | struct perf_evsel *evsel = perf_evlist__first(evlist); |
| 495 | |
| 496 | /* pmu-event:u */ |
| 497 | TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->nr_entries); |
| 498 | TEST_ASSERT_VAL("wrong exclude_user", |
| 499 | !evsel->attr.exclude_user); |
| 500 | TEST_ASSERT_VAL("wrong exclude_kernel", |
| 501 | evsel->attr.exclude_kernel); |
| 502 | TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv); |
| 503 | TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip); |
| 504 | TEST_ASSERT_VAL("wrong pinned", !evsel->attr.pinned); |
| 505 | |
| 506 | /* cpu/pmu-event/u*/ |
| 507 | evsel = perf_evsel__next(evsel); |
| 508 | TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->nr_entries); |
| 509 | TEST_ASSERT_VAL("wrong type", PERF_TYPE_RAW == evsel->attr.type); |
| 510 | TEST_ASSERT_VAL("wrong exclude_user", |
| 511 | !evsel->attr.exclude_user); |
| 512 | TEST_ASSERT_VAL("wrong exclude_kernel", |
| 513 | evsel->attr.exclude_kernel); |
| 514 | TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv); |
| 515 | TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip); |
| 516 | TEST_ASSERT_VAL("wrong pinned", !evsel->attr.pinned); |
| 517 | |
| 518 | return 0; |
| 519 | } |
| 520 | |
Jiri Olsa | 4429392 | 2012-06-15 14:31:42 +0800 | [diff] [blame] | 521 | static int test__checkterms_simple(struct list_head *terms) |
| 522 | { |
Arnaldo Carvalho de Melo | 6cee6cd | 2013-01-18 16:29:49 -0300 | [diff] [blame] | 523 | struct parse_events_term *term; |
Jiri Olsa | 4429392 | 2012-06-15 14:31:42 +0800 | [diff] [blame] | 524 | |
| 525 | /* config=10 */ |
Arnaldo Carvalho de Melo | 6cee6cd | 2013-01-18 16:29:49 -0300 | [diff] [blame] | 526 | term = list_entry(terms->next, struct parse_events_term, list); |
Jiri Olsa | 4429392 | 2012-06-15 14:31:42 +0800 | [diff] [blame] | 527 | TEST_ASSERT_VAL("wrong type term", |
| 528 | term->type_term == PARSE_EVENTS__TERM_TYPE_CONFIG); |
| 529 | TEST_ASSERT_VAL("wrong type val", |
| 530 | term->type_val == PARSE_EVENTS__TERM_TYPE_NUM); |
| 531 | TEST_ASSERT_VAL("wrong val", term->val.num == 10); |
| 532 | TEST_ASSERT_VAL("wrong config", !term->config); |
| 533 | |
| 534 | /* config1 */ |
Arnaldo Carvalho de Melo | 6cee6cd | 2013-01-18 16:29:49 -0300 | [diff] [blame] | 535 | term = list_entry(term->list.next, struct parse_events_term, list); |
Jiri Olsa | 4429392 | 2012-06-15 14:31:42 +0800 | [diff] [blame] | 536 | TEST_ASSERT_VAL("wrong type term", |
| 537 | term->type_term == PARSE_EVENTS__TERM_TYPE_CONFIG1); |
| 538 | TEST_ASSERT_VAL("wrong type val", |
| 539 | term->type_val == PARSE_EVENTS__TERM_TYPE_NUM); |
| 540 | TEST_ASSERT_VAL("wrong val", term->val.num == 1); |
| 541 | TEST_ASSERT_VAL("wrong config", !term->config); |
| 542 | |
| 543 | /* config2=3 */ |
Arnaldo Carvalho de Melo | 6cee6cd | 2013-01-18 16:29:49 -0300 | [diff] [blame] | 544 | term = list_entry(term->list.next, struct parse_events_term, list); |
Jiri Olsa | 4429392 | 2012-06-15 14:31:42 +0800 | [diff] [blame] | 545 | TEST_ASSERT_VAL("wrong type term", |
| 546 | term->type_term == PARSE_EVENTS__TERM_TYPE_CONFIG2); |
| 547 | TEST_ASSERT_VAL("wrong type val", |
| 548 | term->type_val == PARSE_EVENTS__TERM_TYPE_NUM); |
| 549 | TEST_ASSERT_VAL("wrong val", term->val.num == 3); |
| 550 | TEST_ASSERT_VAL("wrong config", !term->config); |
| 551 | |
| 552 | /* umask=1*/ |
Arnaldo Carvalho de Melo | 6cee6cd | 2013-01-18 16:29:49 -0300 | [diff] [blame] | 553 | term = list_entry(term->list.next, struct parse_events_term, list); |
Jiri Olsa | 4429392 | 2012-06-15 14:31:42 +0800 | [diff] [blame] | 554 | TEST_ASSERT_VAL("wrong type term", |
| 555 | term->type_term == PARSE_EVENTS__TERM_TYPE_USER); |
| 556 | TEST_ASSERT_VAL("wrong type val", |
| 557 | term->type_val == PARSE_EVENTS__TERM_TYPE_NUM); |
| 558 | TEST_ASSERT_VAL("wrong val", term->val.num == 1); |
| 559 | TEST_ASSERT_VAL("wrong config", !strcmp(term->config, "umask")); |
| 560 | |
| 561 | return 0; |
| 562 | } |
| 563 | |
Jiri Olsa | 905f5ee | 2012-08-08 12:23:52 +0200 | [diff] [blame] | 564 | static int test__group1(struct perf_evlist *evlist) |
| 565 | { |
| 566 | struct perf_evsel *evsel, *leader; |
| 567 | |
| 568 | TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->nr_entries); |
Namhyung Kim | 8d7d847 | 2013-01-22 18:09:30 +0900 | [diff] [blame] | 569 | TEST_ASSERT_VAL("wrong number of groups", 1 == evlist->nr_groups); |
Jiri Olsa | 905f5ee | 2012-08-08 12:23:52 +0200 | [diff] [blame] | 570 | |
| 571 | /* instructions:k */ |
Arnaldo Carvalho de Melo | 0c21f73 | 2012-08-14 16:42:15 -0300 | [diff] [blame] | 572 | evsel = leader = perf_evlist__first(evlist); |
Jiri Olsa | 905f5ee | 2012-08-08 12:23:52 +0200 | [diff] [blame] | 573 | TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->attr.type); |
| 574 | TEST_ASSERT_VAL("wrong config", |
| 575 | PERF_COUNT_HW_INSTRUCTIONS == evsel->attr.config); |
| 576 | TEST_ASSERT_VAL("wrong exclude_user", evsel->attr.exclude_user); |
| 577 | TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->attr.exclude_kernel); |
| 578 | TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv); |
| 579 | TEST_ASSERT_VAL("wrong exclude guest", !evsel->attr.exclude_guest); |
| 580 | TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host); |
| 581 | TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip); |
Namhyung Kim | 823254e | 2012-11-29 15:38:30 +0900 | [diff] [blame] | 582 | TEST_ASSERT_VAL("wrong leader", perf_evsel__is_group_leader(evsel)); |
Namhyung Kim | 8d7d847 | 2013-01-22 18:09:30 +0900 | [diff] [blame] | 583 | TEST_ASSERT_VAL("wrong nr_members", evsel->nr_members == 2); |
| 584 | TEST_ASSERT_VAL("wrong group_idx", perf_evsel__group_idx(evsel) == 0); |
Jiri Olsa | a9f93f9 | 2013-02-01 20:37:11 +0100 | [diff] [blame] | 585 | TEST_ASSERT_VAL("wrong sample_read", !evsel->sample_read); |
Jiri Olsa | 905f5ee | 2012-08-08 12:23:52 +0200 | [diff] [blame] | 586 | |
| 587 | /* cycles:upp */ |
Arnaldo Carvalho de Melo | 0c21f73 | 2012-08-14 16:42:15 -0300 | [diff] [blame] | 588 | evsel = perf_evsel__next(evsel); |
Jiri Olsa | 905f5ee | 2012-08-08 12:23:52 +0200 | [diff] [blame] | 589 | TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->attr.type); |
| 590 | TEST_ASSERT_VAL("wrong config", |
| 591 | PERF_COUNT_HW_CPU_CYCLES == evsel->attr.config); |
| 592 | TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user); |
| 593 | TEST_ASSERT_VAL("wrong exclude_kernel", evsel->attr.exclude_kernel); |
| 594 | TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv); |
Jiri Olsa | 42be739 | 2012-10-20 18:29:34 +0200 | [diff] [blame] | 595 | /* use of precise requires exclude_guest */ |
| 596 | TEST_ASSERT_VAL("wrong exclude guest", evsel->attr.exclude_guest); |
Jiri Olsa | 905f5ee | 2012-08-08 12:23:52 +0200 | [diff] [blame] | 597 | TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host); |
| 598 | TEST_ASSERT_VAL("wrong precise_ip", evsel->attr.precise_ip == 2); |
| 599 | TEST_ASSERT_VAL("wrong leader", evsel->leader == leader); |
Namhyung Kim | 8d7d847 | 2013-01-22 18:09:30 +0900 | [diff] [blame] | 600 | TEST_ASSERT_VAL("wrong group_idx", perf_evsel__group_idx(evsel) == 1); |
Jiri Olsa | a9f93f9 | 2013-02-01 20:37:11 +0100 | [diff] [blame] | 601 | TEST_ASSERT_VAL("wrong sample_read", !evsel->sample_read); |
Jiri Olsa | 905f5ee | 2012-08-08 12:23:52 +0200 | [diff] [blame] | 602 | |
| 603 | return 0; |
| 604 | } |
| 605 | |
| 606 | static int test__group2(struct perf_evlist *evlist) |
| 607 | { |
| 608 | struct perf_evsel *evsel, *leader; |
| 609 | |
| 610 | TEST_ASSERT_VAL("wrong number of entries", 3 == evlist->nr_entries); |
Namhyung Kim | 8d7d847 | 2013-01-22 18:09:30 +0900 | [diff] [blame] | 611 | TEST_ASSERT_VAL("wrong number of groups", 1 == evlist->nr_groups); |
Jiri Olsa | 905f5ee | 2012-08-08 12:23:52 +0200 | [diff] [blame] | 612 | |
| 613 | /* faults + :ku modifier */ |
Arnaldo Carvalho de Melo | 0c21f73 | 2012-08-14 16:42:15 -0300 | [diff] [blame] | 614 | evsel = leader = perf_evlist__first(evlist); |
Jiri Olsa | 905f5ee | 2012-08-08 12:23:52 +0200 | [diff] [blame] | 615 | TEST_ASSERT_VAL("wrong type", PERF_TYPE_SOFTWARE == evsel->attr.type); |
| 616 | TEST_ASSERT_VAL("wrong config", |
| 617 | PERF_COUNT_SW_PAGE_FAULTS == evsel->attr.config); |
| 618 | TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user); |
| 619 | TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->attr.exclude_kernel); |
| 620 | TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv); |
| 621 | TEST_ASSERT_VAL("wrong exclude guest", !evsel->attr.exclude_guest); |
| 622 | TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host); |
| 623 | TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip); |
Namhyung Kim | 823254e | 2012-11-29 15:38:30 +0900 | [diff] [blame] | 624 | TEST_ASSERT_VAL("wrong leader", perf_evsel__is_group_leader(evsel)); |
Namhyung Kim | 8d7d847 | 2013-01-22 18:09:30 +0900 | [diff] [blame] | 625 | TEST_ASSERT_VAL("wrong nr_members", evsel->nr_members == 2); |
| 626 | TEST_ASSERT_VAL("wrong group_idx", perf_evsel__group_idx(evsel) == 0); |
Jiri Olsa | a9f93f9 | 2013-02-01 20:37:11 +0100 | [diff] [blame] | 627 | TEST_ASSERT_VAL("wrong sample_read", !evsel->sample_read); |
Jiri Olsa | 905f5ee | 2012-08-08 12:23:52 +0200 | [diff] [blame] | 628 | |
| 629 | /* cache-references + :u modifier */ |
Arnaldo Carvalho de Melo | 0c21f73 | 2012-08-14 16:42:15 -0300 | [diff] [blame] | 630 | evsel = perf_evsel__next(evsel); |
Jiri Olsa | 905f5ee | 2012-08-08 12:23:52 +0200 | [diff] [blame] | 631 | TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->attr.type); |
| 632 | TEST_ASSERT_VAL("wrong config", |
| 633 | PERF_COUNT_HW_CACHE_REFERENCES == evsel->attr.config); |
| 634 | TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user); |
| 635 | TEST_ASSERT_VAL("wrong exclude_kernel", evsel->attr.exclude_kernel); |
| 636 | TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv); |
Jiri Olsa | 5a30a99 | 2013-02-04 10:56:43 +0100 | [diff] [blame] | 637 | TEST_ASSERT_VAL("wrong exclude guest", evsel->attr.exclude_guest); |
Jiri Olsa | 905f5ee | 2012-08-08 12:23:52 +0200 | [diff] [blame] | 638 | TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host); |
| 639 | TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip); |
| 640 | TEST_ASSERT_VAL("wrong leader", evsel->leader == leader); |
Namhyung Kim | 8d7d847 | 2013-01-22 18:09:30 +0900 | [diff] [blame] | 641 | TEST_ASSERT_VAL("wrong group_idx", perf_evsel__group_idx(evsel) == 1); |
Jiri Olsa | a9f93f9 | 2013-02-01 20:37:11 +0100 | [diff] [blame] | 642 | TEST_ASSERT_VAL("wrong sample_read", !evsel->sample_read); |
Jiri Olsa | 905f5ee | 2012-08-08 12:23:52 +0200 | [diff] [blame] | 643 | |
| 644 | /* cycles:k */ |
Arnaldo Carvalho de Melo | 0c21f73 | 2012-08-14 16:42:15 -0300 | [diff] [blame] | 645 | evsel = perf_evsel__next(evsel); |
Jiri Olsa | 905f5ee | 2012-08-08 12:23:52 +0200 | [diff] [blame] | 646 | TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->attr.type); |
| 647 | TEST_ASSERT_VAL("wrong config", |
| 648 | PERF_COUNT_HW_CPU_CYCLES == evsel->attr.config); |
| 649 | TEST_ASSERT_VAL("wrong exclude_user", evsel->attr.exclude_user); |
| 650 | TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->attr.exclude_kernel); |
| 651 | TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv); |
| 652 | TEST_ASSERT_VAL("wrong exclude guest", !evsel->attr.exclude_guest); |
| 653 | TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host); |
| 654 | TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip); |
Namhyung Kim | 823254e | 2012-11-29 15:38:30 +0900 | [diff] [blame] | 655 | TEST_ASSERT_VAL("wrong leader", perf_evsel__is_group_leader(evsel)); |
Jiri Olsa | a9f93f9 | 2013-02-01 20:37:11 +0100 | [diff] [blame] | 656 | TEST_ASSERT_VAL("wrong sample_read", !evsel->sample_read); |
Jiri Olsa | 905f5ee | 2012-08-08 12:23:52 +0200 | [diff] [blame] | 657 | |
| 658 | return 0; |
| 659 | } |
| 660 | |
Irina Tirdea | 1d037ca | 2012-09-11 01:15:03 +0300 | [diff] [blame] | 661 | static int test__group3(struct perf_evlist *evlist __maybe_unused) |
Jiri Olsa | 905f5ee | 2012-08-08 12:23:52 +0200 | [diff] [blame] | 662 | { |
| 663 | struct perf_evsel *evsel, *leader; |
| 664 | |
| 665 | TEST_ASSERT_VAL("wrong number of entries", 5 == evlist->nr_entries); |
Namhyung Kim | 8d7d847 | 2013-01-22 18:09:30 +0900 | [diff] [blame] | 666 | TEST_ASSERT_VAL("wrong number of groups", 2 == evlist->nr_groups); |
Jiri Olsa | 905f5ee | 2012-08-08 12:23:52 +0200 | [diff] [blame] | 667 | |
Riku Voipio | 43f322b | 2015-04-16 16:52:53 +0300 | [diff] [blame^] | 668 | /* group1 syscalls:sys_enter_openat:H */ |
Arnaldo Carvalho de Melo | 0c21f73 | 2012-08-14 16:42:15 -0300 | [diff] [blame] | 669 | evsel = leader = perf_evlist__first(evlist); |
Jiri Olsa | 905f5ee | 2012-08-08 12:23:52 +0200 | [diff] [blame] | 670 | TEST_ASSERT_VAL("wrong type", PERF_TYPE_TRACEPOINT == evsel->attr.type); |
| 671 | TEST_ASSERT_VAL("wrong sample_type", |
| 672 | PERF_TP_SAMPLE_TYPE == evsel->attr.sample_type); |
| 673 | TEST_ASSERT_VAL("wrong sample_period", 1 == evsel->attr.sample_period); |
| 674 | TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user); |
| 675 | TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->attr.exclude_kernel); |
| 676 | TEST_ASSERT_VAL("wrong exclude_hv", !evsel->attr.exclude_hv); |
| 677 | TEST_ASSERT_VAL("wrong exclude guest", evsel->attr.exclude_guest); |
| 678 | TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host); |
| 679 | TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip); |
Namhyung Kim | 823254e | 2012-11-29 15:38:30 +0900 | [diff] [blame] | 680 | TEST_ASSERT_VAL("wrong leader", perf_evsel__is_group_leader(evsel)); |
Jiri Olsa | 905f5ee | 2012-08-08 12:23:52 +0200 | [diff] [blame] | 681 | TEST_ASSERT_VAL("wrong group name", |
| 682 | !strcmp(leader->group_name, "group1")); |
Namhyung Kim | 8d7d847 | 2013-01-22 18:09:30 +0900 | [diff] [blame] | 683 | TEST_ASSERT_VAL("wrong nr_members", evsel->nr_members == 2); |
| 684 | TEST_ASSERT_VAL("wrong group_idx", perf_evsel__group_idx(evsel) == 0); |
Jiri Olsa | a9f93f9 | 2013-02-01 20:37:11 +0100 | [diff] [blame] | 685 | TEST_ASSERT_VAL("wrong sample_read", !evsel->sample_read); |
Jiri Olsa | 905f5ee | 2012-08-08 12:23:52 +0200 | [diff] [blame] | 686 | |
| 687 | /* group1 cycles:kppp */ |
Arnaldo Carvalho de Melo | 0c21f73 | 2012-08-14 16:42:15 -0300 | [diff] [blame] | 688 | evsel = perf_evsel__next(evsel); |
Jiri Olsa | 905f5ee | 2012-08-08 12:23:52 +0200 | [diff] [blame] | 689 | TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->attr.type); |
| 690 | TEST_ASSERT_VAL("wrong config", |
| 691 | PERF_COUNT_HW_CPU_CYCLES == evsel->attr.config); |
| 692 | TEST_ASSERT_VAL("wrong exclude_user", evsel->attr.exclude_user); |
| 693 | TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->attr.exclude_kernel); |
| 694 | TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv); |
Jiri Olsa | 42be739 | 2012-10-20 18:29:34 +0200 | [diff] [blame] | 695 | /* use of precise requires exclude_guest */ |
| 696 | TEST_ASSERT_VAL("wrong exclude guest", evsel->attr.exclude_guest); |
Jiri Olsa | 905f5ee | 2012-08-08 12:23:52 +0200 | [diff] [blame] | 697 | TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host); |
| 698 | TEST_ASSERT_VAL("wrong precise_ip", evsel->attr.precise_ip == 3); |
| 699 | TEST_ASSERT_VAL("wrong leader", evsel->leader == leader); |
| 700 | TEST_ASSERT_VAL("wrong group name", !evsel->group_name); |
Namhyung Kim | 8d7d847 | 2013-01-22 18:09:30 +0900 | [diff] [blame] | 701 | TEST_ASSERT_VAL("wrong group_idx", perf_evsel__group_idx(evsel) == 1); |
Jiri Olsa | a9f93f9 | 2013-02-01 20:37:11 +0100 | [diff] [blame] | 702 | TEST_ASSERT_VAL("wrong sample_read", !evsel->sample_read); |
Jiri Olsa | 905f5ee | 2012-08-08 12:23:52 +0200 | [diff] [blame] | 703 | |
| 704 | /* group2 cycles + G modifier */ |
Arnaldo Carvalho de Melo | 0c21f73 | 2012-08-14 16:42:15 -0300 | [diff] [blame] | 705 | evsel = leader = perf_evsel__next(evsel); |
Jiri Olsa | 905f5ee | 2012-08-08 12:23:52 +0200 | [diff] [blame] | 706 | TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->attr.type); |
| 707 | TEST_ASSERT_VAL("wrong config", |
| 708 | PERF_COUNT_HW_CPU_CYCLES == evsel->attr.config); |
| 709 | TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user); |
| 710 | TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->attr.exclude_kernel); |
| 711 | TEST_ASSERT_VAL("wrong exclude_hv", !evsel->attr.exclude_hv); |
| 712 | TEST_ASSERT_VAL("wrong exclude guest", !evsel->attr.exclude_guest); |
| 713 | TEST_ASSERT_VAL("wrong exclude host", evsel->attr.exclude_host); |
| 714 | TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip); |
Namhyung Kim | 823254e | 2012-11-29 15:38:30 +0900 | [diff] [blame] | 715 | TEST_ASSERT_VAL("wrong leader", perf_evsel__is_group_leader(evsel)); |
Jiri Olsa | 905f5ee | 2012-08-08 12:23:52 +0200 | [diff] [blame] | 716 | TEST_ASSERT_VAL("wrong group name", |
| 717 | !strcmp(leader->group_name, "group2")); |
Namhyung Kim | 8d7d847 | 2013-01-22 18:09:30 +0900 | [diff] [blame] | 718 | TEST_ASSERT_VAL("wrong nr_members", evsel->nr_members == 2); |
| 719 | TEST_ASSERT_VAL("wrong group_idx", perf_evsel__group_idx(evsel) == 0); |
Jiri Olsa | a9f93f9 | 2013-02-01 20:37:11 +0100 | [diff] [blame] | 720 | TEST_ASSERT_VAL("wrong sample_read", !evsel->sample_read); |
Jiri Olsa | 905f5ee | 2012-08-08 12:23:52 +0200 | [diff] [blame] | 721 | |
| 722 | /* group2 1:3 + G modifier */ |
Arnaldo Carvalho de Melo | 0c21f73 | 2012-08-14 16:42:15 -0300 | [diff] [blame] | 723 | evsel = perf_evsel__next(evsel); |
Jiri Olsa | 905f5ee | 2012-08-08 12:23:52 +0200 | [diff] [blame] | 724 | TEST_ASSERT_VAL("wrong type", 1 == evsel->attr.type); |
| 725 | TEST_ASSERT_VAL("wrong config", 3 == evsel->attr.config); |
| 726 | TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user); |
| 727 | TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->attr.exclude_kernel); |
| 728 | TEST_ASSERT_VAL("wrong exclude_hv", !evsel->attr.exclude_hv); |
| 729 | TEST_ASSERT_VAL("wrong exclude guest", !evsel->attr.exclude_guest); |
| 730 | TEST_ASSERT_VAL("wrong exclude host", evsel->attr.exclude_host); |
| 731 | TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip); |
| 732 | TEST_ASSERT_VAL("wrong leader", evsel->leader == leader); |
Namhyung Kim | 8d7d847 | 2013-01-22 18:09:30 +0900 | [diff] [blame] | 733 | TEST_ASSERT_VAL("wrong group_idx", perf_evsel__group_idx(evsel) == 1); |
Jiri Olsa | a9f93f9 | 2013-02-01 20:37:11 +0100 | [diff] [blame] | 734 | TEST_ASSERT_VAL("wrong sample_read", !evsel->sample_read); |
Jiri Olsa | 905f5ee | 2012-08-08 12:23:52 +0200 | [diff] [blame] | 735 | |
| 736 | /* instructions:u */ |
Arnaldo Carvalho de Melo | 0c21f73 | 2012-08-14 16:42:15 -0300 | [diff] [blame] | 737 | evsel = perf_evsel__next(evsel); |
Jiri Olsa | 905f5ee | 2012-08-08 12:23:52 +0200 | [diff] [blame] | 738 | TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->attr.type); |
| 739 | TEST_ASSERT_VAL("wrong config", |
| 740 | PERF_COUNT_HW_INSTRUCTIONS == evsel->attr.config); |
| 741 | TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user); |
| 742 | TEST_ASSERT_VAL("wrong exclude_kernel", evsel->attr.exclude_kernel); |
| 743 | TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv); |
| 744 | TEST_ASSERT_VAL("wrong exclude guest", !evsel->attr.exclude_guest); |
| 745 | TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host); |
| 746 | TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip); |
Namhyung Kim | 823254e | 2012-11-29 15:38:30 +0900 | [diff] [blame] | 747 | TEST_ASSERT_VAL("wrong leader", perf_evsel__is_group_leader(evsel)); |
Jiri Olsa | a9f93f9 | 2013-02-01 20:37:11 +0100 | [diff] [blame] | 748 | TEST_ASSERT_VAL("wrong sample_read", !evsel->sample_read); |
Jiri Olsa | 905f5ee | 2012-08-08 12:23:52 +0200 | [diff] [blame] | 749 | |
| 750 | return 0; |
| 751 | } |
| 752 | |
Irina Tirdea | 1d037ca | 2012-09-11 01:15:03 +0300 | [diff] [blame] | 753 | static int test__group4(struct perf_evlist *evlist __maybe_unused) |
Jiri Olsa | 905f5ee | 2012-08-08 12:23:52 +0200 | [diff] [blame] | 754 | { |
| 755 | struct perf_evsel *evsel, *leader; |
| 756 | |
| 757 | TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->nr_entries); |
Namhyung Kim | 8d7d847 | 2013-01-22 18:09:30 +0900 | [diff] [blame] | 758 | TEST_ASSERT_VAL("wrong number of groups", 1 == evlist->nr_groups); |
Jiri Olsa | 905f5ee | 2012-08-08 12:23:52 +0200 | [diff] [blame] | 759 | |
| 760 | /* cycles:u + p */ |
Arnaldo Carvalho de Melo | 0c21f73 | 2012-08-14 16:42:15 -0300 | [diff] [blame] | 761 | evsel = leader = perf_evlist__first(evlist); |
Jiri Olsa | 905f5ee | 2012-08-08 12:23:52 +0200 | [diff] [blame] | 762 | TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->attr.type); |
| 763 | TEST_ASSERT_VAL("wrong config", |
| 764 | PERF_COUNT_HW_CPU_CYCLES == evsel->attr.config); |
| 765 | TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user); |
| 766 | TEST_ASSERT_VAL("wrong exclude_kernel", evsel->attr.exclude_kernel); |
| 767 | TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv); |
Jiri Olsa | 42be739 | 2012-10-20 18:29:34 +0200 | [diff] [blame] | 768 | /* use of precise requires exclude_guest */ |
| 769 | TEST_ASSERT_VAL("wrong exclude guest", evsel->attr.exclude_guest); |
Jiri Olsa | 905f5ee | 2012-08-08 12:23:52 +0200 | [diff] [blame] | 770 | TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host); |
| 771 | TEST_ASSERT_VAL("wrong precise_ip", evsel->attr.precise_ip == 1); |
| 772 | TEST_ASSERT_VAL("wrong group name", !evsel->group_name); |
Namhyung Kim | 823254e | 2012-11-29 15:38:30 +0900 | [diff] [blame] | 773 | TEST_ASSERT_VAL("wrong leader", perf_evsel__is_group_leader(evsel)); |
Namhyung Kim | 8d7d847 | 2013-01-22 18:09:30 +0900 | [diff] [blame] | 774 | TEST_ASSERT_VAL("wrong nr_members", evsel->nr_members == 2); |
| 775 | TEST_ASSERT_VAL("wrong group_idx", perf_evsel__group_idx(evsel) == 0); |
Jiri Olsa | a9f93f9 | 2013-02-01 20:37:11 +0100 | [diff] [blame] | 776 | TEST_ASSERT_VAL("wrong sample_read", !evsel->sample_read); |
Jiri Olsa | 905f5ee | 2012-08-08 12:23:52 +0200 | [diff] [blame] | 777 | |
| 778 | /* instructions:kp + p */ |
Arnaldo Carvalho de Melo | 0c21f73 | 2012-08-14 16:42:15 -0300 | [diff] [blame] | 779 | evsel = perf_evsel__next(evsel); |
Jiri Olsa | 905f5ee | 2012-08-08 12:23:52 +0200 | [diff] [blame] | 780 | TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->attr.type); |
| 781 | TEST_ASSERT_VAL("wrong config", |
| 782 | PERF_COUNT_HW_INSTRUCTIONS == evsel->attr.config); |
| 783 | TEST_ASSERT_VAL("wrong exclude_user", evsel->attr.exclude_user); |
| 784 | TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->attr.exclude_kernel); |
| 785 | TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv); |
Jiri Olsa | 42be739 | 2012-10-20 18:29:34 +0200 | [diff] [blame] | 786 | /* use of precise requires exclude_guest */ |
| 787 | TEST_ASSERT_VAL("wrong exclude guest", evsel->attr.exclude_guest); |
Jiri Olsa | 905f5ee | 2012-08-08 12:23:52 +0200 | [diff] [blame] | 788 | TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host); |
| 789 | TEST_ASSERT_VAL("wrong precise_ip", evsel->attr.precise_ip == 2); |
| 790 | TEST_ASSERT_VAL("wrong leader", evsel->leader == leader); |
Namhyung Kim | 8d7d847 | 2013-01-22 18:09:30 +0900 | [diff] [blame] | 791 | TEST_ASSERT_VAL("wrong group_idx", perf_evsel__group_idx(evsel) == 1); |
Jiri Olsa | a9f93f9 | 2013-02-01 20:37:11 +0100 | [diff] [blame] | 792 | TEST_ASSERT_VAL("wrong sample_read", !evsel->sample_read); |
Jiri Olsa | 905f5ee | 2012-08-08 12:23:52 +0200 | [diff] [blame] | 793 | |
| 794 | return 0; |
| 795 | } |
| 796 | |
Irina Tirdea | 1d037ca | 2012-09-11 01:15:03 +0300 | [diff] [blame] | 797 | static int test__group5(struct perf_evlist *evlist __maybe_unused) |
Jiri Olsa | 905f5ee | 2012-08-08 12:23:52 +0200 | [diff] [blame] | 798 | { |
| 799 | struct perf_evsel *evsel, *leader; |
| 800 | |
| 801 | TEST_ASSERT_VAL("wrong number of entries", 5 == evlist->nr_entries); |
Namhyung Kim | 8d7d847 | 2013-01-22 18:09:30 +0900 | [diff] [blame] | 802 | TEST_ASSERT_VAL("wrong number of groups", 2 == evlist->nr_groups); |
Jiri Olsa | 905f5ee | 2012-08-08 12:23:52 +0200 | [diff] [blame] | 803 | |
| 804 | /* cycles + G */ |
Arnaldo Carvalho de Melo | 0c21f73 | 2012-08-14 16:42:15 -0300 | [diff] [blame] | 805 | evsel = leader = perf_evlist__first(evlist); |
Jiri Olsa | 905f5ee | 2012-08-08 12:23:52 +0200 | [diff] [blame] | 806 | TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->attr.type); |
| 807 | TEST_ASSERT_VAL("wrong config", |
| 808 | PERF_COUNT_HW_CPU_CYCLES == evsel->attr.config); |
| 809 | TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user); |
| 810 | TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->attr.exclude_kernel); |
| 811 | TEST_ASSERT_VAL("wrong exclude_hv", !evsel->attr.exclude_hv); |
| 812 | TEST_ASSERT_VAL("wrong exclude guest", !evsel->attr.exclude_guest); |
| 813 | TEST_ASSERT_VAL("wrong exclude host", evsel->attr.exclude_host); |
| 814 | TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip); |
| 815 | TEST_ASSERT_VAL("wrong group name", !evsel->group_name); |
Namhyung Kim | 823254e | 2012-11-29 15:38:30 +0900 | [diff] [blame] | 816 | TEST_ASSERT_VAL("wrong leader", perf_evsel__is_group_leader(evsel)); |
Namhyung Kim | 8d7d847 | 2013-01-22 18:09:30 +0900 | [diff] [blame] | 817 | TEST_ASSERT_VAL("wrong nr_members", evsel->nr_members == 2); |
| 818 | TEST_ASSERT_VAL("wrong group_idx", perf_evsel__group_idx(evsel) == 0); |
Jiri Olsa | a9f93f9 | 2013-02-01 20:37:11 +0100 | [diff] [blame] | 819 | TEST_ASSERT_VAL("wrong sample_read", !evsel->sample_read); |
Jiri Olsa | 905f5ee | 2012-08-08 12:23:52 +0200 | [diff] [blame] | 820 | |
| 821 | /* instructions + G */ |
Arnaldo Carvalho de Melo | 0c21f73 | 2012-08-14 16:42:15 -0300 | [diff] [blame] | 822 | evsel = perf_evsel__next(evsel); |
Jiri Olsa | 905f5ee | 2012-08-08 12:23:52 +0200 | [diff] [blame] | 823 | TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->attr.type); |
| 824 | TEST_ASSERT_VAL("wrong config", |
| 825 | PERF_COUNT_HW_INSTRUCTIONS == evsel->attr.config); |
| 826 | TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user); |
| 827 | TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->attr.exclude_kernel); |
| 828 | TEST_ASSERT_VAL("wrong exclude_hv", !evsel->attr.exclude_hv); |
| 829 | TEST_ASSERT_VAL("wrong exclude guest", !evsel->attr.exclude_guest); |
| 830 | TEST_ASSERT_VAL("wrong exclude host", evsel->attr.exclude_host); |
| 831 | TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip); |
| 832 | TEST_ASSERT_VAL("wrong leader", evsel->leader == leader); |
Namhyung Kim | 8d7d847 | 2013-01-22 18:09:30 +0900 | [diff] [blame] | 833 | TEST_ASSERT_VAL("wrong group_idx", perf_evsel__group_idx(evsel) == 1); |
Jiri Olsa | a9f93f9 | 2013-02-01 20:37:11 +0100 | [diff] [blame] | 834 | TEST_ASSERT_VAL("wrong sample_read", !evsel->sample_read); |
Jiri Olsa | 905f5ee | 2012-08-08 12:23:52 +0200 | [diff] [blame] | 835 | |
| 836 | /* cycles:G */ |
Arnaldo Carvalho de Melo | 0c21f73 | 2012-08-14 16:42:15 -0300 | [diff] [blame] | 837 | evsel = leader = perf_evsel__next(evsel); |
Jiri Olsa | 905f5ee | 2012-08-08 12:23:52 +0200 | [diff] [blame] | 838 | TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->attr.type); |
| 839 | TEST_ASSERT_VAL("wrong config", |
| 840 | PERF_COUNT_HW_CPU_CYCLES == evsel->attr.config); |
| 841 | TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user); |
| 842 | TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->attr.exclude_kernel); |
| 843 | TEST_ASSERT_VAL("wrong exclude_hv", !evsel->attr.exclude_hv); |
| 844 | TEST_ASSERT_VAL("wrong exclude guest", !evsel->attr.exclude_guest); |
| 845 | TEST_ASSERT_VAL("wrong exclude host", evsel->attr.exclude_host); |
| 846 | TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip); |
| 847 | TEST_ASSERT_VAL("wrong group name", !evsel->group_name); |
Namhyung Kim | 823254e | 2012-11-29 15:38:30 +0900 | [diff] [blame] | 848 | TEST_ASSERT_VAL("wrong leader", perf_evsel__is_group_leader(evsel)); |
Namhyung Kim | 8d7d847 | 2013-01-22 18:09:30 +0900 | [diff] [blame] | 849 | TEST_ASSERT_VAL("wrong nr_members", evsel->nr_members == 2); |
| 850 | TEST_ASSERT_VAL("wrong group_idx", perf_evsel__group_idx(evsel) == 0); |
Jiri Olsa | a9f93f9 | 2013-02-01 20:37:11 +0100 | [diff] [blame] | 851 | TEST_ASSERT_VAL("wrong sample_read", !evsel->sample_read); |
Jiri Olsa | 905f5ee | 2012-08-08 12:23:52 +0200 | [diff] [blame] | 852 | |
| 853 | /* instructions:G */ |
Arnaldo Carvalho de Melo | 0c21f73 | 2012-08-14 16:42:15 -0300 | [diff] [blame] | 854 | evsel = perf_evsel__next(evsel); |
Jiri Olsa | 905f5ee | 2012-08-08 12:23:52 +0200 | [diff] [blame] | 855 | TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->attr.type); |
| 856 | TEST_ASSERT_VAL("wrong config", |
| 857 | PERF_COUNT_HW_INSTRUCTIONS == evsel->attr.config); |
| 858 | TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user); |
| 859 | TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->attr.exclude_kernel); |
| 860 | TEST_ASSERT_VAL("wrong exclude_hv", !evsel->attr.exclude_hv); |
| 861 | TEST_ASSERT_VAL("wrong exclude guest", !evsel->attr.exclude_guest); |
| 862 | TEST_ASSERT_VAL("wrong exclude host", evsel->attr.exclude_host); |
| 863 | TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip); |
| 864 | TEST_ASSERT_VAL("wrong leader", evsel->leader == leader); |
Namhyung Kim | 8d7d847 | 2013-01-22 18:09:30 +0900 | [diff] [blame] | 865 | TEST_ASSERT_VAL("wrong group_idx", perf_evsel__group_idx(evsel) == 1); |
Jiri Olsa | 905f5ee | 2012-08-08 12:23:52 +0200 | [diff] [blame] | 866 | |
| 867 | /* cycles */ |
Arnaldo Carvalho de Melo | 0c21f73 | 2012-08-14 16:42:15 -0300 | [diff] [blame] | 868 | evsel = perf_evsel__next(evsel); |
Jiri Olsa | 905f5ee | 2012-08-08 12:23:52 +0200 | [diff] [blame] | 869 | TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->attr.type); |
| 870 | TEST_ASSERT_VAL("wrong config", |
| 871 | PERF_COUNT_HW_CPU_CYCLES == evsel->attr.config); |
| 872 | TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user); |
| 873 | TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->attr.exclude_kernel); |
| 874 | TEST_ASSERT_VAL("wrong exclude_hv", !evsel->attr.exclude_hv); |
| 875 | TEST_ASSERT_VAL("wrong exclude guest", evsel->attr.exclude_guest); |
| 876 | TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host); |
| 877 | TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip); |
Namhyung Kim | 823254e | 2012-11-29 15:38:30 +0900 | [diff] [blame] | 878 | TEST_ASSERT_VAL("wrong leader", perf_evsel__is_group_leader(evsel)); |
Jiri Olsa | 905f5ee | 2012-08-08 12:23:52 +0200 | [diff] [blame] | 879 | |
| 880 | return 0; |
| 881 | } |
| 882 | |
Jiri Olsa | 5a30a99 | 2013-02-04 10:56:43 +0100 | [diff] [blame] | 883 | static int test__group_gh1(struct perf_evlist *evlist) |
| 884 | { |
| 885 | struct perf_evsel *evsel, *leader; |
| 886 | |
| 887 | TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->nr_entries); |
| 888 | TEST_ASSERT_VAL("wrong number of groups", 1 == evlist->nr_groups); |
| 889 | |
| 890 | /* cycles + :H group modifier */ |
| 891 | evsel = leader = perf_evlist__first(evlist); |
| 892 | TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->attr.type); |
| 893 | TEST_ASSERT_VAL("wrong config", |
| 894 | PERF_COUNT_HW_CPU_CYCLES == evsel->attr.config); |
| 895 | TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user); |
| 896 | TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->attr.exclude_kernel); |
| 897 | TEST_ASSERT_VAL("wrong exclude_hv", !evsel->attr.exclude_hv); |
| 898 | TEST_ASSERT_VAL("wrong exclude guest", evsel->attr.exclude_guest); |
| 899 | TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host); |
| 900 | TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip); |
| 901 | TEST_ASSERT_VAL("wrong group name", !evsel->group_name); |
| 902 | TEST_ASSERT_VAL("wrong leader", perf_evsel__is_group_leader(evsel)); |
| 903 | TEST_ASSERT_VAL("wrong nr_members", evsel->nr_members == 2); |
| 904 | TEST_ASSERT_VAL("wrong group_idx", perf_evsel__group_idx(evsel) == 0); |
| 905 | |
| 906 | /* cache-misses:G + :H group modifier */ |
| 907 | evsel = perf_evsel__next(evsel); |
| 908 | TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->attr.type); |
| 909 | TEST_ASSERT_VAL("wrong config", |
| 910 | PERF_COUNT_HW_CACHE_MISSES == evsel->attr.config); |
| 911 | TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user); |
| 912 | TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->attr.exclude_kernel); |
| 913 | TEST_ASSERT_VAL("wrong exclude_hv", !evsel->attr.exclude_hv); |
| 914 | TEST_ASSERT_VAL("wrong exclude guest", !evsel->attr.exclude_guest); |
| 915 | TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host); |
| 916 | TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip); |
| 917 | TEST_ASSERT_VAL("wrong leader", evsel->leader == leader); |
| 918 | TEST_ASSERT_VAL("wrong group_idx", perf_evsel__group_idx(evsel) == 1); |
| 919 | |
| 920 | return 0; |
| 921 | } |
| 922 | |
| 923 | static int test__group_gh2(struct perf_evlist *evlist) |
| 924 | { |
| 925 | struct perf_evsel *evsel, *leader; |
| 926 | |
| 927 | TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->nr_entries); |
| 928 | TEST_ASSERT_VAL("wrong number of groups", 1 == evlist->nr_groups); |
| 929 | |
| 930 | /* cycles + :G group modifier */ |
| 931 | evsel = leader = perf_evlist__first(evlist); |
| 932 | TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->attr.type); |
| 933 | TEST_ASSERT_VAL("wrong config", |
| 934 | PERF_COUNT_HW_CPU_CYCLES == evsel->attr.config); |
| 935 | TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user); |
| 936 | TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->attr.exclude_kernel); |
| 937 | TEST_ASSERT_VAL("wrong exclude_hv", !evsel->attr.exclude_hv); |
| 938 | TEST_ASSERT_VAL("wrong exclude guest", !evsel->attr.exclude_guest); |
| 939 | TEST_ASSERT_VAL("wrong exclude host", evsel->attr.exclude_host); |
| 940 | TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip); |
| 941 | TEST_ASSERT_VAL("wrong group name", !evsel->group_name); |
| 942 | TEST_ASSERT_VAL("wrong leader", perf_evsel__is_group_leader(evsel)); |
| 943 | TEST_ASSERT_VAL("wrong nr_members", evsel->nr_members == 2); |
| 944 | TEST_ASSERT_VAL("wrong group_idx", perf_evsel__group_idx(evsel) == 0); |
| 945 | |
| 946 | /* cache-misses:H + :G group modifier */ |
| 947 | evsel = perf_evsel__next(evsel); |
| 948 | TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->attr.type); |
| 949 | TEST_ASSERT_VAL("wrong config", |
| 950 | PERF_COUNT_HW_CACHE_MISSES == evsel->attr.config); |
| 951 | TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user); |
| 952 | TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->attr.exclude_kernel); |
| 953 | TEST_ASSERT_VAL("wrong exclude_hv", !evsel->attr.exclude_hv); |
| 954 | TEST_ASSERT_VAL("wrong exclude guest", !evsel->attr.exclude_guest); |
| 955 | TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host); |
| 956 | TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip); |
| 957 | TEST_ASSERT_VAL("wrong leader", evsel->leader == leader); |
| 958 | TEST_ASSERT_VAL("wrong group_idx", perf_evsel__group_idx(evsel) == 1); |
| 959 | |
| 960 | return 0; |
| 961 | } |
| 962 | |
| 963 | static int test__group_gh3(struct perf_evlist *evlist) |
| 964 | { |
| 965 | struct perf_evsel *evsel, *leader; |
| 966 | |
| 967 | TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->nr_entries); |
| 968 | TEST_ASSERT_VAL("wrong number of groups", 1 == evlist->nr_groups); |
| 969 | |
| 970 | /* cycles:G + :u group modifier */ |
| 971 | evsel = leader = perf_evlist__first(evlist); |
| 972 | TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->attr.type); |
| 973 | TEST_ASSERT_VAL("wrong config", |
| 974 | PERF_COUNT_HW_CPU_CYCLES == evsel->attr.config); |
| 975 | TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user); |
| 976 | TEST_ASSERT_VAL("wrong exclude_kernel", evsel->attr.exclude_kernel); |
| 977 | TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv); |
| 978 | TEST_ASSERT_VAL("wrong exclude guest", !evsel->attr.exclude_guest); |
| 979 | TEST_ASSERT_VAL("wrong exclude host", evsel->attr.exclude_host); |
| 980 | TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip); |
| 981 | TEST_ASSERT_VAL("wrong group name", !evsel->group_name); |
| 982 | TEST_ASSERT_VAL("wrong leader", perf_evsel__is_group_leader(evsel)); |
| 983 | TEST_ASSERT_VAL("wrong nr_members", evsel->nr_members == 2); |
| 984 | TEST_ASSERT_VAL("wrong group_idx", perf_evsel__group_idx(evsel) == 0); |
| 985 | |
| 986 | /* cache-misses:H + :u group modifier */ |
| 987 | evsel = perf_evsel__next(evsel); |
| 988 | TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->attr.type); |
| 989 | TEST_ASSERT_VAL("wrong config", |
| 990 | PERF_COUNT_HW_CACHE_MISSES == evsel->attr.config); |
| 991 | TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user); |
| 992 | TEST_ASSERT_VAL("wrong exclude_kernel", evsel->attr.exclude_kernel); |
| 993 | TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv); |
| 994 | TEST_ASSERT_VAL("wrong exclude guest", evsel->attr.exclude_guest); |
| 995 | TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host); |
| 996 | TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip); |
| 997 | TEST_ASSERT_VAL("wrong leader", evsel->leader == leader); |
| 998 | TEST_ASSERT_VAL("wrong group_idx", perf_evsel__group_idx(evsel) == 1); |
| 999 | |
| 1000 | return 0; |
| 1001 | } |
| 1002 | |
| 1003 | static int test__group_gh4(struct perf_evlist *evlist) |
| 1004 | { |
| 1005 | struct perf_evsel *evsel, *leader; |
| 1006 | |
| 1007 | TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->nr_entries); |
| 1008 | TEST_ASSERT_VAL("wrong number of groups", 1 == evlist->nr_groups); |
| 1009 | |
| 1010 | /* cycles:G + :uG group modifier */ |
| 1011 | evsel = leader = perf_evlist__first(evlist); |
| 1012 | TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->attr.type); |
| 1013 | TEST_ASSERT_VAL("wrong config", |
| 1014 | PERF_COUNT_HW_CPU_CYCLES == evsel->attr.config); |
| 1015 | TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user); |
| 1016 | TEST_ASSERT_VAL("wrong exclude_kernel", evsel->attr.exclude_kernel); |
| 1017 | TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv); |
| 1018 | TEST_ASSERT_VAL("wrong exclude guest", !evsel->attr.exclude_guest); |
| 1019 | TEST_ASSERT_VAL("wrong exclude host", evsel->attr.exclude_host); |
| 1020 | TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip); |
| 1021 | TEST_ASSERT_VAL("wrong group name", !evsel->group_name); |
| 1022 | TEST_ASSERT_VAL("wrong leader", perf_evsel__is_group_leader(evsel)); |
| 1023 | TEST_ASSERT_VAL("wrong nr_members", evsel->nr_members == 2); |
| 1024 | TEST_ASSERT_VAL("wrong group_idx", perf_evsel__group_idx(evsel) == 0); |
| 1025 | |
| 1026 | /* cache-misses:H + :uG group modifier */ |
| 1027 | evsel = perf_evsel__next(evsel); |
| 1028 | TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->attr.type); |
| 1029 | TEST_ASSERT_VAL("wrong config", |
| 1030 | PERF_COUNT_HW_CACHE_MISSES == evsel->attr.config); |
| 1031 | TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user); |
| 1032 | TEST_ASSERT_VAL("wrong exclude_kernel", evsel->attr.exclude_kernel); |
| 1033 | TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv); |
| 1034 | TEST_ASSERT_VAL("wrong exclude guest", !evsel->attr.exclude_guest); |
| 1035 | TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host); |
| 1036 | TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip); |
| 1037 | TEST_ASSERT_VAL("wrong leader", evsel->leader == leader); |
| 1038 | TEST_ASSERT_VAL("wrong group_idx", perf_evsel__group_idx(evsel) == 1); |
| 1039 | |
| 1040 | return 0; |
| 1041 | } |
| 1042 | |
Jiri Olsa | a9f93f9 | 2013-02-01 20:37:11 +0100 | [diff] [blame] | 1043 | static int test__leader_sample1(struct perf_evlist *evlist) |
| 1044 | { |
| 1045 | struct perf_evsel *evsel, *leader; |
| 1046 | |
| 1047 | TEST_ASSERT_VAL("wrong number of entries", 3 == evlist->nr_entries); |
| 1048 | |
| 1049 | /* cycles - sampling group leader */ |
| 1050 | evsel = leader = perf_evlist__first(evlist); |
| 1051 | TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->attr.type); |
| 1052 | TEST_ASSERT_VAL("wrong config", |
| 1053 | PERF_COUNT_HW_CPU_CYCLES == evsel->attr.config); |
| 1054 | TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user); |
| 1055 | TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->attr.exclude_kernel); |
| 1056 | TEST_ASSERT_VAL("wrong exclude_hv", !evsel->attr.exclude_hv); |
| 1057 | TEST_ASSERT_VAL("wrong exclude guest", evsel->attr.exclude_guest); |
| 1058 | TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host); |
| 1059 | TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip); |
| 1060 | TEST_ASSERT_VAL("wrong group name", !evsel->group_name); |
| 1061 | TEST_ASSERT_VAL("wrong leader", evsel->leader == leader); |
| 1062 | TEST_ASSERT_VAL("wrong sample_read", evsel->sample_read); |
| 1063 | |
| 1064 | /* cache-misses - not sampling */ |
| 1065 | evsel = perf_evsel__next(evsel); |
| 1066 | TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->attr.type); |
| 1067 | TEST_ASSERT_VAL("wrong config", |
| 1068 | PERF_COUNT_HW_CACHE_MISSES == evsel->attr.config); |
| 1069 | TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user); |
| 1070 | TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->attr.exclude_kernel); |
| 1071 | TEST_ASSERT_VAL("wrong exclude_hv", !evsel->attr.exclude_hv); |
| 1072 | TEST_ASSERT_VAL("wrong exclude guest", evsel->attr.exclude_guest); |
| 1073 | TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host); |
| 1074 | TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip); |
| 1075 | TEST_ASSERT_VAL("wrong leader", evsel->leader == leader); |
| 1076 | TEST_ASSERT_VAL("wrong sample_read", evsel->sample_read); |
| 1077 | |
| 1078 | /* branch-misses - not sampling */ |
| 1079 | evsel = perf_evsel__next(evsel); |
| 1080 | TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->attr.type); |
| 1081 | TEST_ASSERT_VAL("wrong config", |
| 1082 | PERF_COUNT_HW_BRANCH_MISSES == evsel->attr.config); |
| 1083 | TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user); |
| 1084 | TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->attr.exclude_kernel); |
| 1085 | TEST_ASSERT_VAL("wrong exclude_hv", !evsel->attr.exclude_hv); |
| 1086 | TEST_ASSERT_VAL("wrong exclude guest", evsel->attr.exclude_guest); |
| 1087 | TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host); |
| 1088 | TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip); |
| 1089 | TEST_ASSERT_VAL("wrong group name", !evsel->group_name); |
| 1090 | TEST_ASSERT_VAL("wrong leader", evsel->leader == leader); |
| 1091 | TEST_ASSERT_VAL("wrong sample_read", evsel->sample_read); |
| 1092 | |
| 1093 | return 0; |
| 1094 | } |
| 1095 | |
| 1096 | static int test__leader_sample2(struct perf_evlist *evlist __maybe_unused) |
| 1097 | { |
| 1098 | struct perf_evsel *evsel, *leader; |
| 1099 | |
| 1100 | TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->nr_entries); |
| 1101 | |
| 1102 | /* instructions - sampling group leader */ |
| 1103 | evsel = leader = perf_evlist__first(evlist); |
| 1104 | TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->attr.type); |
| 1105 | TEST_ASSERT_VAL("wrong config", |
| 1106 | PERF_COUNT_HW_INSTRUCTIONS == evsel->attr.config); |
| 1107 | TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user); |
| 1108 | TEST_ASSERT_VAL("wrong exclude_kernel", evsel->attr.exclude_kernel); |
| 1109 | TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv); |
| 1110 | TEST_ASSERT_VAL("wrong exclude guest", evsel->attr.exclude_guest); |
| 1111 | TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host); |
| 1112 | TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip); |
| 1113 | TEST_ASSERT_VAL("wrong group name", !evsel->group_name); |
| 1114 | TEST_ASSERT_VAL("wrong leader", evsel->leader == leader); |
| 1115 | TEST_ASSERT_VAL("wrong sample_read", evsel->sample_read); |
| 1116 | |
| 1117 | /* branch-misses - not sampling */ |
| 1118 | evsel = perf_evsel__next(evsel); |
| 1119 | TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->attr.type); |
| 1120 | TEST_ASSERT_VAL("wrong config", |
| 1121 | PERF_COUNT_HW_BRANCH_MISSES == evsel->attr.config); |
| 1122 | TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user); |
| 1123 | TEST_ASSERT_VAL("wrong exclude_kernel", evsel->attr.exclude_kernel); |
| 1124 | TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv); |
| 1125 | TEST_ASSERT_VAL("wrong exclude guest", evsel->attr.exclude_guest); |
| 1126 | TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host); |
| 1127 | TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip); |
| 1128 | TEST_ASSERT_VAL("wrong group name", !evsel->group_name); |
| 1129 | TEST_ASSERT_VAL("wrong leader", evsel->leader == leader); |
| 1130 | TEST_ASSERT_VAL("wrong sample_read", evsel->sample_read); |
| 1131 | |
| 1132 | return 0; |
| 1133 | } |
| 1134 | |
Michael Ellerman | c9ee780 | 2013-08-06 23:28:06 +1000 | [diff] [blame] | 1135 | static int test__checkevent_pinned_modifier(struct perf_evlist *evlist) |
| 1136 | { |
| 1137 | struct perf_evsel *evsel = perf_evlist__first(evlist); |
| 1138 | |
| 1139 | TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user); |
| 1140 | TEST_ASSERT_VAL("wrong exclude_kernel", evsel->attr.exclude_kernel); |
| 1141 | TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv); |
| 1142 | TEST_ASSERT_VAL("wrong precise_ip", evsel->attr.precise_ip); |
| 1143 | TEST_ASSERT_VAL("wrong pinned", evsel->attr.pinned); |
| 1144 | |
| 1145 | return test__checkevent_symbolic_name(evlist); |
| 1146 | } |
| 1147 | |
| 1148 | static int test__pinned_group(struct perf_evlist *evlist) |
| 1149 | { |
| 1150 | struct perf_evsel *evsel, *leader; |
| 1151 | |
| 1152 | TEST_ASSERT_VAL("wrong number of entries", 3 == evlist->nr_entries); |
| 1153 | |
| 1154 | /* cycles - group leader */ |
| 1155 | evsel = leader = perf_evlist__first(evlist); |
| 1156 | TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->attr.type); |
| 1157 | TEST_ASSERT_VAL("wrong config", |
| 1158 | PERF_COUNT_HW_CPU_CYCLES == evsel->attr.config); |
| 1159 | TEST_ASSERT_VAL("wrong group name", !evsel->group_name); |
| 1160 | TEST_ASSERT_VAL("wrong leader", evsel->leader == leader); |
| 1161 | TEST_ASSERT_VAL("wrong pinned", evsel->attr.pinned); |
| 1162 | |
| 1163 | /* cache-misses - can not be pinned, but will go on with the leader */ |
| 1164 | evsel = perf_evsel__next(evsel); |
| 1165 | TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->attr.type); |
| 1166 | TEST_ASSERT_VAL("wrong config", |
| 1167 | PERF_COUNT_HW_CACHE_MISSES == evsel->attr.config); |
| 1168 | TEST_ASSERT_VAL("wrong pinned", !evsel->attr.pinned); |
| 1169 | |
| 1170 | /* branch-misses - ditto */ |
| 1171 | evsel = perf_evsel__next(evsel); |
| 1172 | TEST_ASSERT_VAL("wrong config", |
| 1173 | PERF_COUNT_HW_BRANCH_MISSES == evsel->attr.config); |
| 1174 | TEST_ASSERT_VAL("wrong pinned", !evsel->attr.pinned); |
| 1175 | |
| 1176 | return 0; |
| 1177 | } |
| 1178 | |
Jacob Shin | ec32398 | 2014-05-29 17:26:52 +0200 | [diff] [blame] | 1179 | static int test__checkevent_breakpoint_len(struct perf_evlist *evlist) |
| 1180 | { |
| 1181 | struct perf_evsel *evsel = perf_evlist__first(evlist); |
| 1182 | |
| 1183 | TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->nr_entries); |
| 1184 | TEST_ASSERT_VAL("wrong type", PERF_TYPE_BREAKPOINT == evsel->attr.type); |
| 1185 | TEST_ASSERT_VAL("wrong config", 0 == evsel->attr.config); |
| 1186 | TEST_ASSERT_VAL("wrong bp_type", (HW_BREAKPOINT_R | HW_BREAKPOINT_W) == |
| 1187 | evsel->attr.bp_type); |
| 1188 | TEST_ASSERT_VAL("wrong bp_len", HW_BREAKPOINT_LEN_1 == |
| 1189 | evsel->attr.bp_len); |
| 1190 | |
| 1191 | return 0; |
| 1192 | } |
| 1193 | |
| 1194 | static int test__checkevent_breakpoint_len_w(struct perf_evlist *evlist) |
| 1195 | { |
| 1196 | struct perf_evsel *evsel = perf_evlist__first(evlist); |
| 1197 | |
| 1198 | TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->nr_entries); |
| 1199 | TEST_ASSERT_VAL("wrong type", PERF_TYPE_BREAKPOINT == evsel->attr.type); |
| 1200 | TEST_ASSERT_VAL("wrong config", 0 == evsel->attr.config); |
| 1201 | TEST_ASSERT_VAL("wrong bp_type", HW_BREAKPOINT_W == |
| 1202 | evsel->attr.bp_type); |
| 1203 | TEST_ASSERT_VAL("wrong bp_len", HW_BREAKPOINT_LEN_2 == |
| 1204 | evsel->attr.bp_len); |
| 1205 | |
| 1206 | return 0; |
| 1207 | } |
| 1208 | |
| 1209 | static int |
| 1210 | test__checkevent_breakpoint_len_rw_modifier(struct perf_evlist *evlist) |
| 1211 | { |
| 1212 | struct perf_evsel *evsel = perf_evlist__first(evlist); |
| 1213 | |
| 1214 | TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user); |
| 1215 | TEST_ASSERT_VAL("wrong exclude_kernel", evsel->attr.exclude_kernel); |
| 1216 | TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv); |
| 1217 | TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip); |
| 1218 | |
| 1219 | return test__checkevent_breakpoint_rw(evlist); |
| 1220 | } |
| 1221 | |
Jiri Olsa | 82ce75d | 2012-12-17 14:08:38 +0100 | [diff] [blame] | 1222 | static int count_tracepoints(void) |
| 1223 | { |
| 1224 | char events_path[PATH_MAX]; |
| 1225 | struct dirent *events_ent; |
Steven Rostedt (Red Hat) | 23773ca | 2015-02-02 14:35:07 -0500 | [diff] [blame] | 1226 | const char *mountpoint; |
Jiri Olsa | 82ce75d | 2012-12-17 14:08:38 +0100 | [diff] [blame] | 1227 | DIR *events_dir; |
| 1228 | int cnt = 0; |
| 1229 | |
Steven Rostedt (Red Hat) | 23773ca | 2015-02-02 14:35:07 -0500 | [diff] [blame] | 1230 | mountpoint = tracefs_find_mountpoint(); |
| 1231 | if (mountpoint) { |
| 1232 | scnprintf(events_path, PATH_MAX, "%s/events", |
| 1233 | mountpoint); |
| 1234 | } else { |
| 1235 | mountpoint = debugfs_find_mountpoint(); |
| 1236 | scnprintf(events_path, PATH_MAX, "%s/tracing/events", |
| 1237 | mountpoint); |
| 1238 | } |
Jiri Olsa | 82ce75d | 2012-12-17 14:08:38 +0100 | [diff] [blame] | 1239 | |
| 1240 | events_dir = opendir(events_path); |
| 1241 | |
| 1242 | TEST_ASSERT_VAL("Can't open events dir", events_dir); |
| 1243 | |
| 1244 | while ((events_ent = readdir(events_dir))) { |
| 1245 | char sys_path[PATH_MAX]; |
| 1246 | struct dirent *sys_ent; |
| 1247 | DIR *sys_dir; |
| 1248 | |
| 1249 | if (!strcmp(events_ent->d_name, ".") |
| 1250 | || !strcmp(events_ent->d_name, "..") |
| 1251 | || !strcmp(events_ent->d_name, "enable") |
| 1252 | || !strcmp(events_ent->d_name, "header_event") |
| 1253 | || !strcmp(events_ent->d_name, "header_page")) |
| 1254 | continue; |
| 1255 | |
| 1256 | scnprintf(sys_path, PATH_MAX, "%s/%s", |
| 1257 | events_path, events_ent->d_name); |
| 1258 | |
| 1259 | sys_dir = opendir(sys_path); |
| 1260 | TEST_ASSERT_VAL("Can't open sys dir", sys_dir); |
| 1261 | |
| 1262 | while ((sys_ent = readdir(sys_dir))) { |
| 1263 | if (!strcmp(sys_ent->d_name, ".") |
| 1264 | || !strcmp(sys_ent->d_name, "..") |
| 1265 | || !strcmp(sys_ent->d_name, "enable") |
| 1266 | || !strcmp(sys_ent->d_name, "filter")) |
| 1267 | continue; |
| 1268 | |
| 1269 | cnt++; |
| 1270 | } |
| 1271 | |
| 1272 | closedir(sys_dir); |
| 1273 | } |
| 1274 | |
| 1275 | closedir(events_dir); |
| 1276 | return cnt; |
| 1277 | } |
| 1278 | |
| 1279 | static int test__all_tracepoints(struct perf_evlist *evlist) |
| 1280 | { |
| 1281 | TEST_ASSERT_VAL("wrong events count", |
| 1282 | count_tracepoints() == evlist->nr_entries); |
| 1283 | |
| 1284 | return test__checkevent_tracepoint_multi(evlist); |
| 1285 | } |
| 1286 | |
Arnaldo Carvalho de Melo | 23b6339 | 2013-01-18 16:56:57 -0300 | [diff] [blame] | 1287 | struct evlist_test { |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 1288 | const char *name; |
| 1289 | __u32 type; |
Alexander Yarygin | 615b8f9 | 2014-04-25 17:34:06 +0200 | [diff] [blame] | 1290 | const int id; |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 1291 | int (*check)(struct perf_evlist *evlist); |
| 1292 | }; |
| 1293 | |
Arnaldo Carvalho de Melo | 23b6339 | 2013-01-18 16:56:57 -0300 | [diff] [blame] | 1294 | static struct evlist_test test__events[] = { |
Alexander Yarygin | 615b8f9 | 2014-04-25 17:34:06 +0200 | [diff] [blame] | 1295 | { |
Riku Voipio | 43f322b | 2015-04-16 16:52:53 +0300 | [diff] [blame^] | 1296 | .name = "syscalls:sys_enter_openat", |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 1297 | .check = test__checkevent_tracepoint, |
Alexander Yarygin | 615b8f9 | 2014-04-25 17:34:06 +0200 | [diff] [blame] | 1298 | .id = 0, |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 1299 | }, |
Alexander Yarygin | 615b8f9 | 2014-04-25 17:34:06 +0200 | [diff] [blame] | 1300 | { |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 1301 | .name = "syscalls:*", |
| 1302 | .check = test__checkevent_tracepoint_multi, |
Alexander Yarygin | 615b8f9 | 2014-04-25 17:34:06 +0200 | [diff] [blame] | 1303 | .id = 1, |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 1304 | }, |
Alexander Yarygin | 615b8f9 | 2014-04-25 17:34:06 +0200 | [diff] [blame] | 1305 | { |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 1306 | .name = "r1a", |
| 1307 | .check = test__checkevent_raw, |
Alexander Yarygin | 615b8f9 | 2014-04-25 17:34:06 +0200 | [diff] [blame] | 1308 | .id = 2, |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 1309 | }, |
Alexander Yarygin | 615b8f9 | 2014-04-25 17:34:06 +0200 | [diff] [blame] | 1310 | { |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 1311 | .name = "1:1", |
| 1312 | .check = test__checkevent_numeric, |
Alexander Yarygin | 615b8f9 | 2014-04-25 17:34:06 +0200 | [diff] [blame] | 1313 | .id = 3, |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 1314 | }, |
Alexander Yarygin | 615b8f9 | 2014-04-25 17:34:06 +0200 | [diff] [blame] | 1315 | { |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 1316 | .name = "instructions", |
| 1317 | .check = test__checkevent_symbolic_name, |
Alexander Yarygin | 615b8f9 | 2014-04-25 17:34:06 +0200 | [diff] [blame] | 1318 | .id = 4, |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 1319 | }, |
Alexander Yarygin | 615b8f9 | 2014-04-25 17:34:06 +0200 | [diff] [blame] | 1320 | { |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 1321 | .name = "cycles/period=100000,config2/", |
| 1322 | .check = test__checkevent_symbolic_name_config, |
Alexander Yarygin | 615b8f9 | 2014-04-25 17:34:06 +0200 | [diff] [blame] | 1323 | .id = 5, |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 1324 | }, |
Alexander Yarygin | 615b8f9 | 2014-04-25 17:34:06 +0200 | [diff] [blame] | 1325 | { |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 1326 | .name = "faults", |
| 1327 | .check = test__checkevent_symbolic_alias, |
Alexander Yarygin | 615b8f9 | 2014-04-25 17:34:06 +0200 | [diff] [blame] | 1328 | .id = 6, |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 1329 | }, |
Alexander Yarygin | 615b8f9 | 2014-04-25 17:34:06 +0200 | [diff] [blame] | 1330 | { |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 1331 | .name = "L1-dcache-load-miss", |
| 1332 | .check = test__checkevent_genhw, |
Alexander Yarygin | 615b8f9 | 2014-04-25 17:34:06 +0200 | [diff] [blame] | 1333 | .id = 7, |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 1334 | }, |
Alexander Yarygin | 615b8f9 | 2014-04-25 17:34:06 +0200 | [diff] [blame] | 1335 | { |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 1336 | .name = "mem:0", |
| 1337 | .check = test__checkevent_breakpoint, |
Alexander Yarygin | 615b8f9 | 2014-04-25 17:34:06 +0200 | [diff] [blame] | 1338 | .id = 8, |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 1339 | }, |
Alexander Yarygin | 615b8f9 | 2014-04-25 17:34:06 +0200 | [diff] [blame] | 1340 | { |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 1341 | .name = "mem:0:x", |
| 1342 | .check = test__checkevent_breakpoint_x, |
Alexander Yarygin | 615b8f9 | 2014-04-25 17:34:06 +0200 | [diff] [blame] | 1343 | .id = 9, |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 1344 | }, |
Alexander Yarygin | 615b8f9 | 2014-04-25 17:34:06 +0200 | [diff] [blame] | 1345 | { |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 1346 | .name = "mem:0:r", |
| 1347 | .check = test__checkevent_breakpoint_r, |
Alexander Yarygin | 615b8f9 | 2014-04-25 17:34:06 +0200 | [diff] [blame] | 1348 | .id = 10, |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 1349 | }, |
Alexander Yarygin | 615b8f9 | 2014-04-25 17:34:06 +0200 | [diff] [blame] | 1350 | { |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 1351 | .name = "mem:0:w", |
| 1352 | .check = test__checkevent_breakpoint_w, |
Alexander Yarygin | 615b8f9 | 2014-04-25 17:34:06 +0200 | [diff] [blame] | 1353 | .id = 11, |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 1354 | }, |
Alexander Yarygin | 615b8f9 | 2014-04-25 17:34:06 +0200 | [diff] [blame] | 1355 | { |
Riku Voipio | 43f322b | 2015-04-16 16:52:53 +0300 | [diff] [blame^] | 1356 | .name = "syscalls:sys_enter_openat:k", |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 1357 | .check = test__checkevent_tracepoint_modifier, |
Alexander Yarygin | 615b8f9 | 2014-04-25 17:34:06 +0200 | [diff] [blame] | 1358 | .id = 12, |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 1359 | }, |
Alexander Yarygin | 615b8f9 | 2014-04-25 17:34:06 +0200 | [diff] [blame] | 1360 | { |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 1361 | .name = "syscalls:*:u", |
| 1362 | .check = test__checkevent_tracepoint_multi_modifier, |
Alexander Yarygin | 615b8f9 | 2014-04-25 17:34:06 +0200 | [diff] [blame] | 1363 | .id = 13, |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 1364 | }, |
Alexander Yarygin | 615b8f9 | 2014-04-25 17:34:06 +0200 | [diff] [blame] | 1365 | { |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 1366 | .name = "r1a:kp", |
| 1367 | .check = test__checkevent_raw_modifier, |
Alexander Yarygin | 615b8f9 | 2014-04-25 17:34:06 +0200 | [diff] [blame] | 1368 | .id = 14, |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 1369 | }, |
Alexander Yarygin | 615b8f9 | 2014-04-25 17:34:06 +0200 | [diff] [blame] | 1370 | { |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 1371 | .name = "1:1:hp", |
| 1372 | .check = test__checkevent_numeric_modifier, |
Alexander Yarygin | 615b8f9 | 2014-04-25 17:34:06 +0200 | [diff] [blame] | 1373 | .id = 15, |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 1374 | }, |
Alexander Yarygin | 615b8f9 | 2014-04-25 17:34:06 +0200 | [diff] [blame] | 1375 | { |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 1376 | .name = "instructions:h", |
| 1377 | .check = test__checkevent_symbolic_name_modifier, |
Alexander Yarygin | 615b8f9 | 2014-04-25 17:34:06 +0200 | [diff] [blame] | 1378 | .id = 16, |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 1379 | }, |
Alexander Yarygin | 615b8f9 | 2014-04-25 17:34:06 +0200 | [diff] [blame] | 1380 | { |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 1381 | .name = "faults:u", |
| 1382 | .check = test__checkevent_symbolic_alias_modifier, |
Alexander Yarygin | 615b8f9 | 2014-04-25 17:34:06 +0200 | [diff] [blame] | 1383 | .id = 17, |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 1384 | }, |
Alexander Yarygin | 615b8f9 | 2014-04-25 17:34:06 +0200 | [diff] [blame] | 1385 | { |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 1386 | .name = "L1-dcache-load-miss:kp", |
| 1387 | .check = test__checkevent_genhw_modifier, |
Alexander Yarygin | 615b8f9 | 2014-04-25 17:34:06 +0200 | [diff] [blame] | 1388 | .id = 18, |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 1389 | }, |
Alexander Yarygin | 615b8f9 | 2014-04-25 17:34:06 +0200 | [diff] [blame] | 1390 | { |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 1391 | .name = "mem:0:u", |
| 1392 | .check = test__checkevent_breakpoint_modifier, |
Alexander Yarygin | 615b8f9 | 2014-04-25 17:34:06 +0200 | [diff] [blame] | 1393 | .id = 19, |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 1394 | }, |
Alexander Yarygin | 615b8f9 | 2014-04-25 17:34:06 +0200 | [diff] [blame] | 1395 | { |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 1396 | .name = "mem:0:x:k", |
| 1397 | .check = test__checkevent_breakpoint_x_modifier, |
Alexander Yarygin | 615b8f9 | 2014-04-25 17:34:06 +0200 | [diff] [blame] | 1398 | .id = 20, |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 1399 | }, |
Alexander Yarygin | 615b8f9 | 2014-04-25 17:34:06 +0200 | [diff] [blame] | 1400 | { |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 1401 | .name = "mem:0:r:hp", |
| 1402 | .check = test__checkevent_breakpoint_r_modifier, |
Alexander Yarygin | 615b8f9 | 2014-04-25 17:34:06 +0200 | [diff] [blame] | 1403 | .id = 21, |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 1404 | }, |
Alexander Yarygin | 615b8f9 | 2014-04-25 17:34:06 +0200 | [diff] [blame] | 1405 | { |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 1406 | .name = "mem:0:w:up", |
| 1407 | .check = test__checkevent_breakpoint_w_modifier, |
Alexander Yarygin | 615b8f9 | 2014-04-25 17:34:06 +0200 | [diff] [blame] | 1408 | .id = 22, |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 1409 | }, |
Alexander Yarygin | 615b8f9 | 2014-04-25 17:34:06 +0200 | [diff] [blame] | 1410 | { |
Riku Voipio | 43f322b | 2015-04-16 16:52:53 +0300 | [diff] [blame^] | 1411 | .name = "r1,syscalls:sys_enter_openat:k,1:1:hp", |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 1412 | .check = test__checkevent_list, |
Alexander Yarygin | 615b8f9 | 2014-04-25 17:34:06 +0200 | [diff] [blame] | 1413 | .id = 23, |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 1414 | }, |
Alexander Yarygin | 615b8f9 | 2014-04-25 17:34:06 +0200 | [diff] [blame] | 1415 | { |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 1416 | .name = "instructions:G", |
| 1417 | .check = test__checkevent_exclude_host_modifier, |
Alexander Yarygin | 615b8f9 | 2014-04-25 17:34:06 +0200 | [diff] [blame] | 1418 | .id = 24, |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 1419 | }, |
Alexander Yarygin | 615b8f9 | 2014-04-25 17:34:06 +0200 | [diff] [blame] | 1420 | { |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 1421 | .name = "instructions:H", |
| 1422 | .check = test__checkevent_exclude_guest_modifier, |
Alexander Yarygin | 615b8f9 | 2014-04-25 17:34:06 +0200 | [diff] [blame] | 1423 | .id = 25, |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 1424 | }, |
Alexander Yarygin | 615b8f9 | 2014-04-25 17:34:06 +0200 | [diff] [blame] | 1425 | { |
Jiri Olsa | 7582732 | 2012-06-29 09:22:54 +0200 | [diff] [blame] | 1426 | .name = "mem:0:rw", |
| 1427 | .check = test__checkevent_breakpoint_rw, |
Alexander Yarygin | 615b8f9 | 2014-04-25 17:34:06 +0200 | [diff] [blame] | 1428 | .id = 26, |
Jiri Olsa | 7582732 | 2012-06-29 09:22:54 +0200 | [diff] [blame] | 1429 | }, |
Alexander Yarygin | 615b8f9 | 2014-04-25 17:34:06 +0200 | [diff] [blame] | 1430 | { |
Jiri Olsa | 7582732 | 2012-06-29 09:22:54 +0200 | [diff] [blame] | 1431 | .name = "mem:0:rw:kp", |
| 1432 | .check = test__checkevent_breakpoint_rw_modifier, |
Alexander Yarygin | 615b8f9 | 2014-04-25 17:34:06 +0200 | [diff] [blame] | 1433 | .id = 27, |
Jiri Olsa | 7582732 | 2012-06-29 09:22:54 +0200 | [diff] [blame] | 1434 | }, |
Alexander Yarygin | 615b8f9 | 2014-04-25 17:34:06 +0200 | [diff] [blame] | 1435 | { |
Jiri Olsa | 905f5ee | 2012-08-08 12:23:52 +0200 | [diff] [blame] | 1436 | .name = "{instructions:k,cycles:upp}", |
| 1437 | .check = test__group1, |
Alexander Yarygin | 615b8f9 | 2014-04-25 17:34:06 +0200 | [diff] [blame] | 1438 | .id = 28, |
Jiri Olsa | 905f5ee | 2012-08-08 12:23:52 +0200 | [diff] [blame] | 1439 | }, |
Alexander Yarygin | 615b8f9 | 2014-04-25 17:34:06 +0200 | [diff] [blame] | 1440 | { |
Jiri Olsa | 905f5ee | 2012-08-08 12:23:52 +0200 | [diff] [blame] | 1441 | .name = "{faults:k,cache-references}:u,cycles:k", |
| 1442 | .check = test__group2, |
Alexander Yarygin | 615b8f9 | 2014-04-25 17:34:06 +0200 | [diff] [blame] | 1443 | .id = 29, |
Jiri Olsa | 905f5ee | 2012-08-08 12:23:52 +0200 | [diff] [blame] | 1444 | }, |
Alexander Yarygin | 615b8f9 | 2014-04-25 17:34:06 +0200 | [diff] [blame] | 1445 | { |
Riku Voipio | 43f322b | 2015-04-16 16:52:53 +0300 | [diff] [blame^] | 1446 | .name = "group1{syscalls:sys_enter_openat:H,cycles:kppp},group2{cycles,1:3}:G,instructions:u", |
Jiri Olsa | 905f5ee | 2012-08-08 12:23:52 +0200 | [diff] [blame] | 1447 | .check = test__group3, |
Alexander Yarygin | 615b8f9 | 2014-04-25 17:34:06 +0200 | [diff] [blame] | 1448 | .id = 30, |
Jiri Olsa | 905f5ee | 2012-08-08 12:23:52 +0200 | [diff] [blame] | 1449 | }, |
Alexander Yarygin | 615b8f9 | 2014-04-25 17:34:06 +0200 | [diff] [blame] | 1450 | { |
Jiri Olsa | 905f5ee | 2012-08-08 12:23:52 +0200 | [diff] [blame] | 1451 | .name = "{cycles:u,instructions:kp}:p", |
| 1452 | .check = test__group4, |
Alexander Yarygin | 615b8f9 | 2014-04-25 17:34:06 +0200 | [diff] [blame] | 1453 | .id = 31, |
Jiri Olsa | 905f5ee | 2012-08-08 12:23:52 +0200 | [diff] [blame] | 1454 | }, |
Alexander Yarygin | 615b8f9 | 2014-04-25 17:34:06 +0200 | [diff] [blame] | 1455 | { |
Jiri Olsa | 905f5ee | 2012-08-08 12:23:52 +0200 | [diff] [blame] | 1456 | .name = "{cycles,instructions}:G,{cycles:G,instructions:G},cycles", |
| 1457 | .check = test__group5, |
Alexander Yarygin | 615b8f9 | 2014-04-25 17:34:06 +0200 | [diff] [blame] | 1458 | .id = 32, |
Jiri Olsa | 905f5ee | 2012-08-08 12:23:52 +0200 | [diff] [blame] | 1459 | }, |
Alexander Yarygin | 615b8f9 | 2014-04-25 17:34:06 +0200 | [diff] [blame] | 1460 | { |
Jiri Olsa | 82ce75d | 2012-12-17 14:08:38 +0100 | [diff] [blame] | 1461 | .name = "*:*", |
| 1462 | .check = test__all_tracepoints, |
Alexander Yarygin | 615b8f9 | 2014-04-25 17:34:06 +0200 | [diff] [blame] | 1463 | .id = 33, |
Jiri Olsa | 82ce75d | 2012-12-17 14:08:38 +0100 | [diff] [blame] | 1464 | }, |
Alexander Yarygin | 615b8f9 | 2014-04-25 17:34:06 +0200 | [diff] [blame] | 1465 | { |
Jiri Olsa | 5a30a99 | 2013-02-04 10:56:43 +0100 | [diff] [blame] | 1466 | .name = "{cycles,cache-misses:G}:H", |
| 1467 | .check = test__group_gh1, |
Alexander Yarygin | 615b8f9 | 2014-04-25 17:34:06 +0200 | [diff] [blame] | 1468 | .id = 34, |
Jiri Olsa | 5a30a99 | 2013-02-04 10:56:43 +0100 | [diff] [blame] | 1469 | }, |
Alexander Yarygin | 615b8f9 | 2014-04-25 17:34:06 +0200 | [diff] [blame] | 1470 | { |
Jiri Olsa | 5a30a99 | 2013-02-04 10:56:43 +0100 | [diff] [blame] | 1471 | .name = "{cycles,cache-misses:H}:G", |
| 1472 | .check = test__group_gh2, |
Alexander Yarygin | 615b8f9 | 2014-04-25 17:34:06 +0200 | [diff] [blame] | 1473 | .id = 35, |
Jiri Olsa | 5a30a99 | 2013-02-04 10:56:43 +0100 | [diff] [blame] | 1474 | }, |
Alexander Yarygin | 615b8f9 | 2014-04-25 17:34:06 +0200 | [diff] [blame] | 1475 | { |
Jiri Olsa | 5a30a99 | 2013-02-04 10:56:43 +0100 | [diff] [blame] | 1476 | .name = "{cycles:G,cache-misses:H}:u", |
| 1477 | .check = test__group_gh3, |
Alexander Yarygin | 615b8f9 | 2014-04-25 17:34:06 +0200 | [diff] [blame] | 1478 | .id = 36, |
Jiri Olsa | 5a30a99 | 2013-02-04 10:56:43 +0100 | [diff] [blame] | 1479 | }, |
Alexander Yarygin | 615b8f9 | 2014-04-25 17:34:06 +0200 | [diff] [blame] | 1480 | { |
Jiri Olsa | 5a30a99 | 2013-02-04 10:56:43 +0100 | [diff] [blame] | 1481 | .name = "{cycles:G,cache-misses:H}:uG", |
| 1482 | .check = test__group_gh4, |
Alexander Yarygin | 615b8f9 | 2014-04-25 17:34:06 +0200 | [diff] [blame] | 1483 | .id = 37, |
Jiri Olsa | 5a30a99 | 2013-02-04 10:56:43 +0100 | [diff] [blame] | 1484 | }, |
Alexander Yarygin | 615b8f9 | 2014-04-25 17:34:06 +0200 | [diff] [blame] | 1485 | { |
Jiri Olsa | a9f93f9 | 2013-02-01 20:37:11 +0100 | [diff] [blame] | 1486 | .name = "{cycles,cache-misses,branch-misses}:S", |
| 1487 | .check = test__leader_sample1, |
Alexander Yarygin | 615b8f9 | 2014-04-25 17:34:06 +0200 | [diff] [blame] | 1488 | .id = 38, |
Jiri Olsa | a9f93f9 | 2013-02-01 20:37:11 +0100 | [diff] [blame] | 1489 | }, |
Alexander Yarygin | 615b8f9 | 2014-04-25 17:34:06 +0200 | [diff] [blame] | 1490 | { |
Jiri Olsa | a9f93f9 | 2013-02-01 20:37:11 +0100 | [diff] [blame] | 1491 | .name = "{instructions,branch-misses}:Su", |
| 1492 | .check = test__leader_sample2, |
Alexander Yarygin | 615b8f9 | 2014-04-25 17:34:06 +0200 | [diff] [blame] | 1493 | .id = 39, |
Jiri Olsa | a9f93f9 | 2013-02-01 20:37:11 +0100 | [diff] [blame] | 1494 | }, |
Alexander Yarygin | 615b8f9 | 2014-04-25 17:34:06 +0200 | [diff] [blame] | 1495 | { |
Michael Ellerman | c9ee780 | 2013-08-06 23:28:06 +1000 | [diff] [blame] | 1496 | .name = "instructions:uDp", |
| 1497 | .check = test__checkevent_pinned_modifier, |
Alexander Yarygin | 615b8f9 | 2014-04-25 17:34:06 +0200 | [diff] [blame] | 1498 | .id = 40, |
Michael Ellerman | c9ee780 | 2013-08-06 23:28:06 +1000 | [diff] [blame] | 1499 | }, |
Alexander Yarygin | 615b8f9 | 2014-04-25 17:34:06 +0200 | [diff] [blame] | 1500 | { |
Michael Ellerman | c9ee780 | 2013-08-06 23:28:06 +1000 | [diff] [blame] | 1501 | .name = "{cycles,cache-misses,branch-misses}:D", |
| 1502 | .check = test__pinned_group, |
Alexander Yarygin | 615b8f9 | 2014-04-25 17:34:06 +0200 | [diff] [blame] | 1503 | .id = 41, |
Michael Ellerman | c9ee780 | 2013-08-06 23:28:06 +1000 | [diff] [blame] | 1504 | }, |
Jacob Shin | ec32398 | 2014-05-29 17:26:52 +0200 | [diff] [blame] | 1505 | { |
| 1506 | .name = "mem:0/1", |
| 1507 | .check = test__checkevent_breakpoint_len, |
| 1508 | .id = 42, |
| 1509 | }, |
| 1510 | { |
| 1511 | .name = "mem:0/2:w", |
| 1512 | .check = test__checkevent_breakpoint_len_w, |
| 1513 | .id = 43, |
| 1514 | }, |
| 1515 | { |
| 1516 | .name = "mem:0/4:rw:u", |
| 1517 | .check = test__checkevent_breakpoint_len_rw_modifier, |
| 1518 | .id = 44 |
| 1519 | }, |
Alexander Yarygin | c0bc8c6 | 2014-04-25 17:34:07 +0200 | [diff] [blame] | 1520 | #if defined(__s390x__) |
| 1521 | { |
| 1522 | .name = "kvm-s390:kvm_s390_create_vm", |
| 1523 | .check = test__checkevent_tracepoint, |
| 1524 | .id = 100, |
| 1525 | }, |
| 1526 | #endif |
Jiri Olsa | a1e12da | 2015-04-07 23:25:14 +0200 | [diff] [blame] | 1527 | { |
| 1528 | .name = "instructions:I", |
| 1529 | .check = test__checkevent_exclude_idle_modifier, |
| 1530 | .id = 45, |
| 1531 | }, |
| 1532 | { |
| 1533 | .name = "instructions:kIG", |
| 1534 | .check = test__checkevent_exclude_idle_modifier_1, |
| 1535 | .id = 46, |
| 1536 | }, |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 1537 | }; |
| 1538 | |
Arnaldo Carvalho de Melo | 23b6339 | 2013-01-18 16:56:57 -0300 | [diff] [blame] | 1539 | static struct evlist_test test__events_pmu[] = { |
Alexander Yarygin | 615b8f9 | 2014-04-25 17:34:06 +0200 | [diff] [blame] | 1540 | { |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 1541 | .name = "cpu/config=10,config1,config2=3,period=1000/u", |
| 1542 | .check = test__checkevent_pmu, |
Alexander Yarygin | 615b8f9 | 2014-04-25 17:34:06 +0200 | [diff] [blame] | 1543 | .id = 0, |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 1544 | }, |
Alexander Yarygin | 615b8f9 | 2014-04-25 17:34:06 +0200 | [diff] [blame] | 1545 | { |
Jiri Olsa | 6b5fc39 | 2012-05-21 09:12:53 +0200 | [diff] [blame] | 1546 | .name = "cpu/config=1,name=krava/u,cpu/config=2/u", |
| 1547 | .check = test__checkevent_pmu_name, |
Alexander Yarygin | 615b8f9 | 2014-04-25 17:34:06 +0200 | [diff] [blame] | 1548 | .id = 1, |
Jiri Olsa | 6b5fc39 | 2012-05-21 09:12:53 +0200 | [diff] [blame] | 1549 | }, |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 1550 | }; |
| 1551 | |
Arnaldo Carvalho de Melo | 23b6339 | 2013-01-18 16:56:57 -0300 | [diff] [blame] | 1552 | struct terms_test { |
Jiri Olsa | 4429392 | 2012-06-15 14:31:42 +0800 | [diff] [blame] | 1553 | const char *str; |
| 1554 | __u32 type; |
| 1555 | int (*check)(struct list_head *terms); |
| 1556 | }; |
| 1557 | |
Arnaldo Carvalho de Melo | 23b6339 | 2013-01-18 16:56:57 -0300 | [diff] [blame] | 1558 | static struct terms_test test__terms[] = { |
Jiri Olsa | 4429392 | 2012-06-15 14:31:42 +0800 | [diff] [blame] | 1559 | [0] = { |
| 1560 | .str = "config=10,config1,config2=3,umask=1", |
| 1561 | .check = test__checkterms_simple, |
| 1562 | }, |
| 1563 | }; |
| 1564 | |
Arnaldo Carvalho de Melo | 23b6339 | 2013-01-18 16:56:57 -0300 | [diff] [blame] | 1565 | static int test_event(struct evlist_test *e) |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 1566 | { |
| 1567 | struct perf_evlist *evlist; |
| 1568 | int ret; |
| 1569 | |
Namhyung Kim | 334fe7a | 2013-03-11 16:43:12 +0900 | [diff] [blame] | 1570 | evlist = perf_evlist__new(); |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 1571 | if (evlist == NULL) |
| 1572 | return -ENOMEM; |
| 1573 | |
Jiri Olsa | b39b839 | 2015-04-22 21:10:16 +0200 | [diff] [blame] | 1574 | ret = parse_events(evlist, e->name, NULL); |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 1575 | if (ret) { |
| 1576 | pr_debug("failed to parse event '%s', err %d\n", |
| 1577 | e->name, ret); |
Arnaldo Carvalho de Melo | 2d4352c | 2014-01-03 17:30:04 -0300 | [diff] [blame] | 1578 | } else { |
| 1579 | ret = e->check(evlist); |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 1580 | } |
Arnaldo Carvalho de Melo | 48000a1 | 2014-12-17 17:24:45 -0300 | [diff] [blame] | 1581 | |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 1582 | perf_evlist__delete(evlist); |
| 1583 | |
| 1584 | return ret; |
| 1585 | } |
| 1586 | |
Arnaldo Carvalho de Melo | 23b6339 | 2013-01-18 16:56:57 -0300 | [diff] [blame] | 1587 | static int test_events(struct evlist_test *events, unsigned cnt) |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 1588 | { |
Robert Richter | 9bfbbc6 | 2012-08-21 20:03:15 +0200 | [diff] [blame] | 1589 | int ret1, ret2 = 0; |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 1590 | unsigned i; |
| 1591 | |
| 1592 | for (i = 0; i < cnt; i++) { |
Arnaldo Carvalho de Melo | 23b6339 | 2013-01-18 16:56:57 -0300 | [diff] [blame] | 1593 | struct evlist_test *e = &events[i]; |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 1594 | |
Alexander Yarygin | 615b8f9 | 2014-04-25 17:34:06 +0200 | [diff] [blame] | 1595 | pr_debug("running test %d '%s'\n", e->id, e->name); |
Robert Richter | 9bfbbc6 | 2012-08-21 20:03:15 +0200 | [diff] [blame] | 1596 | ret1 = test_event(e); |
| 1597 | if (ret1) |
| 1598 | ret2 = ret1; |
Jiri Olsa | 4429392 | 2012-06-15 14:31:42 +0800 | [diff] [blame] | 1599 | } |
| 1600 | |
Robert Richter | 9bfbbc6 | 2012-08-21 20:03:15 +0200 | [diff] [blame] | 1601 | return ret2; |
Jiri Olsa | 4429392 | 2012-06-15 14:31:42 +0800 | [diff] [blame] | 1602 | } |
| 1603 | |
Arnaldo Carvalho de Melo | 23b6339 | 2013-01-18 16:56:57 -0300 | [diff] [blame] | 1604 | static int test_term(struct terms_test *t) |
Jiri Olsa | 4429392 | 2012-06-15 14:31:42 +0800 | [diff] [blame] | 1605 | { |
David Ahern | c549aca | 2013-07-02 13:27:24 -0600 | [diff] [blame] | 1606 | struct list_head terms; |
Jiri Olsa | 4429392 | 2012-06-15 14:31:42 +0800 | [diff] [blame] | 1607 | int ret; |
| 1608 | |
David Ahern | c549aca | 2013-07-02 13:27:24 -0600 | [diff] [blame] | 1609 | INIT_LIST_HEAD(&terms); |
Jiri Olsa | 4429392 | 2012-06-15 14:31:42 +0800 | [diff] [blame] | 1610 | |
David Ahern | c549aca | 2013-07-02 13:27:24 -0600 | [diff] [blame] | 1611 | ret = parse_events_terms(&terms, t->str); |
Jiri Olsa | 4429392 | 2012-06-15 14:31:42 +0800 | [diff] [blame] | 1612 | if (ret) { |
| 1613 | pr_debug("failed to parse terms '%s', err %d\n", |
| 1614 | t->str , ret); |
| 1615 | return ret; |
| 1616 | } |
| 1617 | |
David Ahern | c549aca | 2013-07-02 13:27:24 -0600 | [diff] [blame] | 1618 | ret = t->check(&terms); |
| 1619 | parse_events__free_terms(&terms); |
Jiri Olsa | 4429392 | 2012-06-15 14:31:42 +0800 | [diff] [blame] | 1620 | |
| 1621 | return ret; |
| 1622 | } |
| 1623 | |
Arnaldo Carvalho de Melo | 23b6339 | 2013-01-18 16:56:57 -0300 | [diff] [blame] | 1624 | static int test_terms(struct terms_test *terms, unsigned cnt) |
Jiri Olsa | 4429392 | 2012-06-15 14:31:42 +0800 | [diff] [blame] | 1625 | { |
| 1626 | int ret = 0; |
| 1627 | unsigned i; |
| 1628 | |
| 1629 | for (i = 0; i < cnt; i++) { |
Arnaldo Carvalho de Melo | 23b6339 | 2013-01-18 16:56:57 -0300 | [diff] [blame] | 1630 | struct terms_test *t = &terms[i]; |
Jiri Olsa | 4429392 | 2012-06-15 14:31:42 +0800 | [diff] [blame] | 1631 | |
| 1632 | pr_debug("running test %d '%s'\n", i, t->str); |
| 1633 | ret = test_term(t); |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 1634 | if (ret) |
| 1635 | break; |
| 1636 | } |
| 1637 | |
| 1638 | return ret; |
| 1639 | } |
| 1640 | |
| 1641 | static int test_pmu(void) |
| 1642 | { |
| 1643 | struct stat st; |
| 1644 | char path[PATH_MAX]; |
| 1645 | int ret; |
| 1646 | |
| 1647 | snprintf(path, PATH_MAX, "%s/bus/event_source/devices/cpu/format/", |
Arnaldo Carvalho de Melo | cf38fad | 2013-11-05 14:48:50 -0300 | [diff] [blame] | 1648 | sysfs__mountpoint()); |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 1649 | |
| 1650 | ret = stat(path, &st); |
| 1651 | if (ret) |
Masanari Iida | 3fd44cd | 2012-07-18 01:20:59 +0900 | [diff] [blame] | 1652 | pr_debug("omitting PMU cpu tests\n"); |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 1653 | return !ret; |
| 1654 | } |
| 1655 | |
Jiri Olsa | 3f3a206 | 2012-10-10 14:53:18 +0200 | [diff] [blame] | 1656 | static int test_pmu_events(void) |
| 1657 | { |
| 1658 | struct stat st; |
| 1659 | char path[PATH_MAX]; |
| 1660 | struct dirent *ent; |
| 1661 | DIR *dir; |
| 1662 | int ret; |
| 1663 | |
| 1664 | snprintf(path, PATH_MAX, "%s/bus/event_source/devices/cpu/events/", |
Arnaldo Carvalho de Melo | cf38fad | 2013-11-05 14:48:50 -0300 | [diff] [blame] | 1665 | sysfs__mountpoint()); |
Jiri Olsa | 3f3a206 | 2012-10-10 14:53:18 +0200 | [diff] [blame] | 1666 | |
| 1667 | ret = stat(path, &st); |
| 1668 | if (ret) { |
Masanari Iida | a895d57 | 2013-04-09 02:06:50 +0900 | [diff] [blame] | 1669 | pr_debug("omitting PMU cpu events tests\n"); |
Jiri Olsa | 3f3a206 | 2012-10-10 14:53:18 +0200 | [diff] [blame] | 1670 | return 0; |
| 1671 | } |
| 1672 | |
| 1673 | dir = opendir(path); |
| 1674 | if (!dir) { |
| 1675 | pr_debug("can't open pmu event dir"); |
| 1676 | return -1; |
| 1677 | } |
| 1678 | |
| 1679 | while (!ret && (ent = readdir(dir))) { |
| 1680 | #define MAX_NAME 100 |
Arnaldo Carvalho de Melo | 23b6339 | 2013-01-18 16:56:57 -0300 | [diff] [blame] | 1681 | struct evlist_test e; |
Jiri Olsa | 3f3a206 | 2012-10-10 14:53:18 +0200 | [diff] [blame] | 1682 | char name[MAX_NAME]; |
| 1683 | |
| 1684 | if (!strcmp(ent->d_name, ".") || |
| 1685 | !strcmp(ent->d_name, "..")) |
| 1686 | continue; |
| 1687 | |
| 1688 | snprintf(name, MAX_NAME, "cpu/event=%s/u", ent->d_name); |
| 1689 | |
| 1690 | e.name = name; |
| 1691 | e.check = test__checkevent_pmu_events; |
| 1692 | |
| 1693 | ret = test_event(&e); |
Kan Liang | ffe5978 | 2014-10-07 11:08:52 -0400 | [diff] [blame] | 1694 | if (ret) |
| 1695 | break; |
| 1696 | snprintf(name, MAX_NAME, "%s:u,cpu/event=%s/u", ent->d_name, ent->d_name); |
| 1697 | e.name = name; |
| 1698 | e.check = test__checkevent_pmu_events_mix; |
| 1699 | ret = test_event(&e); |
Jiri Olsa | 3f3a206 | 2012-10-10 14:53:18 +0200 | [diff] [blame] | 1700 | #undef MAX_NAME |
| 1701 | } |
| 1702 | |
| 1703 | closedir(dir); |
| 1704 | return ret; |
| 1705 | } |
| 1706 | |
Jiri Olsa | c81251e | 2012-11-10 01:46:51 +0100 | [diff] [blame] | 1707 | int test__parse_events(void) |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 1708 | { |
Robert Richter | 9bfbbc6 | 2012-08-21 20:03:15 +0200 | [diff] [blame] | 1709 | int ret1, ret2 = 0; |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 1710 | |
Jiri Olsa | ebf124f | 2012-07-04 00:00:47 +0200 | [diff] [blame] | 1711 | #define TEST_EVENTS(tests) \ |
| 1712 | do { \ |
Robert Richter | 9bfbbc6 | 2012-08-21 20:03:15 +0200 | [diff] [blame] | 1713 | ret1 = test_events(tests, ARRAY_SIZE(tests)); \ |
| 1714 | if (!ret2) \ |
| 1715 | ret2 = ret1; \ |
Jiri Olsa | ebf124f | 2012-07-04 00:00:47 +0200 | [diff] [blame] | 1716 | } while (0) |
Jiri Olsa | 4429392 | 2012-06-15 14:31:42 +0800 | [diff] [blame] | 1717 | |
Jiri Olsa | ebf124f | 2012-07-04 00:00:47 +0200 | [diff] [blame] | 1718 | TEST_EVENTS(test__events); |
Jiri Olsa | 4429392 | 2012-06-15 14:31:42 +0800 | [diff] [blame] | 1719 | |
Jiri Olsa | ebf124f | 2012-07-04 00:00:47 +0200 | [diff] [blame] | 1720 | if (test_pmu()) |
| 1721 | TEST_EVENTS(test__events_pmu); |
Jiri Olsa | 4429392 | 2012-06-15 14:31:42 +0800 | [diff] [blame] | 1722 | |
Jiri Olsa | 3f3a206 | 2012-10-10 14:53:18 +0200 | [diff] [blame] | 1723 | if (test_pmu()) { |
| 1724 | int ret = test_pmu_events(); |
| 1725 | if (ret) |
| 1726 | return ret; |
| 1727 | } |
| 1728 | |
Robert Richter | 9bfbbc6 | 2012-08-21 20:03:15 +0200 | [diff] [blame] | 1729 | ret1 = test_terms(test__terms, ARRAY_SIZE(test__terms)); |
| 1730 | if (!ret2) |
| 1731 | ret2 = ret1; |
| 1732 | |
| 1733 | return ret2; |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 1734 | } |