Commit cfb104ca authored by Thomas Gleixner's avatar Thomas Gleixner
Browse files

Merge tag 'perf-core-for-mingo-5.4-20190816' of...

Merge tag 'perf-core-for-mingo-5.4-20190816' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux

 into perf/core

Pull perf/core improvements and fixes from Arnaldo:

report/script/trace/top:

  Arnaldo Carvalho de Melo:

  - Allow specifying marker events demarcating when to consider the other events,
    i.e. one now can state something like:

        # perf probe kernel_function
        # perf record -e cycles,probe:kernel_function

    And then, in 'perf script' or 'perf report' say:

        # perf report --switch-on=probe:kernel_function

    And then the cycles event samples will be considered only after we
    find the first probe:kernel_function event.

    There is also --switch-off=event, to make it stop considering events
    out of some window, say to avoid some winding down of a workload.

    The same can be done with the "live mode" tools: 'perf top' and 'perf trace'.

    There are examples in the cset comments showing how to use it with
    SDT events in things like 'systemtap', that have those tracepoint-like
    events for the start/end of passes, etc.

    Another example involves selecting scheduler events + entry/exit of
    a syscall, using the syscalls tracepoints, one can then see the
    scheduler events that take place while that syscall is being processed.

    In the future this should be possible in record/top/trace via eBPF
    where the perf tools would hook into the marker events and enable events
    put in place but not enabled when the on/off conditions are the desired
    ones, reducing the amount of events sampled, but this userspace only
    solution should be good enough for many scenarios.

perf vendor events intel:

  Haiyan Song:

  - Add Tremontx event file v1.02.

unwind:

  John Keeping:

  - Fix callchain unwinding when tid != pid, that was working only for the
    thread group leader.

Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
-----BEGIN PGP SIGNATURE-----

iHUEABYIAB0WIQR2GiIUctdOfX2qHhGyPKLppCJ+JwUCXVcMPgAKCRCyPKLppCJ+
J6ipAP9F5+TitM1zln/wUUP7/Ug4ZPDsdvA+Ggc8x0Ns7URJQwD/RHk43MgDC1fG
VXbpQ7byj339Wo7SpjadzLl9xPlh/Qw=
=IaYE
-----END PGP SIGNATURE-----

commit e2736219
Author: John Keeping <john@metanate.com>
Date:   Thu Aug 15 11:01:46 2019 +0100

    perf unwind: Remove unnecessary test

    If dwarf_callchain_users is false, then unwind__prepare_access() will
    not set unwind_libunwind_ops so the remaining test here is sufficient.

    Signed-off-by: default avatarJohn Keeping <john@metanate.com>
    Reviewed-by: default avatarJiri Olsa <jolsa@kernel.org>
    Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
    Cc: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
    Cc: Namhyung Kim <namhyung@kernel.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: john keeping <john@metanate.com>
    Link: http://lkml.kernel.org/r/20190815100146.28842-3-john@metanate.com


    Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>

