aboutsummaryrefslogtreecommitdiff
path: root/tools/perf/builtin-annotate.c
diff options
context:
space:
mode:
authorIan Rogers <irogers@google.com>2024-05-03 16:28:49 -0700
committerNamhyung Kim <namhyung@kernel.org>2024-06-10 16:45:10 -0700
commit6828d6929b763499b7a8768c623891f5d4fca258 (patch)
tree4d230dd5574bc3babc22117f0476f9d33f7003ad /tools/perf/builtin-annotate.c
parent658a8805cb604260ae9f35ae5e50012e3d1ed5e3 (diff)
downloadlinux-6828d6929b763499b7a8768c623891f5d4fca258.tar.gz
linux-6828d6929b763499b7a8768c623891f5d4fca258.tar.bz2
linux-6828d6929b763499b7a8768c623891f5d4fca258.zip
perf evsel: Refactor tool events
Tool events unnecessarily open a dummy perf event which is useless even with `perf record` which will still open a dummy event. Change the behavior of tool events so: - duration_time - call `rdclock` on open and then report the count as a delta since the start in evsel__read_counter. This moves code out of builtin-stat making it more general purpose. - user_time/system_time - open the fd as either `/proc/pid/stat` or `/proc/stat` for cases like system wide. evsel__read_counter will read the appropriate field out of the procfs file. These values were previously supplied by wait4, if the procfs read fails then the wait4 values are used, assuming the process/thread terminated. By reading user_time and system_time this way, interval mode, per PID and per CPU can be supported although there are restrictions given what the files provide (e.g. per PID can't be combined with per CPU). Opening any of the tool events for `perf record` is changed to return invalid. Signed-off-by: Ian Rogers <irogers@google.com> Tested-by: Weilin Wang <weilin.wang@intel.com> Cc: Ravi Bangoria <ravi.bangoria@amd.com> Cc: James Clark <james.clark@arm.com> Cc: Dmitrii Dolgov <9erthalion6@gmail.com> Cc: Ze Gao <zegao2021@gmail.com> Cc: Song Liu <song@kernel.org> Cc: Leo Yan <leo.yan@linux.dev> Signed-off-by: Namhyung Kim <namhyung@kernel.org> Link: https://lore.kernel.org/r/20240503232849.17752-1-irogers@google.com
Diffstat (limited to 'tools/perf/builtin-annotate.c')
0 files changed, 0 insertions, 0 deletions