summaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-inject.c
diff options
context:
space:
mode:
authorJiri Olsa <jolsa@kernel.org>2019-02-21 04:41:30 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2019-02-22 14:52:07 -0500
commit2d4f27999b8877409f326682fd8cc40c52f47cea (patch)
tree33c3e619718d0c75bee39957f6ca4ed70ac59c0d /tools/perf/builtin-inject.c
parent45112e89a8b2b4c9a004147cbfb448b1200cfbf7 (diff)
perf data: Add global path holder
Add a 'path' member to 'struct perf_data'. It will keep the configured path for the data (const char *). The path in struct perf_data_file is now dynamically allocated (duped) from it. This scheme is useful/used in following patches where struct perf_data::path holds the 'configure' directory path and struct perf_data_file::path holds the allocated path for specific files. Also it actually makes the code little simpler. Signed-off-by: Jiri Olsa <jolsa@kernel.org> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Alexey Budankov <alexey.budankov@linux.intel.com> Cc: Andi Kleen <ak@linux.intel.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Link: http://lkml.kernel.org/r/20190221094145.9151-3-jolsa@kernel.org [ Fixup data-convert-bt.c missing conversion ] Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/builtin-inject.c')
-rw-r--r--tools/perf/builtin-inject.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/tools/perf/builtin-inject.c b/tools/perf/builtin-inject.c
index 9bb1f35d5cb7..24086b7f1b14 100644
--- a/tools/perf/builtin-inject.c
+++ b/tools/perf/builtin-inject.c
@@ -770,10 +770,8 @@ int cmd_inject(int argc, const char **argv)
770 .input_name = "-", 770 .input_name = "-",
771 .samples = LIST_HEAD_INIT(inject.samples), 771 .samples = LIST_HEAD_INIT(inject.samples),
772 .output = { 772 .output = {
773 .file = { 773 .path = "-",
774 .path = "-", 774 .mode = PERF_DATA_MODE_WRITE,
775 },
776 .mode = PERF_DATA_MODE_WRITE,
777 }, 775 },
778 }; 776 };
779 struct perf_data data = { 777 struct perf_data data = {
@@ -786,7 +784,7 @@ int cmd_inject(int argc, const char **argv)
786 "Inject build-ids into the output stream"), 784 "Inject build-ids into the output stream"),
787 OPT_STRING('i', "input", &inject.input_name, "file", 785 OPT_STRING('i', "input", &inject.input_name, "file",
788 "input file name"), 786 "input file name"),
789 OPT_STRING('o', "output", &inject.output.file.path, "file", 787 OPT_STRING('o', "output", &inject.output.path, "file",
790 "output file name"), 788 "output file name"),
791 OPT_BOOLEAN('s', "sched-stat", &inject.sched_stat, 789 OPT_BOOLEAN('s', "sched-stat", &inject.sched_stat,
792 "Merge sched-stat and sched-switch for getting events " 790 "Merge sched-stat and sched-switch for getting events "
@@ -834,7 +832,7 @@ int cmd_inject(int argc, const char **argv)
834 832
835 inject.tool.ordered_events = inject.sched_stat; 833 inject.tool.ordered_events = inject.sched_stat;
836 834
837 data.file.path = inject.input_name; 835 data.path = inject.input_name;
838 inject.session = perf_session__new(&data, true, &inject.tool); 836 inject.session = perf_session__new(&data, true, &inject.tool);
839 if (inject.session == NULL) 837 if (inject.session == NULL)
840 return -1; 838 return -1;