Skip to content

Commit

Permalink
Merge tag 'perf-core-for-mingo' of git://git.kernel.org/pub/scm/linux…
Browse files Browse the repository at this point in the history
…/kernel/git/acme/linux into perf/core

Pull perf/core improvements and fixes from Arnaldo Carvalho de Melo:

  * Convert callchain children list to rbtree, greatly reducing the time
    taken for callchain processing, from Namhyung Kim.

  * Add --max-stack option to limit callchain stack scan in 'top' and 'report',
    improving callchain processing when reducing the stack depth is an option,
    from Waiman Long.

  * Compare dso's also when comparing symbols, to avoid grouping together
    symbols with the same name but on different DSOs, fix from Namhyung Kim.

  * 'perf trace' now can can use a 'perf probe' wannabe tracepoint to hook into
    the userspace -> kernel pathname copy so that it can map fds to pathnames
    without reading /proc/pid/fd/ symlinks. From Arnaldo Carvalho de Melo.

  * 'perf trace' now emits hints as to why tracing is not possible, helping the
    user to setup the system to allow tracing in the desired permission
    granularity, telling if the problem is due to debugfs not being mounted or
    with not enough permission for !root, /proc/sys/kernel/perf_event_paranoit
    value, etc. From Arnaldo Carvalho de Melo.

  * Add missing 'mmap2' in evsel debug print, from Adrian Hunter.

  * Add missing decrement in id sample parsing, not a fix per se, just to
    avoid a problem whem somebody adds another field, from Adrian Hunter.

  * Improve write_output error message in 'perf record', from Adrian Hunter.

  * Add missing sample flush for piped events, fix from Adrian Hunter.

  * Add missing members to perf_event__attr_swap(), fix from Adrian Hunter.

  * Assorted fixes for 32-bit build, from Adrian Hunter

  * Print addr by default for BTS in 'perf script', from Adrian Juntmer

  * Separating data file properties from session, code reorganization from
    Jiri Olsa.

  * Show error in 'perf list' if tracepoints not available, from Pekka Enberg.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
  • Loading branch information
Ingo Molnar committed Oct 23, 2013
2 parents 9536c8d + 5dbb6e8 commit aa30a2e
Show file tree
Hide file tree
Showing 42 changed files with 834 additions and 376 deletions.
8 changes: 8 additions & 0 deletions tools/perf/Documentation/perf-report.txt
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,14 @@ OPTIONS

Default: fractal,0.5,callee,function.

--max-stack::
Set the stack depth limit when parsing the callchain, anything
beyond the specified depth will be ignored. This is a trade-off
between information loss and faster processing especially for
workloads that can have a very long callchain stack.

Default: 127

-G::
--inverted::
alias for inverted caller based call graph.
Expand Down
8 changes: 8 additions & 0 deletions tools/perf/Documentation/perf-top.txt
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,14 @@ Default is to monitor all CPUS.

Default: fractal,0.5,callee.

--max-stack::
Set the stack depth limit when parsing the callchain, anything
beyond the specified depth will be ignored. This is a trade-off
between information loss and faster processing especially for
workloads that can have a very long callchain stack.

Default: 127

--ignore-callees=<regex>::
Ignore callees of the function(s) matching the given regex.
This has the effect of collecting the callers of each such
Expand Down
4 changes: 4 additions & 0 deletions tools/perf/Documentation/perf-trace.txt
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,10 @@ the thread executes on the designated CPUs. Default is to monitor all CPUs.
Show a summary of syscalls by thread with min, max, and average times (in
msec) and relative stddev.

--tool_stats::
Show tool stats such as number of times fd->pathname was discovered thru
hooking the open syscall return + vfs_getname or via reading /proc/pid/fd, etc.

SEE ALSO
--------
linkperf:perf-record[1], linkperf:perf-script[1]
1 change: 1 addition & 0 deletions tools/perf/Makefile.perf
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,7 @@ LIB_OBJS += $(OUTPUT)util/vdso.o
LIB_OBJS += $(OUTPUT)util/stat.o
LIB_OBJS += $(OUTPUT)util/record.o
LIB_OBJS += $(OUTPUT)util/srcline.o
LIB_OBJS += $(OUTPUT)util/data.o

