Skip to content

Commit

Permalink
Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/…
Browse files Browse the repository at this point in the history
…linux/kernel/git/tip/tip

Pull more perf updates from Ingo Molnar:
 "A second (and last) round of late coming fixes and changes, almost all
  of them in perf tooling:

  User visible tooling changes:

   - Add period data column and make it default in 'perf script' (Jiri
     Olsa)

   - Add a visual cue for toggle zeroing of samples in 'perf top'
     (Taeung Song)

   - Improve callchains when using libunwind (Namhyung Kim)

  Tooling fixes and infrastructure changes:

   - Fix for double free in 'perf stat' when using some specific invalid
     command line combo (Yasser Shalabi)

   - Fix off-by-one bugs in map->end handling (Stephane Eranian)

   - Fix off-by-one bug in maps__find(), also related to map->end
     handling (Namhyung Kim)

   - Make struct symbol->end be the first addr after the symbol range,
     to make it match the convention used for struct map->end.  (Arnaldo
     Carvalho de Melo)

   - Fix perf_evlist__add_pollfd() error handling in 'perf kvm stat
     live' (Jiri Olsa)

   - Fix python test build by moving callchain_param to an object linked
     into the python binding (Jiri Olsa)

   - Document sysfs events/ interfaces (Cody P Schafer)

   - Fix typos in perf/Documentation (Masanari Iida)

   - Add missing 'struct option' forward declaration (Arnaldo Carvalho
     de Melo)

   - Add option to copy events when queuing for sorting across cpu
     buffers and enable it for 'perf kvm stat live', to avoid having
     events left in the queue pointing to the ring buffer be rewritten
     in high volume sessions.  (Alexander Yarygin, improving work done
     by David Ahern):

   - Do not include a struct hists per perf_evsel, untangling the
     histogram code from perf_evsel, to pave the way for exporting a
     minimalistic tools/lib/api/perf/ library usable by tools/perf and
     initially by the rasd daemon being developed by Borislav Petkov,
     Robert Richter and Jean Pihet.  (Arnaldo Carvalho de Melo)

   - Make perf_evlist__open(evlist, NULL, NULL), i.e. without cpu and
     thread maps mean syswide monitoring, reducing the boilerplate for
     tools that only want system wide mode.  (Arnaldo Carvalho de Melo)

   - Move exit stuff from perf_evsel__delete to perf_evsel__exit, delete
     should be just a front end for exit + free (Arnaldo Carvalho de
     Melo)

   - Add support to new style format of kernel PMU event.  (Kan Liang)

  and other misc fixes"

* 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (45 commits)
  perf script: Add period as a default output column
  perf script: Add period data column
  perf evsel: No need to drag util/cgroup.h
  perf evlist: Add missing 'struct option' forward declaration
  perf evsel: Move exit stuff from __delete to __exit
  kprobes/x86: Remove stale ARCH_SUPPORTS_KPROBES_ON_FTRACE define
  perf kvm stat live: Enable events copying
  perf session: Add option to copy events when queueing
  perf Documentation: Fix typos in perf/Documentation
  perf trace: Use thread_{,_set}_priv helpers
  perf kvm: Use thread_{,_set}_priv helpers
  perf callchain: Create an address space per thread
  perf report: Set callchain_param.record_mode for future use
  perf evlist: Fix for double free in tools/perf stat
  perf test: Add test case for pmu event new style format
  perf tools: Add support to new style format of kernel PMU event
  perf tools: Parse the pmu event prefix and suffix
  Revert "perf tools: Default to cpu// for events v5"
  perf Documentation: Remove Ruplicated docs for powerpc cpu specific events
  perf Documentation: sysfs events/ interfaces
  ...
  • Loading branch information
torvalds committed Oct 19, 2014
2 parents 5e2ee7c + 3b10ea7 commit 1f6075f
Show file tree
Hide file tree
Showing 64 changed files with 882 additions and 910 deletions.
611 changes: 49 additions & 562 deletions Documentation/ABI/testing/sysfs-bus-event_source-devices-events

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion arch/x86/include/asm/kprobes.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
#include <asm/insn.h>

#define __ARCH_WANT_KPROBES_INSN_SLOT
#define ARCH_SUPPORTS_KPROBES_ON_FTRACE

struct pt_regs;
struct kprobe;
Expand Down
6 changes: 3 additions & 3 deletions tools/perf/Documentation/perf-diff.txt
Original file line number Diff line number Diff line change
Expand Up @@ -196,10 +196,10 @@ If specified the 'Weighted diff' column is displayed with value 'd' computed as:

- period being the hist entry period value

