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

Commit 3b10ea7f 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/acme/linux

 into perf/urgent

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

 User visible changes:

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

 Infrastructure changes:

  * 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 missing 'struct option' forward declaration (Arnaldo Carvalho de Melo)

  * No need to drag util/cgroup.h into evsel.h (Arnaldo Carvalho de Melo)

Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
parents 691286b5 e8564b71
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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
+1 −0
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@
#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"
+17 −4
Original line number Diff line number Diff line
@@ -44,6 +44,7 @@ enum perf_output_field {
	PERF_OUTPUT_ADDR            = 1U << 10,
	PERF_OUTPUT_SYMOFFSET       = 1U << 11,
	PERF_OUTPUT_SRCLINE         = 1U << 12,
	PERF_OUTPUT_PERIOD          = 1U << 13,
};

struct output_option {
@@ -63,6 +64,7 @@ struct output_option {
	{.str = "addr",  .field = PERF_OUTPUT_ADDR},
	{.str = "symoff", .field = PERF_OUTPUT_SYMOFFSET},
	{.str = "srcline", .field = PERF_OUTPUT_SRCLINE},
	{.str = "period", .field = PERF_OUTPUT_PERIOD},
};

/* default set to maintain compatibility with current format */
@@ -80,7 +82,8 @@ static struct {
		.fields = PERF_OUTPUT_COMM | PERF_OUTPUT_TID |
			      PERF_OUTPUT_CPU | PERF_OUTPUT_TIME |
			      PERF_OUTPUT_EVNAME | PERF_OUTPUT_IP |
				  PERF_OUTPUT_SYM | PERF_OUTPUT_DSO,
			      PERF_OUTPUT_SYM | PERF_OUTPUT_DSO |
			      PERF_OUTPUT_PERIOD,

		.invalid_fields = PERF_OUTPUT_TRACE,
	},
@@ -91,7 +94,8 @@ static struct {
		.fields = PERF_OUTPUT_COMM | PERF_OUTPUT_TID |
			      PERF_OUTPUT_CPU | PERF_OUTPUT_TIME |
			      PERF_OUTPUT_EVNAME | PERF_OUTPUT_IP |
				  PERF_OUTPUT_SYM | PERF_OUTPUT_DSO,
			      PERF_OUTPUT_SYM | PERF_OUTPUT_DSO |
			      PERF_OUTPUT_PERIOD,

		.invalid_fields = PERF_OUTPUT_TRACE,
	},
@@ -110,7 +114,8 @@ static struct {
		.fields = PERF_OUTPUT_COMM | PERF_OUTPUT_TID |
			      PERF_OUTPUT_CPU | PERF_OUTPUT_TIME |
			      PERF_OUTPUT_EVNAME | PERF_OUTPUT_IP |
				  PERF_OUTPUT_SYM | PERF_OUTPUT_DSO,
			      PERF_OUTPUT_SYM | PERF_OUTPUT_DSO |
			      PERF_OUTPUT_PERIOD,

		.invalid_fields = PERF_OUTPUT_TRACE,
	},
@@ -229,6 +234,11 @@ static int perf_evsel__check_attr(struct perf_evsel *evsel,
					PERF_OUTPUT_CPU))
		return -EINVAL;

	if (PRINT_FIELD(PERIOD) &&
		perf_evsel__check_stype(evsel, PERF_SAMPLE_PERIOD, "PERIOD",
					PERF_OUTPUT_PERIOD))
		return -EINVAL;

	return 0;
}

@@ -448,6 +458,9 @@ static void process_event(union perf_event *event, struct perf_sample *sample,

	print_sample_start(sample, thread, evsel);

	if (PRINT_FIELD(PERIOD))
		printf("%10" PRIu64 " ", sample->period);

	if (PRINT_FIELD(EVNAME)) {
		const char *evname = perf_evsel__name(evsel);
		printf("%s: ", evname ? evname : "[unknown]");
@@ -1543,7 +1556,7 @@ int cmd_script(int argc, const char **argv, const char *prefix __maybe_unused)
		     "comma separated output fields prepend with 'type:'. "
		     "Valid types: hw,sw,trace,raw. "
		     "Fields: comm,tid,pid,time,cpu,event,trace,ip,sym,dso,"
		     "addr,symoff", parse_output_fields),
		     "addr,symoff,period", parse_output_fields),
	OPT_BOOLEAN('a', "all-cpus", &system_wide,
		    "system-wide collection from all CPUs"),
	OPT_STRING('S', "symbols", &symbol_conf.sym_list_str, "symbol[,symbol...]",
+1 −0
Original line number Diff line number Diff line
@@ -43,6 +43,7 @@

#include "perf.h"
#include "builtin.h"
#include "util/cgroup.h"
#include "util/util.h"
#include "util/parse-options.h"
#include "util/parse-events.h"
+2 −0
Original line number Diff line number Diff line
@@ -117,6 +117,8 @@ int perf_evlist__prepare_workload(struct perf_evlist *evlist,
						     void *ucontext));
int perf_evlist__start_workload(struct perf_evlist *evlist);

struct option;

int perf_evlist__parse_mmap_pages(const struct option *opt,
				  const char *str,
				  int unset);
Loading