diff --git a/tools/perf/util/unwind-libunwind.c b/tools/perf/util/unwind-libunwind.c
index b843f9d0a9ea..6499b22b158b 100644
--- a/tools/perf/util/unwind-libunwind.c
+++ b/tools/perf/util/unwind-libunwind.c
@@ -69,18 +69,12 @@ int unwind__prepare_access(struct map_groups *mg, struct map *map,

 void unwind__flush_access(struct map_groups *mg)
 {
-	if (!dwarf_callchain_users)
-		return;
-
 	if (mg->unwind_libunwind_ops)
 		mg->unwind_libunwind_ops->flush_access(mg);
 }

 void unwind__finish_access(struct map_groups *mg)
 {
-	if (!dwarf_callchain_users)
-		return;
-
 	if (mg->unwind_libunwind_ops)
 		mg->unwind_libunwind_ops->finish_access(mg);
 }
parents 4511708b e2736219
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
@@ -438,6 +438,23 @@ OPTIONS

	  perf report --time 0%-10%,30%-40%

--switch-on EVENT_NAME::
	Only consider events after this event is found.

	This may be interesting to measure a workload only after some initialization
	phase is over, i.e. insert a perf probe at that point and then using this
	option with that probe.

--switch-off EVENT_NAME::
	Stop considering events after this event is found.

--show-on-off-events::
	Show the --switch-on/off events too. This has no effect in 'perf report' now
	but probably we'll make the default not to show the switch-on/off events
        on the --group mode and if there is only one event besides the off/on ones,
	go straight to the histogram browser, just like 'perf report' with no events
	explicitely specified does.

--itrace::
	Options for decoding instruction tracing data. The options are:

+9 −0
Original line number Diff line number Diff line
@@ -417,6 +417,15 @@ include::itrace.txt[]
	For itrace only show specified functions and their callees for
	itrace. Multiple functions can be separated by comma.

--switch-on EVENT_NAME::
	Only consider events after this event is found.

--switch-off EVENT_NAME::
	Stop considering events after this event is found.

--show-on-off-events::
	Show the --switch-on/off events too.

SEE ALSO
--------
linkperf:perf-record[1], linkperf:perf-script-perl[1],
+38 −0
Original line number Diff line number Diff line
@@ -266,6 +266,44 @@ Default is to monitor all CPUS.
	Record events of type PERF_RECORD_NAMESPACES and display it with the
	'cgroup_id' sort key.

--switch-on EVENT_NAME::
	Only consider events after this event is found.

	E.g.:

           Find out where broadcast packets are handled

		perf probe -L icmp_rcv

	   Insert a probe there:

		perf probe icmp_rcv:59

	   Start perf top and ask it to only consider the cycles events when a
           broadcast packet arrives This will show a menu with two entries and
           will start counting when a broadcast packet arrives:

		perf top -e cycles,probe:icmp_rcv --switch-on=probe:icmp_rcv

	   Alternatively one can ask for --group and then two overhead columns
           will appear, the first for cycles and the second for the switch-on event.

		perf top --group -e cycles,probe:icmp_rcv --switch-on=probe:icmp_rcv

	This may be interesting to measure a workload only after some initialization
	phase is over, i.e. insert a perf probe at that point and use the above
	examples replacing probe:icmp_rcv with the just-after-init probe.

--switch-off EVENT_NAME::
	Stop considering events after this event is found.

--show-on-off-events::
	Show the --switch-on/off events too. This has no effect in 'perf top' now
	but probably we'll make the default not to show the switch-on/off events
        on the --group mode and if there is only one event besides the off/on ones,
	go straight to the histogram browser, just like 'perf top' with no events
	explicitely specified does.


INTERACTIVE PROMPTING KEYS
--------------------------
+9 −0
Original line number Diff line number Diff line
@@ -176,6 +176,15 @@ the thread executes on the designated CPUs. Default is to monitor all CPUs.
	only at exit time or when a syscall is interrupted, i.e. in those cases this
	option is equivalent to the number of lines printed.

--switch-on EVENT_NAME::
	Only consider events after this event is found.

--switch-off EVENT_NAME::
	Stop considering events after this event is found.

--show-on-off-events::
	Show the --switch-on/off events too.

--max-stack::
        Set the stack depth limit when parsing the callchain, anything
        beyond the specified depth will be ignored. Note that at this point
+10 −0
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@
#include "util/debug.h"
#include "util/evlist.h"
#include "util/evsel.h"
#include "util/evswitch.h"
#include "util/header.h"
#include "util/session.h"
#include "util/tool.h"
@@ -60,6 +61,7 @@
struct report {
	struct perf_tool	tool;
	struct perf_session	*session;
	struct evswitch		evswitch;
	bool			use_tui, use_gtk, use_stdio;
	bool			show_full_info;
	bool			show_threads;
@@ -243,6 +245,9 @@ static int process_sample_event(struct perf_tool *tool,
		return 0;
	}

	if (evswitch__discard(&rep->evswitch, evsel))
		return 0;

	if (machine__resolve(machine, &al, sample) < 0) {
		pr_debug("problem processing %d event, skipping it.\n",
			 event->header.type);
@@ -1189,6 +1194,7 @@ int cmd_report(int argc, const char **argv)
	OPT_CALLBACK(0, "time-quantum", &symbol_conf.time_quantum, "time (ms|us|ns|s)",
		     "Set time quantum for time sort key (default 100ms)",
		     parse_time_quantum),
	OPTS_EVSWITCH(&report.evswitch),
	OPT_END()
	};
	struct perf_data data = {
@@ -1257,6 +1263,10 @@ repeat:
	if (session == NULL)
		return -1;

	ret = evswitch__init(&report.evswitch, session->evlist, stderr);
	if (ret)
		return ret;

	if (zstd_init(&(session->zstd_data), 0) < 0)
		pr_warning("Decompression initialization failed. Reported data may be incomplete.\n");

Loading