Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 23346f21 authored by Arnaldo Carvalho de Melo's avatar Arnaldo Carvalho de Melo
Browse files

perf tools: Rename "kernel_info" to "machine"



struct kernel_info and kerninfo__ are too vague, what they really
describe are machines, virtual ones or hosts.

There are more changes to introduce helpers to shorten function calls
and to make more clear what is really being done, but I left that for
subsequent patches.

Cc: Avi Kivity <avi@redhat.com>
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Zhang, Yanmin <yanmin_zhang@linux.intel.com>
LKML-Reference: <new-submission>
Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 462b04e2
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -571,7 +571,7 @@ static int __cmd_annotate(void)
		perf_session__fprintf(session, stdout);

	if (verbose > 2)
		dsos__fprintf(&session->kerninfo_root, stdout);
		dsos__fprintf(&session->machines, stdout);

	perf_session__collapse_resort(&session->hists);
	perf_session__output_resort(&session->hists, session->event_total[0]);
+1 −1
Original line number Diff line number Diff line
@@ -46,7 +46,7 @@ static int __cmd_buildid_list(void)
	if (with_hits)
		perf_session__process_events(session, &build_id__mark_dso_hit_ops);

	dsos__fprintf_buildid(&session->kerninfo_root, stdout, with_hits);
	dsos__fprintf_buildid(&session->machines, stdout, with_hits);

	perf_session__delete(session);
	return err;
+4 −4
Original line number Diff line number Diff line
@@ -352,7 +352,7 @@ static void __print_result(struct rb_root *root, struct perf_session *session,
			   int n_lines, int is_caller)
{
	struct rb_node *next;
	struct kernel_info *kerninfo;
	struct machine *machine;

	printf("%.102s\n", graph_dotted_line);
	printf(" %-34s |",  is_caller ? "Callsite": "Alloc Ptr");
@@ -361,8 +361,8 @@ static void __print_result(struct rb_root *root, struct perf_session *session,

	next = rb_first(root);

	kerninfo = kerninfo__findhost(&session->kerninfo_root);
	if (!kerninfo) {
	machine = perf_session__find_host_machine(session);
	if (!machine) {
		pr_err("__print_result: couldn't find kernel information\n");
		return;
	}
@@ -370,7 +370,7 @@ static void __print_result(struct rb_root *root, struct perf_session *session,
		struct alloc_stat *data = rb_entry(next, struct alloc_stat,
						   node);
		struct symbol *sym = NULL;
		struct map_groups *kmaps = &kerninfo->kmaps;
		struct map_groups *kmaps = &machine->kmaps;
		struct map *map;
		char buf[BUFSIZ];
		u64 addr;
+17 −19
Original line number Diff line number Diff line
@@ -456,14 +456,14 @@ static void atexit_header(void)
	}
}

static void event__synthesize_guest_os(struct kernel_info *kerninfo,
		void *data __attribute__((unused)))
static void event__synthesize_guest_os(struct machine *machine, void *data)
{
	int err;
	char *guest_kallsyms;
	char path[PATH_MAX];
	struct perf_session *psession = data;

	if (is_host_kernel(kerninfo))
	if (machine__is_host(machine))
		return;

	/*
@@ -475,16 +475,15 @@ static void event__synthesize_guest_os(struct kernel_info *kerninfo,
	 *in module instead of in guest kernel.
	 */
	err = event__synthesize_modules(process_synthesized_event,
			session,
			kerninfo);
					psession, machine);
	if (err < 0)
		pr_err("Couldn't record guest kernel [%d]'s reference"
			" relocation symbol.\n", kerninfo->pid);
		       " relocation symbol.\n", machine->pid);

	if (is_default_guest(kerninfo))
	if (machine__is_default_guest(machine))
		guest_kallsyms = (char *) symbol_conf.default_guest_kallsyms;
	else {
		sprintf(path, "%s/proc/kallsyms", kerninfo->root_dir);
		sprintf(path, "%s/proc/kallsyms", machine->root_dir);
		guest_kallsyms = path;
	}

@@ -493,13 +492,13 @@ static void event__synthesize_guest_os(struct kernel_info *kerninfo,
	 * have no _text sometimes.
	 */
	err = event__synthesize_kernel_mmap(process_synthesized_event,
			session, kerninfo, "_text");
					    psession, machine, "_text");
	if (err < 0)
		err = event__synthesize_kernel_mmap(process_synthesized_event,
				session, kerninfo, "_stext");
						    psession, machine, "_stext");
	if (err < 0)
		pr_err("Couldn't record guest kernel [%d]'s reference"
			" relocation symbol.\n", kerninfo->pid);
		       " relocation symbol.\n", machine->pid);
}

static int __cmd_record(int argc, const char **argv)
@@ -513,7 +512,7 @@ static int __cmd_record(int argc, const char **argv)
	int child_ready_pipe[2], go_pipe[2];
	const bool forks = argc > 0;
	char buf;
	struct kernel_info *kerninfo;
	struct machine *machine;

	page_size = sysconf(_SC_PAGE_SIZE);

@@ -682,31 +681,30 @@ static int __cmd_record(int argc, const char **argv)
		advance_output(err);
	}

	kerninfo = kerninfo__findhost(&session->kerninfo_root);
	if (!kerninfo) {
	machine = perf_session__find_host_machine(session);
	if (!machine) {
		pr_err("Couldn't find native kernel information.\n");
		return -1;
	}

	err = event__synthesize_kernel_mmap(process_synthesized_event,
			session, kerninfo, "_text");
					    session, machine, "_text");
	if (err < 0)
		err = event__synthesize_kernel_mmap(process_synthesized_event,
				session, kerninfo, "_stext");
						    session, machine, "_stext");
	if (err < 0) {
		pr_err("Couldn't record kernel reference relocation symbol.\n");
		return err;
	}

	err = event__synthesize_modules(process_synthesized_event,
				session, kerninfo);
					session, machine);
	if (err < 0) {
		pr_err("Couldn't record kernel reference relocation symbol.\n");
		return err;
	}
	if (perf_guest)
		kerninfo__process_allkernels(&session->kerninfo_root,
			event__synthesize_guest_os, session);
		perf_session__process_machines(session, event__synthesize_guest_os);

	if (!system_wide && profile_cpu == -1)
		event__synthesize_thread(target_tid, process_synthesized_event,
+1 −1
Original line number Diff line number Diff line
@@ -313,7 +313,7 @@ static int __cmd_report(void)
		perf_session__fprintf(session, stdout);

	if (verbose > 2)
		dsos__fprintf(&session->kerninfo_root, stdout);
		dsos__fprintf(&session->machines, stdout);

	next = rb_first(&session->stats_by_id);
	while (next) {
Loading