Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf tools: Fix legacy events symbol separator parsing

Fixing legacy symbol events parsing. We can't support single slash
separator, like 'cycles/u', because it conflicts with non empty terms,
like 'cycles/period/u'.

Keeping only '//' and ':' separator for these events:
cycles//u
cycles:k

And removing '/' separator support, which is not working
anymore. Also adding automated tests for above events.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20190213123246.4015-5-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Jiri Olsa and committed by
Arnaldo Carvalho de Melo
714a92d8 5ff32883

+32 -2
+30
tools/perf/tests/parse-events.c
··· 1330 1330 return 0; 1331 1331 } 1332 1332 1333 + static int test__sym_event_slash(struct perf_evlist *evlist) 1334 + { 1335 + struct perf_evsel *evsel = perf_evlist__first(evlist); 1336 + 1337 + TEST_ASSERT_VAL("wrong type", evsel->attr.type == PERF_TYPE_HARDWARE); 1338 + TEST_ASSERT_VAL("wrong config", evsel->attr.config == PERF_COUNT_HW_CPU_CYCLES); 1339 + TEST_ASSERT_VAL("wrong exclude_kernel", evsel->attr.exclude_kernel); 1340 + return 0; 1341 + } 1342 + 1343 + static int test__sym_event_dc(struct perf_evlist *evlist) 1344 + { 1345 + struct perf_evsel *evsel = perf_evlist__first(evlist); 1346 + 1347 + TEST_ASSERT_VAL("wrong type", evsel->attr.type == PERF_TYPE_HARDWARE); 1348 + TEST_ASSERT_VAL("wrong config", evsel->attr.config == PERF_COUNT_HW_CPU_CYCLES); 1349 + TEST_ASSERT_VAL("wrong exclude_user", evsel->attr.exclude_user); 1350 + return 0; 1351 + } 1352 + 1333 1353 static int count_tracepoints(void) 1334 1354 { 1335 1355 struct dirent *events_ent; ··· 1690 1670 .name = "cycles/name='COMPLEX_CYCLES_NAME:orig=cycles,desc=chip-clock-ticks'/Duk", 1691 1671 .check = test__checkevent_complex_name, 1692 1672 .id = 53 1673 + }, 1674 + { 1675 + .name = "cycles//u", 1676 + .check = test__sym_event_slash, 1677 + .id = 54, 1678 + }, 1679 + { 1680 + .name = "cycles:k", 1681 + .check = test__sym_event_dc, 1682 + .id = 55, 1693 1683 } 1694 1684 }; 1695 1685
+2 -2
tools/perf/util/parse-events.y
··· 311 311 $$ = list; 312 312 } 313 313 | 314 - value_sym sep_slash_dc 314 + value_sym sep_slash_slash_dc 315 315 { 316 316 struct list_head *list; 317 317 int type = $1 >> 16; ··· 702 702 703 703 sep_dc: ':' | 704 704 705 - sep_slash_dc: '/' | ':' | 705 + sep_slash_slash_dc: '/' '/' | ':' | 706 706 707 707 %% 708 708