perf parse: Allow tracepoint names to start with digits
authorDominique Martinet <asmadeus@codewreck.org>
Thu, 9 May 2024 22:24:32 +0000 (07:24 +0900)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Fri, 10 May 2024 13:50:34 +0000 (10:50 -0300)
Tracepoints can start with digits, although we don't have many of these:

  $ rg -g '*.h' '\bTRACE_EVENT\([0-9]'
  net/mac802154/trace.h
  53:TRACE_EVENT(802154_drv_return_int,
  ...

  net/ieee802154/trace.h
  66:TRACE_EVENT(802154_rdev_add_virtual_intf,
  ...

  include/trace/events/9p.h
  124:TRACE_EVENT(9p_client_req,
  ...

Just allow names to start with digits too so e.g. "perf trace -e '9p:*'"
works

Reviewed-by: Ian Rogers <irogers@google.com>
Signed-off-by: Dominique Martinet <asmadeus@codewreck.org>
Tested-by: Ian Rogers <irogers@google.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: https://lore.kernel.org/r/20240510-perf_digit-v4-3-db1553f3233b@codewreck.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/tests/parse-events.c
tools/perf/util/parse-events.l

index c3b77570bb57a35a86b2cd5f3a8676f643a9f47d..edc2adcf1baed195da2cfa20795f9121d3266ed4 100644 (file)
@@ -2269,6 +2269,13 @@ static const struct evlist_test test__events[] = {
                .check = test__checkevent_breakpoint_2_events,
                /* 3 */
        },
+#ifdef HAVE_LIBTRACEEVENT
+       {
+               .name = "9p:9p_client_req",
+               .check = test__checkevent_tracepoint,
+               /* 4 */
+       },
+#endif
 };
 
 static const struct evlist_test test__events_pmu[] = {
index 08ea2d845dc361d4137edf4ccf0b2a86367559ee..99d585d272e0877f50026c901df0c750ab33de02 100644 (file)
@@ -242,8 +242,8 @@ event               [^,{}/]+
 num_dec                [0-9]+
 num_hex                0x[a-fA-F0-9]{1,16}
 num_raw_hex    [a-fA-F0-9]{1,16}
-name           [a-zA-Z_*?\[\]][a-zA-Z0-9_*?.\[\]!\-]*
-name_tag       [\'][a-zA-Z_*?\[\]][a-zA-Z0-9_*?\-,\.\[\]:=]*[\']
+name           [a-zA-Z0-9_*?\[\]][a-zA-Z0-9_*?.\[\]!\-]*
+name_tag       [\'][a-zA-Z0-9_*?\[\]][a-zA-Z0-9_*?\-,\.\[\]:=]*[\']
 name_minus     [a-zA-Z_*?][a-zA-Z0-9\-_*?.:]*
 drv_cfg_term   [a-zA-Z0-9_\.]+(=[a-zA-Z0-9_*?\.:]+)?
 /*