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