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