Re: [PATCH v2 4/4] Make all print functions receive the fp argument, and opens a dump file in process_event.
From: Jiri Olsa
Date: Tue Oct 03 2017 - 06:43:28 EST
On Tue, Sep 26, 2017 at 02:53:17PM +0800, yuzhoujian wrote:
SNIP
> - perf_event__fprintf(event, stdout);
> + fp = tool->per_event_dump ? per_event_dump_file : stdout;
> + fprint_sample_start(sample, thread, evsel, fp);
> + perf_event__fprintf(event, fp);
> thread__put(thread);
> return 0;
> }
> @@ -2852,6 +2883,8 @@ int cmd_script(int argc, const char **argv)
> file.path = input_name;
> file.force = symbol_conf.force;
>
> + file_name = file.path ? file.path : "perf.data";
you don't need file_name variable, the data file name is
reachable from struct perf_script:
perf_script::session::file
jirka