[PATCH v2 0/4] perf inject improvements

Ian Rogers posted 4 patches 2 months, 3 weeks ago
tools/perf/builtin-inject.c         | 304 +++++++++++++++++++++++-----
tools/perf/tests/shell/pipe_test.sh |   2 +
tools/perf/util/build-id.c          |   6 +-
tools/perf/util/callchain.c         |   8 +-
tools/perf/util/callchain.h         |   2 +-
tools/perf/util/machine.c           |  92 +++++----
tools/perf/util/machine.h           |  33 ++-
tools/perf/util/map.c               |   1 +
tools/perf/util/map.h               |  11 +
tools/perf/util/synthetic-events.c  | 101 +++++++--
tools/perf/util/synthetic-events.h  |  21 +-
11 files changed, 468 insertions(+), 113 deletions(-)
[PATCH v2 0/4] perf inject improvements
Posted by Ian Rogers 2 months, 3 weeks ago
Fix the existing build id injection by adding sample IDs on to the
synthesized events. This correctly orders the events and addresses
issues such as a profiled executable being replaced during its
execution.

Add a new --mmap2-buildid-all option that rewrites all mmap events as
mmap2 events containing build IDs. This removes the need for build_id
events.

Add a new -B option that like --mmap2-buildid-all synthesizes mmap2
with build id events. With -B the behavior is to do it lazily, so only
when a sample references the particular map. With system wide
profiling that synthesizes mmap events for all running processes the
perf.data file savings can be greater than 50%.

Reduce the memory footprint of perf inject by avoiding creating
symbols in the callchain, the symbols aren't used during perf inject
and necessitate the loading of dsos.

v2: Rename dso__inject* functions to tool__inject* addressing feedback
    from Arnaldo and a suggestion from Namhyung that the name should
    reflect the first argument's type. Rebase, in particular over the
    perf inject pipe mode fixes. Add Namhyung's acked-by.

Ian Rogers (4):
  perf inject: Fix build ID injection
  perf inject: Add new mmap2-buildid-all option
  perf inject: Lazy build-id mmap2 event insertion
  perf callchain: Allow symbols to be optional when resolving a
    callchain

 tools/perf/builtin-inject.c         | 304 +++++++++++++++++++++++-----
 tools/perf/tests/shell/pipe_test.sh |   2 +
 tools/perf/util/build-id.c          |   6 +-
 tools/perf/util/callchain.c         |   8 +-
 tools/perf/util/callchain.h         |   2 +-
 tools/perf/util/machine.c           |  92 +++++----
 tools/perf/util/machine.h           |  33 ++-
 tools/perf/util/map.c               |   1 +
 tools/perf/util/map.h               |  11 +
 tools/perf/util/synthetic-events.c  | 101 +++++++--
 tools/perf/util/synthetic-events.h  |  21 +-
 11 files changed, 468 insertions(+), 113 deletions(-)

-- 
2.46.0.598.g6f2099f65c-goog
Re: [PATCH v2 0/4] perf inject improvements
Posted by Arnaldo Carvalho de Melo 2 months, 2 weeks ago
On Mon, Sep 09, 2024 at 01:37:36PM -0700, Ian Rogers wrote:
> Fix the existing build id injection by adding sample IDs on to the
> synthesized events. This correctly orders the events and addresses
> issues such as a profiled executable being replaced during its
> execution.
> 
> Add a new --mmap2-buildid-all option that rewrites all mmap events as
> mmap2 events containing build IDs. This removes the need for build_id
> events.


Thanks, applied to perf-tools-next,

- Arnaldo