- WEIGHT-A/WEIGHT-B being user suplied weights in the the '-c' option
- WEIGHT-A/WEIGHT-B being user supplied weights in the the '-c' option
behind ':' separator like '-c wdiff:1,2'.
- WIEGHT-A being the weight of the data file
- WIEGHT-B being the weight of the baseline data file
- WEIGHT-A being the weight of the data file
- WEIGHT-B being the weight of the baseline data file

SEE ALSO
--------
Expand Down
4 changes: 2 additions & 2 deletions tools/perf/Documentation/perf-kvm.txt
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ OPTIONS
STAT REPORT OPTIONS
-------------------
--vcpu=<value>::
analyze events which occures on this vcpu. (default: all vcpus)
analyze events which occur on this vcpu. (default: all vcpus)

--event=<value>::
event to be analyzed. Possible values: vmexit, mmio (x86 only),
Expand Down Expand Up @@ -134,7 +134,7 @@ STAT LIVE OPTIONS
Analyze events only for given process ID(s) (comma separated list).

--vcpu=<value>::
analyze events which occures on this vcpu. (default: all vcpus)
analyze events which occur on this vcpu. (default: all vcpus)


--event=<value>::
Expand Down
2 changes: 1 addition & 1 deletion tools/perf/Documentation/perf-list.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ various perf commands with the -e option.
EVENT MODIFIERS
---------------

Events can optionally have a modifer by appending a colon and one or
Events can optionally have a modifier by appending a colon and one or
more modifiers. Modifiers allow the user to restrict the events to be
counted. The following modifiers exist:

Expand Down
2 changes: 1 addition & 1 deletion tools/perf/Documentation/perf-record.txt
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ the thread executes on the designated CPUs. Default is to monitor all CPUs.

-N::
--no-buildid-cache::
Do not update the builid cache. This saves some overhead in situations
Do not update the buildid cache. This saves some overhead in situations
where the information in the perf.data file (which includes buildids)
is sufficient.

Expand Down
4 changes: 2 additions & 2 deletions tools/perf/Documentation/perf-script-perl.txt
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,8 @@ strings for flag and symbolic fields. These correspond to the strings
and values parsed from the 'print fmt' fields of the event format
files:

flag_str($event_name, $field_name, $field_value) - returns the string represention corresponding to $field_value for the flag field $field_name of event $event_name
symbol_str($event_name, $field_name, $field_value) - returns the string represention corresponding to $field_value for the symbolic field $field_name of event $event_name
flag_str($event_name, $field_name, $field_value) - returns the string representation corresponding to $field_value for the flag field $field_name of event $event_name
symbol_str($event_name, $field_name, $field_value) - returns the string representation corresponding to $field_value for the symbolic field $field_name of event $event_name

Perf::Trace::Context Module
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
6 changes: 3 additions & 3 deletions tools/perf/Documentation/perf-script-python.txt
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ and having the counts we've tallied as values.

