]> git.baikalelectronics.ru Git - kernel.git/commitdiff
perf trace: Add a strtoul() method to 'struct syscall_arg_fmt'
authorArnaldo Carvalho de Melo <acme@redhat.com>
Wed, 9 Oct 2019 19:06:43 +0000 (16:06 -0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 18 Jan 2023 10:41:28 +0000 (11:41 +0100)
[ Upstream commit 705d953ce45df6ceb02106d4070ac2b59867ced3 ]

This will go from a string to a number, so that filter expressions can
be constructed with strings and then, before applying the tracepoint
filters (or eBPF, in the future) we can map those strings to numbers.

The first one will be for 'msr' tracepoint arguments, but real quickly
we will be able to reuse all strarrays for that.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Brendan Gregg <brendan.d.gregg@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Luis Cláudio Gonçalves <lclaudio@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: https://lkml.kernel.org/n/tip-wgqq48agcgr95b8dmn6fygtr@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Stable-dep-of: 03e9a5d8eb55 ("perf trace: Handle failure when trace point folder is missed")
Signed-off-by: Sasha Levin <sashal@kernel.org>
tools/perf/builtin-trace.c

index 02cf39970ed023f6f11f14d8f9d54596cbeff44a..4cb3252623f5007a0b047184157bf6ebd9065db7 100644 (file)
 # define F_LINUX_SPECIFIC_BASE 1024
 #endif
 
+/*
+ * strtoul: Go from a string to a value, i.e. for msr: MSR_FS_BASE to 0xc0000100
+ */
 struct syscall_arg_fmt {
        size_t     (*scnprintf)(char *bf, size_t size, struct syscall_arg *arg);
+       bool       (*strtoul)(char *bf, size_t size, struct syscall_arg *arg, u64 *val);
        unsigned long (*mask_val)(struct syscall_arg *arg, unsigned long val);
        void       *parm;
        const char *name;
@@ -1515,8 +1519,10 @@ syscall_arg_fmt__init_array(struct syscall_arg_fmt *arg, struct tep_format_field
                } else {
                        struct syscall_arg_fmt *fmt = syscall_arg_fmt__find_by_name(field->name);
 
-                       if (fmt)
+                       if (fmt) {
                                arg->scnprintf = fmt->scnprintf;
+                               arg->strtoul   = fmt->strtoul;
+                       }
                }
        }