aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-record.c
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2010-04-27 20:17:50 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2010-04-27 20:17:50 -0400
commit23346f21b277e3aae5e9989e711a11cbe8133a45 (patch)
tree21f11a72cf21d4eb3d824f46e274dc8f9815d749 /tools/perf/builtin-record.c
parent462b04e28a7ec1339c892117c3f20a40e55d0e83 (diff)
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: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/builtin-record.c')
-rw-r--r--tools/perf/builtin-record.c36
1 files changed, 17 insertions, 19 deletions
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 27f992aca8b5..83b308a035c2 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -456,14 +456,14 @@ static void atexit_header(void)
456 } 456 }
457} 457}
458 458
459static void event__synthesize_guest_os(struct kernel_info *kerninfo, 459static void event__synthesize_guest_os(struct machine *machine, void *data)
460 void *data __attribute__((unused)))
461{ 460{
462 int err; 461 int err;
463 char *guest_kallsyms; 462 char *guest_kallsyms;
464 char path[PATH_MAX]; 463 char path[PATH_MAX];
464 struct perf_session *psession = data;
465 465
466 if (is_host_kernel(kerninfo)) 466 if (machine__is_host(machine))
467 return; 467 return;
468 468
469 /* 469 /*
@@ -475,16 +475,15 @@ static void event__synthesize_guest_os(struct kernel_info *kerninfo,
475 *in module instead of in guest kernel. 475 *in module instead of in guest kernel.
476 */ 476 */
477 err = event__synthesize_modules(process_synthesized_event, 477 err = event__synthesize_modules(process_synthesized_event,
478 session, 478 psession, machine);
479 kerninfo);
480 if (err < 0) 479 if (err < 0)
481 pr_err("Couldn't record guest kernel [%d]'s reference" 480 pr_err("Couldn't record guest kernel [%d]'s reference"
482 " relocation symbol.\n", kerninfo->pid); 481 " relocation symbol.\n", machine->pid);
483 482
484 if (is_default_guest(kerninfo)) 483 if (machine__is_default_guest(machine))
485 guest_kallsyms = (char *) symbol_conf.default_guest_kallsyms; 484 guest_kallsyms = (char *) symbol_conf.default_guest_kallsyms;
486 else { 485 else {
487 sprintf(path, "%s/proc/kallsyms", kerninfo->root_dir); 486 sprintf(path, "%s/proc/kallsyms", machine->root_dir);
488 guest_kallsyms = path; 487 guest_kallsyms = path;
489 } 488 }
490 489
@@ -493,13 +492,13 @@ static void event__synthesize_guest_os(struct kernel_info *kerninfo,
493 * have no _text sometimes. 492 * have no _text sometimes.
494 */ 493 */
495 err = event__synthesize_kernel_mmap(process_synthesized_event, 494 err = event__synthesize_kernel_mmap(process_synthesized_event,
496 session, kerninfo, "_text"); 495 psession, machine, "_text");
497 if (err < 0) 496 if (err < 0)
498 err = event__synthesize_kernel_mmap(process_synthesized_event, 497 err = event__synthesize_kernel_mmap(process_synthesized_event,
499 session, kerninfo, "_stext"); 498 psession, machine, "_stext");
500 if (err < 0) 499 if (err < 0)
501 pr_err("Couldn't record guest kernel [%d]'s reference" 500 pr_err("Couldn't record guest kernel [%d]'s reference"
502 " relocation symbol.\n", kerninfo->pid); 501 " relocation symbol.\n", machine->pid);
503} 502}
504 503
505static int __cmd_record(int argc, const char **argv) 504static int __cmd_record(int argc, const char **argv)
@@ -513,7 +512,7 @@ static int __cmd_record(int argc, const char **argv)
513 int child_ready_pipe[2], go_pipe[2]; 512 int child_ready_pipe[2], go_pipe[2];
514 const bool forks = argc > 0; 513 const bool forks = argc > 0;
515 char buf; 514 char buf;
516 struct kernel_info *kerninfo; 515 struct machine *machine;
517 516
518 page_size = sysconf(_SC_PAGE_SIZE); 517 page_size = sysconf(_SC_PAGE_SIZE);
519 518
@@ -682,31 +681,30 @@ static int __cmd_record(int argc, const char **argv)
682 advance_output(err); 681 advance_output(err);
683 } 682 }
684 683
685 kerninfo = kerninfo__findhost(&session->kerninfo_root); 684 machine = perf_session__find_host_machine(session);
686 if (!kerninfo) { 685 if (!machine) {
687 pr_err("Couldn't find native kernel information.\n"); 686 pr_err("Couldn't find native kernel information.\n");
688 return -1; 687 return -1;
689 } 688 }
690 689
691 err = event__synthesize_kernel_mmap(process_synthesized_event, 690 err = event__synthesize_kernel_mmap(process_synthesized_event,
692 session, kerninfo, "_text"); 691 session, machine, "_text");
693 if (err < 0) 692 if (err < 0)
694 err = event__synthesize_kernel_mmap(process_synthesized_event, 693 err = event__synthesize_kernel_mmap(process_synthesized_event,
695 session, kerninfo, "_stext"); 694 session, machine, "_stext");
696 if (err < 0) { 695 if (err < 0) {
697 pr_err("Couldn't record kernel reference relocation symbol.\n"); 696 pr_err("Couldn't record kernel reference relocation symbol.\n");
698 return err; 697 return err;
699 } 698 }
700 699
701 err = event__synthesize_modules(process_synthesized_event, 700 err = event__synthesize_modules(process_synthesized_event,
702 session, kerninfo); 701 session, machine);
703 if (err < 0) { 702 if (err < 0) {
704 pr_err("Couldn't record kernel reference relocation symbol.\n"); 703 pr_err("Couldn't record kernel reference relocation symbol.\n");
705 return err; 704 return err;
706 } 705 }
707 if (perf_guest) 706 if (perf_guest)
708 kerninfo__process_allkernels(&session->kerninfo_root, 707 perf_session__process_machines(session, event__synthesize_guest_os);
709 event__synthesize_guest_os, session);
710 708
711 if (!system_wide && profile_cpu == -1) 709 if (!system_wide && profile_cpu == -1)
712 event__synthesize_thread(target_tid, process_synthesized_event, 710 event__synthesize_thread(target_tid, process_synthesized_event,