The print_syscall_totals() function iterates over the entries in the
dictionary and displays a line for each entry containing the syscall
name (the dictonary keys contain the syscall ids, which are passed to
name (the dictionary keys contain the syscall ids, which are passed to
the Util function syscall_name(), which translates the raw syscall
numbers to the corresponding syscall name strings). The output is
displayed after all the events in the trace have been processed, by
Expand Down Expand Up @@ -576,8 +576,8 @@ strings for flag and symbolic fields. These correspond to the strings
and values parsed from the 'print fmt' fields of the event format
files:

flag_str(event_name, field_name, field_value) - returns the string represention corresponding to field_value for the flag field field_name of event event_name
symbol_str(event_name, field_name, field_value) - returns the string represention corresponding to field_value for the symbolic field field_name of event event_name
flag_str(event_name, field_name, field_value) - returns the string representation corresponding to field_value for the flag field field_name of event event_name
symbol_str(event_name, field_name, field_value) - returns the string representation corresponding to field_value for the symbolic field field_name of event event_name

The *autodict* function returns a special kind of Python
dictionary that implements Perl's 'autovivifying' hashes in Python
Expand Down
4 changes: 2 additions & 2 deletions tools/perf/Documentation/perf-script.txt
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ OPTIONS
-f::
--fields::
Comma separated list of fields to print. Options are:
comm, tid, pid, time, cpu, event, trace, ip, sym, dso, addr, symoff, srcline.
comm, tid, pid, time, cpu, event, trace, ip, sym, dso, addr, symoff, srcline, period.
Field list can be prepended with the type, trace, sw or hw,
to indicate to which event type the field list applies.
e.g., -f sw:comm,tid,time,ip,sym and -f trace:time,cpu,trace
Expand All @@ -140,7 +140,7 @@ OPTIONS

"Overriding previous field request for all events."

Alternativey, consider the order:
Alternatively, consider the order:

-f comm,tid,time,ip,sym -f trace:

Expand Down
2 changes: 1 addition & 1 deletion tools/perf/Documentation/perf-test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ OPTIONS
-------
-s::
--skip::
Tests to skip (comma separater numeric list).
Tests to skip (comma separated numeric list).

-v::
--verbose::
Expand Down
2 changes: 1 addition & 1 deletion tools/perf/Documentation/perf-trace.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ scheduling events, etc.
This is a live mode tool in addition to working with perf.data files like
the other perf tools. Files can be generated using the 'perf record' command
but the session needs to include the raw_syscalls events (-e 'raw_syscalls:*').
Alernatively, the 'perf trace record' can be used as a shortcut to
Alternatively, 'perf trace record' can be used as a shortcut to
automatically include the raw_syscalls events when writing events to a file.

The following options apply to perf trace; options to perf trace record are
Expand Down
14 changes: 9 additions & 5 deletions tools/perf/builtin-annotate.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ static int perf_evsel__add_sample(struct perf_evsel *evsel,
struct addr_location *al,
struct perf_annotate *ann)
{
struct hists *hists = evsel__hists(evsel);
struct hist_entry *he;
int ret;

Expand All @@ -66,13 +67,12 @@ static int perf_evsel__add_sample(struct perf_evsel *evsel,
return 0;
}

he = __hists__add_entry(&evsel->hists, al, NULL, NULL, NULL, 1, 1, 0,
true);
he = __hists__add_entry(hists, al, NULL, NULL, NULL, 1, 1, 0, true);
if (he == NULL)
return -ENOMEM;

ret = hist_entry__inc_addr_samples(he, evsel->idx, al->addr);
hists__inc_nr_samples(&evsel->hists, true);
hists__inc_nr_samples(hists, true);
return ret;
}

Expand Down Expand Up @@ -214,6 +214,7 @@ static int __cmd_annotate(struct perf_annotate *ann)

if (dump_trace) {
perf_session__fprintf_nr_events(session, stdout);
perf_evlist__fprintf_nr_events(session->evlist, stdout);
goto out;
}

Expand All @@ -225,7 +226,7 @@ static int __cmd_annotate(struct perf_annotate *ann)

total_nr_samples = 0;
evlist__for_each(session->evlist, pos) {
struct hists *hists = &pos->hists;
struct hists *hists = evsel__hists(pos);
u32 nr_samples = hists->stats.nr_events[PERF_RECORD_SAMPLE];

if (nr_samples > 0) {
Expand Down Expand Up @@ -325,7 +326,10 @@ int cmd_annotate(int argc, const char **argv, const char *prefix __maybe_unused)
"Show event group information together"),
OPT_END()
};
int ret;
int ret = hists__init();

if (ret < 0)
return ret;

argc = parse_options(argc, argv, options, annotate_usage, 0);

Expand Down
21 changes: 12 additions & 9 deletions tools/perf/builtin-diff.c
Original file line number Diff line number Diff line change
Expand Up @@ -327,14 +327,15 @@ static int diff__process_sample_event(struct perf_tool *tool __maybe_unused,
struct machine *machine)
{
struct addr_location al;
struct hists *hists = evsel__hists(evsel);

if (perf_event__preprocess_sample(event, machine, &al, sample) < 0) {
pr_warning("problem processing %d event, skipping it.\n",
event->header.type);
return -1;
}

if (hists__add_entry(&evsel->hists, &al, sample->period,
if (hists__add_entry(hists, &al, sample->period,
sample->weight, sample->transaction)) {
pr_warning("problem incrementing symbol period, skipping event\n");
return -1;
Expand All @@ -346,9 +347,9 @@ static int diff__process_sample_event(struct perf_tool *tool __maybe_unused,
* hists__output_resort() and precompute needs the total
* period in order to sort entries by percentage delta.
*/
evsel->hists.stats.total_period += sample->period;
hists->stats.total_period += sample->period;
if (!al.filtered)
evsel->hists.stats.total_non_filtered_period += sample->period;
hists->stats.total_non_filtered_period += sample->period;

return 0;
}
Expand Down Expand Up @@ -382,7 +383,7 @@ static void perf_evlist__collapse_resort(struct perf_evlist *evlist)
struct perf_evsel *evsel;

evlist__for_each(evlist, evsel) {
struct hists *hists = &evsel->hists;
struct hists *hists = evsel__hists(evsel);

hists__collapse_resort(hists, NULL);
}
Expand Down Expand Up @@ -631,24 +632,26 @@ static void data_process(void)
bool first = true;

evlist__for_each(evlist_base, evsel_base) {
struct hists *hists_base = evsel__hists(evsel_base);
struct data__file *d;
int i;

data__for_each_file_new(i, d) {
struct perf_evlist *evlist = d->session->evlist;
struct perf_evsel *evsel;
struct hists *hists;

evsel = evsel_match(evsel_base, evlist);
if (!evsel)
continue;

d->hists = &evsel->hists;
hists = evsel__hists(evsel);
d->hists = hists;

hists__match(&evsel_base->hists, &evsel->hists);
hists__match(hists_base, hists);

if (!show_baseline_only)
hists__link(&evsel_base->hists,
&evsel->hists);
hists__link(hists_base, hists);
}

fprintf(stdout, "%s# Event '%s'\n#\n", first ? "" : "\n",
Expand All @@ -659,7 +662,7 @@ static void data_process(void)
if (verbose || data__files_cnt > 2)
data__fprintf();

hists__process(&evsel_base->hists);
hists__process(hists_base);
}
}

Expand Down
29 changes: 11 additions & 18 deletions tools/perf/builtin-kvm.c
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ struct vcpu_event_record *per_vcpu_record(struct thread *thread,
struct perf_sample *sample)
{
/* Only kvm_entry records vcpu id. */
if (!thread->priv && kvm_entry_event(evsel)) {
if (!thread__priv(thread) && kvm_entry_event(evsel)) {
struct vcpu_event_record *vcpu_record;

vcpu_record = zalloc(sizeof(*vcpu_record));
Expand All @@ -386,10 +386,10 @@ struct vcpu_event_record *per_vcpu_record(struct thread *thread,
}

vcpu_record->vcpu_id = perf_evsel__intval(evsel, sample, VCPU_ID);
thread->priv = vcpu_record;
thread__set_priv(thread, vcpu_record);
}

return thread->priv;
return thread__priv(thread);
}

static bool handle_kvm_event(struct perf_kvm_stat *kvm,
Expand Down Expand Up @@ -896,8 +896,7 @@ static int perf_kvm__handle_stdin(void)

static int kvm_events_live_report(struct perf_kvm_stat *kvm)
{
struct pollfd *pollfds = NULL;
int nr_fds, nr_stdin, ret, err = -EINVAL;
int nr_stdin, ret, err = -EINVAL;
struct termios save;

/* live flag must be set first */
Expand All @@ -919,34 +918,27 @@ static int kvm_events_live_report(struct perf_kvm_stat *kvm)
signal(SIGINT, sig_handler);
signal(SIGTERM, sig_handler);

/* use pollfds -- need to add timerfd and stdin */
nr_fds = kvm->evlist->pollfd.nr;

/* add timer fd */
if (perf_kvm__timerfd_create(kvm) < 0) {
err = -1;
goto out;
}

if (perf_evlist__add_pollfd(kvm->evlist, kvm->timerfd))
if (perf_evlist__add_pollfd(kvm->evlist, kvm->timerfd) < 0)
goto out;

nr_fds++;

if (perf_evlist__add_pollfd(kvm->evlist, fileno(stdin)))
nr_stdin = perf_evlist__add_pollfd(kvm->evlist, fileno(stdin));
if (nr_stdin < 0)
goto out;

nr_stdin = nr_fds;
nr_fds++;
if (fd_set_nonblock(fileno(stdin)) != 0)
goto out;

pollfds = kvm->evlist->pollfd.entries;

/* everything is good - enable the events and process */
perf_evlist__enable(kvm->evlist);

while (!done) {
struct fdarray *fda = &kvm->evlist->pollfd;
int rc;

rc = perf_kvm__mmap_read(kvm);
Expand All @@ -957,11 +949,11 @@ static int kvm_events_live_report(struct perf_kvm_stat *kvm)
if (err)
goto out;

if (pollfds[nr_stdin].revents & POLLIN)
if (fda->entries[nr_stdin].revents & POLLIN)
done = perf_kvm__handle_stdin();

if (!rc && !done)
err = poll(pollfds, nr_fds, 100);
err = fdarray__poll(fda, 100);
}

perf_evlist__disable(kvm->evlist);
Expand Down Expand Up @@ -1366,6 +1358,7 @@ static int kvm_events_live(struct perf_kvm_stat *kvm,
}
kvm->session->evlist = kvm->evlist;
perf_session__set_id_hdr_size(kvm->session);
ordered_events__set_copy_on_queue(&kvm->session->ordered_events, true);
machine__synthesize_threads(&kvm->session->machines.host, &kvm->opts.target,
kvm->evlist->threads, false);
err = kvm_live_open_events(kvm);
Expand Down
2 changes: 2 additions & 0 deletions tools/perf/builtin-record.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
#include "util/parse-options.h"
#include "util/parse-events.h"

#include "util/callchain.h"
#include "util/cgroup.h"
#include "util/header.h"
#include "util/event.h"
#include "util/evlist.h"
Expand Down
Loading

0 comments on commit 1f6075f

Please sign in to comment.