diff options
author | Scott Wood <scottwood@freescale.com> | 2014-04-07 23:49:35 (GMT) |
---|---|---|
committer | Scott Wood <scottwood@freescale.com> | 2014-04-07 23:49:35 (GMT) |
commit | 62b8c978ee6b8d135d9e7953221de58000dba986 (patch) | |
tree | 683b04b2e627f6710c22c151b23c8cc9a165315e /tools/perf/builtin-inject.c | |
parent | 78fd82238d0e5716578c326404184a27ba67fd6e (diff) | |
download | linux-fsl-qoriq-62b8c978ee6b8d135d9e7953221de58000dba986.tar.xz |
Rewind v3.13-rc3+ (78fd82238d0e5716) to v3.12
Diffstat (limited to 'tools/perf/builtin-inject.c')
-rw-r--r-- | tools/perf/builtin-inject.c | 46 |
1 files changed, 18 insertions, 28 deletions
diff --git a/tools/perf/builtin-inject.c b/tools/perf/builtin-inject.c index 6a25085..afe377b 100644 --- a/tools/perf/builtin-inject.c +++ b/tools/perf/builtin-inject.c @@ -15,7 +15,6 @@ #include "util/tool.h" #include "util/debug.h" #include "util/build-id.h" -#include "util/data.h" #include "util/parse-options.h" @@ -72,17 +71,12 @@ static int perf_event__repipe_attr(struct perf_tool *tool, union perf_event *event, struct perf_evlist **pevlist) { - struct perf_inject *inject = container_of(tool, struct perf_inject, - tool); int ret; ret = perf_event__process_attr(tool, event, pevlist); if (ret) return ret; - if (!inject->pipe_output) - return 0; - return perf_event__repipe_synth(tool, event); } @@ -106,8 +100,8 @@ static int perf_event__repipe_sample(struct perf_tool *tool, struct perf_evsel *evsel, struct machine *machine) { - if (evsel->handler) { - inject_handler f = evsel->handler; + if (evsel->handler.func) { + inject_handler f = evsel->handler.func; return f(tool, event, sample, evsel, machine); } @@ -167,38 +161,38 @@ static int perf_event__repipe_tracing_data(struct perf_tool *tool, return err; } -static int dso__read_build_id(struct dso *dso) +static int dso__read_build_id(struct dso *self) { - if (dso->has_build_id) + if (self->has_build_id) return 0; - if (filename__read_build_id(dso->long_name, dso->build_id, - sizeof(dso->build_id)) > 0) { - dso->has_build_id = true; + if (filename__read_build_id(self->long_name, self->build_id, + sizeof(self->build_id)) > 0) { + self->has_build_id = true; return 0; } return -1; } -static int dso__inject_build_id(struct dso *dso, struct perf_tool *tool, +static int dso__inject_build_id(struct dso *self, struct perf_tool *tool, struct machine *machine) { u16 misc = PERF_RECORD_MISC_USER; int err; - if (dso__read_build_id(dso) < 0) { - pr_debug("no build_id found for %s\n", dso->long_name); + if (dso__read_build_id(self) < 0) { + pr_debug("no build_id found for %s\n", self->long_name); return -1; } - if (dso->kernel) + if (self->kernel) misc = PERF_RECORD_MISC_KERNEL; - err = perf_event__synthesize_build_id(tool, dso, misc, perf_event__repipe, + err = perf_event__synthesize_build_id(tool, self, misc, perf_event__repipe, machine); if (err) { - pr_err("Can't synthesize build_id event for %s\n", dso->long_name); + pr_err("Can't synthesize build_id event for %s\n", self->long_name); return -1; } @@ -237,7 +231,7 @@ static int perf_event__inject_buildid(struct perf_tool *tool, * account this as unresolved. */ } else { -#ifdef HAVE_LIBELF_SUPPORT +#ifdef LIBELF_SUPPORT pr_warning("no symbols found in %s, maybe " "install a debug package?\n", al.map->dso->long_name); @@ -351,10 +345,6 @@ static int __cmd_inject(struct perf_inject *inject) { struct perf_session *session; int ret = -EINVAL; - struct perf_data_file file = { - .path = inject->input_name, - .mode = PERF_DATA_MODE_READ, - }; signal(SIGINT, sig_handler); @@ -365,7 +355,7 @@ static int __cmd_inject(struct perf_inject *inject) inject->tool.tracing_data = perf_event__repipe_tracing_data; } - session = perf_session__new(&file, true, &inject->tool); + session = perf_session__new(inject->input_name, O_RDONLY, false, true, &inject->tool); if (session == NULL) return -ENOMEM; @@ -383,11 +373,11 @@ static int __cmd_inject(struct perf_inject *inject) if (perf_evsel__check_stype(evsel, PERF_SAMPLE_TID, "TID")) return -EINVAL; - evsel->handler = perf_inject__sched_switch; + evsel->handler.func = perf_inject__sched_switch; } else if (!strcmp(name, "sched:sched_process_exit")) - evsel->handler = perf_inject__sched_process_exit; + evsel->handler.func = perf_inject__sched_process_exit; else if (!strncmp(name, "sched:sched_stat_", 17)) - evsel->handler = perf_inject__sched_stat; + evsel->handler.func = perf_inject__sched_stat; } } |