• Arnaldo Carvalho de Melo's avatar
    perf augmented_syscalls: Switch to using a struct for the syscalls map values · 27f2992e
    Arnaldo Carvalho de Melo authored
    We'll start adding more perf-syscall stuff, so lets do this prep step so
    that the next ones are just about adding more fields.
    
    Run it with the .c file once to cache the .o file:
    
      # trace --filter-pids 2834,2199 -e openat,augmented_raw_syscalls.c
      LLVM: dumping augmented_raw_syscalls.o
           0.000 ( 0.021 ms): tmux: server/4952 openat(dfd: CWD, filename: /proc/5691/cmdline                         ) = 11
         349.807 ( 0.040 ms): DNS Res~er #39/11082 openat(dfd: CWD, filename: /etc/hosts, flags: CLOEXEC                 ) = 44
        4988.759 ( 0.052 ms): gsd-color/2431 openat(dfd: CWD, filename: /etc/localtime                             ) = 18
        4988.976 ( 0.029 ms): gsd-color/2431 openat(dfd: CWD, filename: /etc/localtime                             ) = 18
      ^C[root@quaco bpf]#
    
    From now on, we can use just the newly built .o file, skipping the
    compilation step for a faster startup:
    
      # trace --filter-pids 2834,2199 -e openat,augmented_raw_syscalls.o
           0.000 ( 0.046 ms): DNS Res~er #39/11088 openat(dfd: CWD, filename: /etc/hosts, flags: CLOEXEC                 ) = 44
        1946.408 ( 0.190 ms): systemd/1 openat(dfd: CWD, filename: /proc/1071/cgroup, flags: CLOEXEC          ) = 20
        1946.792 ( 0.215 ms): systemd/1 openat(dfd: CWD, filename: /proc/954/cgroup, flags: CLOEXEC           ) = 20
      ^C#
    
    Now on to do the same in the builtin-trace.c side of things.
    
    Cc: Adrian Hunter <adrian.hunter@intel.com>
    Cc: Jiri Olsa <jolsa@kernel.org>
    Cc: Namhyung Kim <namhyung@kernel.org>
    Link: https://lkml.kernel.org/n/tip-k8mwu04l8es29rje5loq9vg7@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    27f2992e
augmented_raw_syscalls.c 4.49 KB