diff options
author | Tom Zanussi <tzanussi@gmail.com> | 2010-05-01 02:41:20 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2010-05-02 12:36:56 -0400 |
commit | 454c407ec17a0c63e4023ac0877d687945a7df4a (patch) | |
tree | 1271299a59a89419c0dd4dcbf29b4492b63555ca /tools/perf/util/session.c | |
parent | 789688faef5b3ba78065beaf2f3d6f1c839f74a3 (diff) |
perf: add perf-inject builtin
Currently, perf 'live mode' writes build-ids at the end of the
session, which isn't actually useful for processing live mode events.
What would be better would be to have the build-ids sent before any of
the samples that reference them, which can be done by processing the
event stream and retrieving the build-ids on the first hit. Doing
that in perf-record itself, however, is off-limits.
This patch introduces perf-inject, which does the same job while
leaving perf-record untouched. Normal mode perf still records the
build-ids at the end of the session as it should, but for live mode,
perf-inject can be injected in between the record and report steps
e.g.:
perf record -o - ./hackbench 10 | perf inject -v -b | perf report -v -i -
perf-inject reads a perf-record event stream and repipes it to stdout.
At any point the processing code can inject other events into the
event stream - in this case build-ids (-b option) are read and
injected as needed into the event stream.
Build-ids are just the first user of perf-inject - potentially
anything that needs userspace processing to augment the trace stream
with additional information could make use of this facility.
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
LKML-Reference: <1272696080-16435-3-git-send-email-tzanussi@gmail.com>
Signed-off-by: Tom Zanussi <tzanussi@gmail.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/session.c')
-rw-r--r-- | tools/perf/util/session.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c index a8dd73ed1581..5d353e70fe26 100644 --- a/tools/perf/util/session.c +++ b/tools/perf/util/session.c | |||
@@ -77,7 +77,7 @@ int perf_session__create_kernel_maps(struct perf_session *self) | |||
77 | return ret; | 77 | return ret; |
78 | } | 78 | } |
79 | 79 | ||
80 | struct perf_session *perf_session__new(const char *filename, int mode, bool force) | 80 | struct perf_session *perf_session__new(const char *filename, int mode, bool force, bool repipe) |
81 | { | 81 | { |
82 | size_t len = filename ? strlen(filename) + 1 : 0; | 82 | size_t len = filename ? strlen(filename) + 1 : 0; |
83 | struct perf_session *self = zalloc(sizeof(*self) + len); | 83 | struct perf_session *self = zalloc(sizeof(*self) + len); |
@@ -97,6 +97,7 @@ struct perf_session *perf_session__new(const char *filename, int mode, bool forc | |||
97 | self->cwdlen = 0; | 97 | self->cwdlen = 0; |
98 | self->unknown_events = 0; | 98 | self->unknown_events = 0; |
99 | self->machines = RB_ROOT; | 99 | self->machines = RB_ROOT; |
100 | self->repipe = repipe; | ||
100 | self->ordered_samples.flush_limit = ULLONG_MAX; | 101 | self->ordered_samples.flush_limit = ULLONG_MAX; |
101 | INIT_LIST_HEAD(&self->ordered_samples.samples_head); | 102 | INIT_LIST_HEAD(&self->ordered_samples.samples_head); |
102 | 103 | ||