Commit 8ceb41d7 authored by Jiri Olsa's avatar Jiri Olsa Committed by Arnaldo Carvalho de Melo
Browse files

perf tools: Rename struct perf_data_file to perf_data



Rename struct perf_data_file to perf_data, because we will add the
possibility to have multiple files under perf.data, so the 'perf_data'
name fits better.

Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: Changbin Du <changbin.du@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jin Yao <yao.jin@linux.intel.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-39wn4d77phel3dgkzo3lyan0@git.kernel.org


[ Fixup recent changes in 'perf script --per-event-dump' ]
Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 642ee1c6
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -356,7 +356,7 @@ static int __cmd_annotate(struct perf_annotate *ann)
	}

	if (total_nr_samples == 0) {
		ui__error("The %s file has no samples!\n", session->file->path);
		ui__error("The %s file has no samples!\n", session->data->path);
		goto out;
	}

@@ -400,7 +400,7 @@ int cmd_annotate(int argc, const char **argv)
			.ordering_requires_timestamps = true,
		},
	};
	struct perf_data_file file = {
	struct perf_data data = {
		.mode  = PERF_DATA_MODE_READ,
	};
	struct option options[] = {
@@ -410,7 +410,7 @@ int cmd_annotate(int argc, const char **argv)
		   "only consider symbols in these dsos"),
	OPT_STRING('s', "symbol", &annotate.sym_hist_filter, "symbol",
		    "symbol to annotate"),
	OPT_BOOLEAN('f', "force", &file.force, "don't complain, do it"),
	OPT_BOOLEAN('f', "force", &data.force, "don't complain, do it"),
	OPT_INCR('v', "verbose", &verbose,
		    "be more verbose (show symbol address, etc)"),
	OPT_BOOLEAN('q', "quiet", &quiet, "do now show any message"),
@@ -482,9 +482,9 @@ int cmd_annotate(int argc, const char **argv)
	if (quiet)
		perf_quiet_option();

	file.path  = input_name;
	data.path  = input_name;

	annotate.session = perf_session__new(&file, false, &annotate.tool);
	annotate.session = perf_session__new(&data, false, &annotate.tool);
	if (annotate.session == NULL)
		return -1;

+4 −4
Original line number Diff line number Diff line
@@ -311,7 +311,7 @@ int cmd_buildid_cache(int argc, const char **argv)
		   *kcore_filename = NULL;
	char sbuf[STRERR_BUFSIZE];

	struct perf_data_file file = {
	struct perf_data data = {
		.mode  = PERF_DATA_MODE_READ,
	};
	struct perf_session *session = NULL;
@@ -352,10 +352,10 @@ int cmd_buildid_cache(int argc, const char **argv)
		nsi = nsinfo__new(ns_id);

	if (missing_filename) {
		file.path = missing_filename;
		file.force = force;
		data.path = missing_filename;
		data.force = force;

		session = perf_session__new(&file, false, NULL);
		session = perf_session__new(&data, false, NULL);
		if (session == NULL)
			return -1;
	}
+4 −4
Original line number Diff line number Diff line
@@ -50,7 +50,7 @@ static bool dso__skip_buildid(struct dso *dso, int with_hits)
static int perf_session__list_build_ids(bool force, bool with_hits)
{
	struct perf_session *session;
	struct perf_data_file file = {
	struct perf_data data = {
		.path  = input_name,
		.mode  = PERF_DATA_MODE_READ,
		.force = force,
@@ -63,7 +63,7 @@ static int perf_session__list_build_ids(bool force, bool with_hits)
	if (filename__fprintf_build_id(input_name, stdout) > 0)
		goto out;

	session = perf_session__new(&file, false, &build_id__mark_dso_hit_ops);
	session = perf_session__new(&data, false, &build_id__mark_dso_hit_ops);
	if (session == NULL)
		return -1;

@@ -71,7 +71,7 @@ static int perf_session__list_build_ids(bool force, bool with_hits)
	 * We take all buildids when the file contains AUX area tracing data
	 * because we do not decode the trace because it would take too long.
	 */
	if (!perf_data_file__is_pipe(&file) &&
	if (!perf_data__is_pipe(&data) &&
	    perf_header__has_feat(&session->header, HEADER_AUXTRACE))
		with_hits = false;

@@ -79,7 +79,7 @@ static int perf_session__list_build_ids(bool force, bool with_hits)
	 * in pipe-mode, the only way to get the buildids is to parse
	 * the record stream. Buildids are stored as RECORD_HEADER_BUILD_ID
	 */
	if (with_hits || perf_data_file__is_pipe(&file))
	if (with_hits || perf_data__is_pipe(&data))
		perf_session__process_events(session);

	perf_session__fprintf_dsos_buildid(session, stdout, dso__skip_buildid, with_hits);
+5 −5
Original line number Diff line number Diff line
@@ -2523,7 +2523,7 @@ static int perf_c2c__report(int argc, const char **argv)
{
	struct perf_session *session;
	struct ui_progress prog;
	struct perf_data_file file = {
	struct perf_data data = {
		.mode = PERF_DATA_MODE_READ,
	};
	char callchain_default_opt[] = CALLCHAIN_DEFAULT_OPT;
@@ -2572,8 +2572,8 @@ static int perf_c2c__report(int argc, const char **argv)
	if (!input_name || !strlen(input_name))
		input_name = "perf.data";

	file.path  = input_name;
	file.force = symbol_conf.force;
	data.path  = input_name;
	data.force = symbol_conf.force;

	err = setup_display(display);
	if (err)
@@ -2591,7 +2591,7 @@ static int perf_c2c__report(int argc, const char **argv)
		goto out;
	}

	session = perf_session__new(&file, 0, &c2c.tool);
	session = perf_session__new(&data, 0, &c2c.tool);
	if (session == NULL) {
		pr_debug("No memory for session\n");
		goto out;
@@ -2611,7 +2611,7 @@ static int perf_c2c__report(int argc, const char **argv)
		goto out_session;

	/* No pipe support at the moment. */
	if (perf_data_file__is_pipe(session->file)) {
	if (perf_data__is_pipe(session->data)) {
		pr_debug("No pipe support at the moment.\n");
		goto out_session;
	}
+9 −9
Original line number Diff line number Diff line
@@ -47,7 +47,7 @@ struct diff_hpp_fmt {

struct data__file {
	struct perf_session	*session;
	struct perf_data_file	file;
	struct perf_data	 data;
	int			 idx;
	struct hists		*hists;
	struct diff_hpp_fmt	 fmt[PERF_HPP_DIFF__MAX_INDEX];
@@ -707,7 +707,7 @@ static void data__fprintf(void)

	data__for_each_file(i, d)
		fprintf(stdout, "#  [%d] %s %s\n",
			d->idx, d->file.path,
			d->idx, d->data.path,
			!d->idx ? "(Baseline)" : "");

	fprintf(stdout, "#\n");
@@ -776,16 +776,16 @@ static int __cmd_diff(void)
	int ret = -EINVAL, i;

	data__for_each_file(i, d) {
		d->session = perf_session__new(&d->file, false, &tool);
		d->session = perf_session__new(&d->data, false, &tool);
		if (!d->session) {
			pr_err("Failed to open %s\n", d->file.path);
			pr_err("Failed to open %s\n", d->data.path);
			ret = -1;
			goto out_delete;
		}

		ret = perf_session__process_events(d->session);
		if (ret) {
			pr_err("Failed to process %s\n", d->file.path);
			pr_err("Failed to process %s\n", d->data.path);
			goto out_delete;
		}

@@ -1286,11 +1286,11 @@ static int data_init(int argc, const char **argv)
		return -ENOMEM;

	data__for_each_file(i, d) {
		struct perf_data_file *file = &d->file;
		struct perf_data *data = &d->data;

		file->path  = use_default ? defaults[i] : argv[i];
		file->mode  = PERF_DATA_MODE_READ,
		file->force = force,
		data->path  = use_default ? defaults[i] : argv[i];
		data->mode  = PERF_DATA_MODE_READ,
		data->force = force,

		d->idx  = i;
	}
Loading