• Arnaldo Carvalho de Melo's avatar
    perf trace: Introduce a strtoul() method for 'struct strarrays' · d0a3a104
    Arnaldo Carvalho de Melo authored
    And also for 'struct strarray', since its needed to implement
    strarrays__strtoul(). This just traverses the entries and when finding a
    match, returns (offset + index), i.e. the value associated with the
    searched string.
    
    E.g. "EFER" (MSR_EFER) returns:
    
      # grep -w EFER -B2 /tmp/build/perf/trace/beauty/generated/x86_arch_MSRs_array.c
      #define x86_64_specific_MSRs_offset 0xc0000080
      static const char *x86_64_specific_MSRs[] = {
    	[0xc0000080 - x86_64_specific_MSRs_offset] = "EFER",
      #
    
      0xc0000080
    
    This will be auto-attached to 'struct syscall_arg_fmt' entries
    associated with strarrays as soon as we add a ->strarray and ->strarrays
    to 'struct syscall_arg_fmt'.
    
    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-r2hpaahf8lishyb1owko9vs1@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    d0a3a104
builtin-trace.c 135 KB