LIB_OBJS += $(OUTPUT)ui/setup.o
LIB_OBJS += $(OUTPUT)ui/helpline.o
Expand Down
4 changes: 2 additions & 2 deletions tools/perf/bench/numa.c
Original file line number Diff line number Diff line change
Expand Up @@ -1120,7 +1120,7 @@ static void *worker_thread(void *__tdata)
/* Check whether our max runtime timed out: */
if (g->p.nr_secs) {
timersub(&stop, &start0, &diff);
if (diff.tv_sec >= g->p.nr_secs) {
if ((u32)diff.tv_sec >= g->p.nr_secs) {
g->stop_work = true;
break;
}
Expand Down Expand Up @@ -1167,7 +1167,7 @@ static void *worker_thread(void *__tdata)
runtime_ns_max += diff.tv_usec * 1000;

if (details >= 0) {
printf(" #%2d / %2d: %14.2lf nsecs/op [val: %016lx]\n",
printf(" #%2d / %2d: %14.2lf nsecs/op [val: %016"PRIx64"]\n",
process_nr, thread_nr, runtime_ns_max / bytes_done, val);
}
fflush(stdout);
Expand Down
11 changes: 8 additions & 3 deletions tools/perf/builtin-annotate.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include "util/hist.h"
#include "util/session.h"
#include "util/tool.h"
#include "util/data.h"
#include "arch/common.h"

#include <dlfcn.h>
Expand Down Expand Up @@ -199,9 +200,13 @@ static int __cmd_annotate(struct perf_annotate *ann)
struct perf_session *session;
struct perf_evsel *pos;
u64 total_nr_samples;
struct perf_data_file file = {
.path = input_name,
.mode = PERF_DATA_MODE_READ,
.force = ann->force,
};

session = perf_session__new(input_name, O_RDONLY,
ann->force, false, &ann->tool);
session = perf_session__new(&file, false, &ann->tool);
if (session == NULL)
return -ENOMEM;

Expand Down Expand Up @@ -254,7 +259,7 @@ static int __cmd_annotate(struct perf_annotate *ann)
}

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

Expand Down
8 changes: 6 additions & 2 deletions tools/perf/builtin-buildid-cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,12 @@ static bool dso__missing_buildid_cache(struct dso *dso, int parm __maybe_unused)

static int build_id_cache__fprintf_missing(const char *filename, bool force, FILE *fp)
{
struct perf_session *session = perf_session__new(filename, O_RDONLY,
force, false, NULL);
struct perf_data_file file = {
.path = filename,
.mode = PERF_DATA_MODE_READ,
.force = force,
};
struct perf_session *session = perf_session__new(&file, false, NULL);
if (session == NULL)
return -1;

Expand Down
11 changes: 8 additions & 3 deletions tools/perf/builtin-buildid-list.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include "util/parse-options.h"
#include "util/session.h"
#include "util/symbol.h"
#include "util/data.h"

static int sysfs__fprintf_build_id(FILE *fp)
{
Expand Down Expand Up @@ -52,6 +53,11 @@ 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 = {
.path = input_name,
.mode = PERF_DATA_MODE_READ,
.force = force,
};

symbol__elf_init();
/*
Expand All @@ -60,15 +66,14 @@ static int perf_session__list_build_ids(bool force, bool with_hits)
if (filename__fprintf_build_id(input_name, stdout))
goto out;

session = perf_session__new(input_name, O_RDONLY, force, false,
&build_id__mark_dso_hit_ops);
session = perf_session__new(&file, false, &build_id__mark_dso_hit_ops);
if (session == NULL)
return -1;
/*
* 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 || session->fd_pipe)
if (with_hits || perf_data_file__is_pipe(&file))
perf_session__process_events(session, &build_id__mark_dso_hit_ops);

perf_session__fprintf_dsos_buildid(session, stdout, dso__skip_buildid, with_hits);
Expand Down
19 changes: 12 additions & 7 deletions tools/perf/builtin-diff.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "util/sort.h"
#include "util/symbol.h"
#include "util/util.h"
#include "util/data.h"

#include <stdlib.h>
#include <math.h>
Expand All @@ -42,7 +43,7 @@ struct diff_hpp_fmt {

struct data__file {
struct perf_session *session;
const char *file;
struct perf_data_file file;
int idx;
struct hists *hists;
struct diff_hpp_fmt fmt[PERF_HPP_DIFF__MAX_INDEX];
Expand Down Expand Up @@ -601,7 +602,7 @@ static void data__fprintf(void)

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

fprintf(stdout, "#\n");
Expand Down Expand Up @@ -663,17 +664,16 @@ static int __cmd_diff(void)
int ret = -EINVAL, i;

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

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

Expand Down Expand Up @@ -1016,7 +1016,12 @@ static int data_init(int argc, const char **argv)
return -ENOMEM;

data__for_each_file(i, d) {
d->file = use_default ? defaults[i] : argv[i];
struct perf_data_file *file = &d->file;

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

d->idx = i;
}

Expand Down
7 changes: 6 additions & 1 deletion tools/perf/builtin-evlist.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,18 @@
#include "util/parse-events.h"
#include "util/parse-options.h"
#include "util/session.h"
#include "util/data.h"

static int __cmd_evlist(const char *file_name, struct perf_attr_details *details)
{
struct perf_session *session;
struct perf_evsel *pos;
struct perf_data_file file = {
.path = file_name,
.mode = PERF_DATA_MODE_READ,
};

session = perf_session__new(file_name, O_RDONLY, 0, false, NULL);
session = perf_session__new(&file, 0, NULL);
if (session == NULL)
return -ENOMEM;

Expand Down
7 changes: 6 additions & 1 deletion tools/perf/builtin-inject.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include "util/tool.h"
#include "util/debug.h"
#include "util/build-id.h"
#include "util/data.h"

#include "util/parse-options.h"

Expand Down Expand Up @@ -345,6 +346,10 @@ static int __cmd_inject(struct perf_inject *inject)
{
struct perf_session *session;
int ret = -EINVAL;
struct perf_data_file file = {
.path = inject->input_name,
.mode = PERF_DATA_MODE_READ,
};

signal(SIGINT, sig_handler);

Expand All @@ -355,7 +360,7 @@ static int __cmd_inject(struct perf_inject *inject)
inject->tool.tracing_data = perf_event__repipe_tracing_data;
}

session = perf_session__new(inject->input_name, O_RDONLY, false, true, &inject->tool);
session = perf_session__new(&file, true, &inject->tool);
if (session == NULL)
return -ENOMEM;

Expand Down
7 changes: 6 additions & 1 deletion tools/perf/builtin-kmem.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

#include "util/parse-options.h"
#include "util/trace-event.h"
#include "util/data.h"

#include "util/debug.h"

Expand Down Expand Up @@ -486,8 +487,12 @@ static int __cmd_kmem(void)
{ "kmem:kfree", perf_evsel__process_free_event, },
{ "kmem:kmem_cache_free", perf_evsel__process_free_event, },
};
struct perf_data_file file = {
.path = input_name,
.mode = PERF_DATA_MODE_READ,
};

session = perf_session__new(input_name, O_RDONLY, 0, false, &perf_kmem);
session = perf_session__new(&file, false, &perf_kmem);
if (session == NULL)
return -ENOMEM;

Expand Down
13 changes: 10 additions & 3 deletions tools/perf/builtin-kvm.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "util/tool.h"
#include "util/stat.h"
#include "util/top.h"
#include "util/data.h"

#include <sys/prctl.h>
#include <sys/timerfd.h>
Expand Down Expand Up @@ -1215,10 +1216,13 @@ static int read_events(struct perf_kvm_stat *kvm)
.comm = perf_event__process_comm,
.ordered_samples = true,
};
struct perf_data_file file = {
.path = input_name,
.mode = PERF_DATA_MODE_READ,
};

kvm->tool = eops;
kvm->session = perf_session__new(kvm->file_name, O_RDONLY, 0, false,
&kvm->tool);
kvm->session = perf_session__new(&file, false, &kvm->tool);
if (!kvm->session) {
pr_err("Initializing perf session failed\n");
return -EINVAL;
Expand Down Expand Up @@ -1450,6 +1454,9 @@ static int kvm_events_live(struct perf_kvm_stat *kvm,
"perf kvm stat live [<options>]",
NULL
};
struct perf_data_file file = {
.mode = PERF_DATA_MODE_WRITE,
};


/* event handling */
Expand Down Expand Up @@ -1514,7 +1521,7 @@ static int kvm_events_live(struct perf_kvm_stat *kvm,
/*
* perf session
*/
kvm->session = perf_session__new(NULL, O_WRONLY, false, false, &kvm->tool);
kvm->session = perf_session__new(&file, false, &kvm->tool);
if (kvm->session == NULL) {
err = -ENOMEM;
goto out;
Expand Down
7 changes: 6 additions & 1 deletion tools/perf/builtin-lock.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include "util/debug.h"
#include "util/session.h"
#include "util/tool.h"
#include "util/data.h"

#include <sys/types.h>
#include <sys/prctl.h>
Expand Down Expand Up @@ -853,8 +854,12 @@ static int __cmd_report(bool display_info)
.comm = perf_event__process_comm,
.ordered_samples = true,
};
struct perf_data_file file = {
.path = input_name,
.mode = PERF_DATA_MODE_READ,
};

session = perf_session__new(input_name, O_RDONLY, 0, false, &eops);
session = perf_session__new(&file, false, &eops);
if (!session) {
pr_err("Initializing perf session failed\n");
return -ENOMEM;
Expand Down
9 changes: 7 additions & 2 deletions tools/perf/builtin-mem.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "util/trace-event.h"
#include "util/tool.h"
#include "util/session.h"
#include "util/data.h"

#define MEM_OPERATION_LOAD "load"
#define MEM_OPERATION_STORE "store"
Expand Down Expand Up @@ -119,10 +120,14 @@ static int process_sample_event(struct perf_tool *tool,

static int report_raw_events(struct perf_mem *mem)
{
struct perf_data_file file = {
.path = input_name,
.mode = PERF_DATA_MODE_READ,
};
int err = -EINVAL;
int ret;
struct perf_session *session = perf_session__new(input_name, O_RDONLY,
0, false, &mem->tool);
struct perf_session *session = perf_session__new(&file, false,
&mem->tool);

if (session == NULL)
return -ENOMEM;
Expand Down
Loading

0 comments on commit aa30a2e

Please sign in to comment.