Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b3d5fc3c authored by Ingo Molnar's avatar Ingo Molnar
Browse files

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

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

 into perf/core

Pull perf/core improvements and fixes from Jiri Olsa:

User visible changes:

  * Add --percentage option to control absolute/relative percentage output (Namhyung Kim)

Plumbing changes:

  * Add --list-cmds to 'kmem', 'mem', 'lock' and 'sched', for use by completion scripts (Ramkumar Ramachandra)

Signed-off-by: default avatarJiri Olsa <jolsa@redhat.com>
Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
parents fbdd17ec a83edb2d
Loading
Loading
Loading
Loading
+18 −3
Original line number Diff line number Diff line
@@ -33,17 +33,20 @@ OPTIONS
-d::
--dsos=::
	Only consider symbols in these dsos. CSV that understands
	file://filename entries.
	file://filename entries.  This option will affect the percentage
	of the Baseline/Delta column.  See --percentage for more info.

-C::
--comms=::
	Only consider symbols in these comms. CSV that understands
	file://filename entries.
	file://filename entries.  This option will affect the percentage
	of the Baseline/Delta column.  See --percentage for more info.

-S::
--symbols=::
	Only consider these symbols. CSV that understands
	file://filename entries.
	file://filename entries.  This option will affect the percentage
	of the Baseline/Delta column.  See --percentage for more info.

-s::
--sort=::
@@ -89,6 +92,14 @@ OPTIONS
--order::
       Specify compute sorting column number.

--percentage::
	Determine how to display the overhead percentage of filtered entries.
	Filters can be applied by --comms, --dsos and/or --symbols options.

	"relative" means it's relative to filtered entries only so that the
	sum of shown entries will be always 100%.  "absolute" means it retains
	the original value before and after the filter is applied.

COMPARISON
----------
The comparison is governed by the baseline file. The baseline perf.data
@@ -157,6 +168,10 @@ with:
  - period_percent being the % of the hist entry period value within
    single data file

  - with filtering by -C, -d and/or -S, period_percent might be changed
    relative to how entries are filtered.  Use --percentage=absolute to
    prevent such fluctuation.

ratio
~~~~~
If specified the 'Ratio' column is displayed with value 'r' computed as:
+18 −6
Original line number Diff line number Diff line
@@ -25,10 +25,6 @@ OPTIONS
--verbose::
        Be more verbose. (show symbol address, etc)

-d::
--dsos=::
	Only consider symbols in these dsos. CSV that understands
	file://filename entries.
-n::
--show-nr-samples::
	Show the number of samples for each symbol
@@ -42,11 +38,18 @@ OPTIONS
-c::
--comms=::
	Only consider symbols in these comms. CSV that understands
	file://filename entries.
	file://filename entries.  This option will affect the percentage of
	the overhead column.  See --percentage for more info.
-d::
--dsos=::
	Only consider symbols in these dsos. CSV that understands
	file://filename entries.  This option will affect the percentage of
	the overhead column.  See --percentage for more info.
-S::
--symbols=::
	Only consider these symbols. CSV that understands
	file://filename entries.
	file://filename entries.  This option will affect the percentage of
	the overhead column.  See --percentage for more info.

--symbol-filter=::
	Only show symbols that match (partially) with this filter.
@@ -237,6 +240,15 @@ OPTIONS
	Do not show entries which have an overhead under that percent.
	(Default: 0).

--percentage::
	Determine how to display the overhead percentage of filtered entries.
	Filters can be applied by --comms, --dsos and/or --symbols options and
	Zoom operations on the TUI (thread, dso, etc).

	"relative" means it's relative to filtered entries only so that the
	sum of shown entries will be always 100%.  "absolute" means it retains
	the original value before and after the filter is applied.

--header::
	Show header information in the perf.data file.  This includes
	various information like hostname, OS and perf version, cpu/mem
+15 −3
Original line number Diff line number Diff line
@@ -123,13 +123,16 @@ Default is to monitor all CPUS.
	Show a column with the sum of periods.

--dsos::
	Only consider symbols in these dsos.
	Only consider symbols in these dsos.  This option will affect the
	percentage of the overhead column.  See --percentage for more info.

--comms::
	Only consider symbols in these comms.
	Only consider symbols in these comms.  This option will affect the
	percentage of the overhead column.  See --percentage for more info.

--symbols::
	Only consider these symbols.
	Only consider these symbols.  This option will affect the
	percentage of the overhead column.  See --percentage for more info.

-M::
--disassembler-style=:: Set disassembler style for objdump.
@@ -165,6 +168,15 @@ Default is to monitor all CPUS.
	Do not show entries which have an overhead under that percent.
	(Default: 0).

