Skip to content

Commit

Permalink
Merge branch 'perf' of git://git.kernel.org/pub/scm/linux/kernel/git/…
Browse files Browse the repository at this point in the history
…acme/linux-2.6 into perf/core
  • Loading branch information
Ingo Molnar committed Apr 30, 2010
2 parents 3ca5049 + 1c6a800 commit bc4b473
Show file tree
Hide file tree
Showing 23 changed files with 725 additions and 351 deletions.
22 changes: 22 additions & 0 deletions tools/perf/Documentation/perf-test.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
perf-test(1)
============

NAME
----
perf-test - Runs sanity tests.

SYNOPSIS
--------
[verse]
'perf test <options>'

DESCRIPTION
-----------
This command does assorted sanity tests, initially thru linked routines but
also will look for a directory with more tests in the form of scripts.

OPTIONS
-------
-v::
--verbose::
Be more verbose.
3 changes: 3 additions & 0 deletions tools/perf/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,8 @@ ifeq ($(ARCH),x86_64)
ARCH := x86
endif

$(shell sh -c 'mkdir -p $(OUTPUT)arch/$(ARCH)/util/' 2> /dev/null)

# CFLAGS and LDFLAGS are for the users to override from the command line.

#
Expand Down Expand Up @@ -488,6 +490,7 @@ BUILTIN_OBJS += $(OUTPUT)builtin-probe.o
BUILTIN_OBJS += $(OUTPUT)builtin-kmem.o
BUILTIN_OBJS += $(OUTPUT)builtin-lock.o
BUILTIN_OBJS += $(OUTPUT)builtin-kvm.o
BUILTIN_OBJS += $(OUTPUT)builtin-test.o

PERFLIBS = $(LIB_FILE)

Expand Down
2 changes: 1 addition & 1 deletion tools/perf/builtin-annotate.c
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,7 @@ static int __cmd_annotate(void)
perf_session__fprintf(session, stdout);

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

perf_session__collapse_resort(&session->hists);
perf_session__output_resort(&session->hists, session->event_total[0]);
Expand Down
2 changes: 1 addition & 1 deletion tools/perf/builtin-buildid-list.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
perf_session__fprintf_dsos_buildid(session, stdout, with_hits);

perf_session__delete(session);
return err;
Expand Down
10 changes: 4 additions & 6 deletions tools/perf/builtin-kmem.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -361,25 +361,23 @@ 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;
}
while (next && n_lines--) {
struct alloc_stat *data = rb_entry(next, struct alloc_stat,
node);
struct symbol *sym = NULL;
struct map_groups *kmaps = &kerninfo->kmaps;
struct map *map;
char buf[BUFSIZ];
u64 addr;

if (is_caller) {
addr = data->call_site;
if (!raw_ip)
sym = map_groups__find_function(kmaps, addr,
&map, NULL);
sym = machine__find_kernel_function(machine, addr, &map, NULL);
} else
addr = data->ptr;

Expand Down
36 changes: 17 additions & 19 deletions tools/perf/builtin-record.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/*
Expand All @@ -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;
}

Expand All @@ -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)
Expand All @@ -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);

Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion tools/perf/builtin-report.c
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ static int __cmd_report(void)
perf_session__fprintf(session, stdout);

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

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

0 comments on commit bc4b473

Please sign in to comment.