--percentage::
	Determine how to display the overhead percentage of filtered entries.
	Filters can be applied by --comms, --dsos and/or --symbols options and
	Zoom operations on the TUI (thread, dso, etc).

	"relative" means it's relative to filtered entries only so that the
	sum of shown entries will be always 100%. "absolute" means it retains
	the original value before and after the filter is applied.

INTERACTIVE PROMPTING KEYS
--------------------------

+24 −8
Original line number Diff line number Diff line
@@ -220,7 +220,8 @@ static int setup_compute(const struct option *opt, const char *str,

static double period_percent(struct hist_entry *he, u64 period)
{
	u64 total = he->hists->stats.total_period;
	u64 total = hists__total_period(he->hists);

	return (period * 100.0) / total;
}

@@ -259,11 +260,18 @@ static s64 compute_wdiff(struct hist_entry *he, struct hist_entry *pair)
static int formula_delta(struct hist_entry *he, struct hist_entry *pair,
			 char *buf, size_t size)
{
	u64 he_total = he->hists->stats.total_period;
	u64 pair_total = pair->hists->stats.total_period;

	if (symbol_conf.filter_relative) {
		he_total = he->hists->stats.total_non_filtered_period;
		pair_total = pair->hists->stats.total_non_filtered_period;
	}
	return scnprintf(buf, size,
			 "(%" PRIu64 " * 100 / %" PRIu64 ") - "
			 "(%" PRIu64 " * 100 / %" PRIu64 ")",
			  pair->stat.period, pair->hists->stats.total_period,
			  he->stat.period, he->hists->stats.total_period);
			 pair->stat.period, pair_total,
			 he->stat.period, he_total);
}

static int formula_ratio(struct hist_entry *he, struct hist_entry *pair,
@@ -327,15 +335,16 @@ static int diff__process_sample_event(struct perf_tool *tool __maybe_unused,
		return -1;
	}

	if (al.filtered)
		return 0;

	if (hists__add_entry(&evsel->hists, &al, sample->period,
			     sample->weight, sample->transaction)) {
		pr_warning("problem incrementing symbol period, skipping event\n");
		return -1;
	}

	if (al.filtered == 0) {
		evsel->hists.stats.total_non_filtered_period += sample->period;
		evsel->hists.nr_non_filtered_entries++;
	}
	evsel->hists.stats.total_period += sample->period;
	return 0;
}
@@ -565,7 +574,9 @@ static void hists__compute_resort(struct hists *hists)
	next = rb_first(root);

	hists->nr_entries = 0;
	hists->nr_non_filtered_entries = 0;
	hists->stats.total_period = 0;
	hists->stats.total_non_filtered_period = 0;
	hists__reset_col_len(hists);

	while (next != NULL) {
@@ -732,13 +743,16 @@ static const struct option options[] = {
	OPT_STRING(0, "symfs", &symbol_conf.symfs, "directory",
		    "Look for files with symbols relative to this directory"),
	OPT_UINTEGER('o', "order", &sort_compute, "Specify compute sorting."),
	OPT_CALLBACK(0, "percentage", NULL, "relative|absolute",
		     "How to display percentage of filtered entries", parse_filter_percentage),
	OPT_END()
};

static double baseline_percent(struct hist_entry *he)
{
	struct hists *hists = he->hists;
	return 100.0 * he->stat.period / hists->stats.total_period;
	u64 total = hists__total_period(he->hists);

	return 100.0 * he->stat.period / total;
}

static int hpp__color_baseline(struct perf_hpp_fmt *fmt,
@@ -1120,6 +1134,8 @@ static int data_init(int argc, const char **argv)

int cmd_diff(int argc, const char **argv, const char *prefix __maybe_unused)
{
	perf_config(perf_default_config, NULL);

	sort_order = diff__default_sort_order;
	argc = parse_options(argc, argv, options, diff_usage, 0);

+5 −3
Original line number Diff line number Diff line
@@ -756,11 +756,13 @@ int cmd_kmem(int argc, const char **argv, const char *prefix __maybe_unused)
	OPT_BOOLEAN(0, "raw-ip", &raw_ip, "show raw ip instead of symbol"),
	OPT_END()
	};
	const char * const kmem_usage[] = {
		"perf kmem [<options>] {record|stat}",
	const char *const kmem_subcommands[] = { "record", "stat", NULL };
	const char *kmem_usage[] = {
		NULL,
		NULL
	};
	argc = parse_options(argc, argv, kmem_options, kmem_usage, 0);
	argc = parse_options_subcommand(argc, argv, kmem_options,
					kmem_subcommands, kmem_usage, 0);

	if (!argc)
		usage_with_options(kmem_usage, kmem_options);
Loading