Commit 542b88fd authored by Kan Liang's avatar Kan Liang Committed by Arnaldo Carvalho de Melo
Browse files

perf record: Support new sample type for data page size



Support new sample type PERF_SAMPLE_DATA_PAGE_SIZE for page size.

Add new option --data-page-size to record sample data page size.

Signed-off-by: default avatarKan Liang <kan.liang@linux.intel.com>
Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Stephane Eranian <eranian@google.com>
Cc: Will Deacon <will@kernel.org>
Link: http://lore.kernel.org/lkml/20201130172803.2676-3-kan.liang@linux.intel.com


Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 47d98220
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -293,6 +293,9 @@ OPTIONS
--phys-data::
	Record the sample physical addresses.

--data-page-size::
	Record the sampled data address data page size.

-T::
--timestamp::
	Record the sample timestamps. Use it with 'perf report -D' to see the
+2 −0
Original line number Diff line number Diff line
@@ -2472,6 +2472,8 @@ static struct option __record_options[] = {
	OPT_BOOLEAN('d', "data", &record.opts.sample_address, "Record the sample addresses"),
	OPT_BOOLEAN(0, "phys-data", &record.opts.sample_phys_addr,
		    "Record the sample physical addresses"),
	OPT_BOOLEAN(0, "data-page-size", &record.opts.sample_data_page_size,
		    "Record the sampled data address data page size"),
	OPT_BOOLEAN(0, "sample-cpu", &record.opts.sample_cpu, "Record the sample cpu"),
	OPT_BOOLEAN_SET('T', "timestamp", &record.opts.sample_time,
			&record.opts.sample_time_set,
+1 −0
Original line number Diff line number Diff line
@@ -135,6 +135,7 @@ struct perf_sample {
	u32 raw_size;
	u64 data_src;
	u64 phys_addr;
	u64 data_page_size;
	u64 cgroup;
	u32 flags;
	u16 insn_len;
+9 −0
Original line number Diff line number Diff line
@@ -1188,6 +1188,9 @@ void evsel__config(struct evsel *evsel, struct record_opts *opts,
		evsel__set_sample_bit(evsel, CGROUP);
	}

	if (opts->sample_data_page_size)
		evsel__set_sample_bit(evsel, DATA_PAGE_SIZE);

	if (opts->record_switch_events)
		attr->context_switch = track;

@@ -2355,6 +2358,12 @@ int evsel__parse_sample(struct evsel *evsel, union perf_event *event,
		array++;
	}

	data->data_page_size = 0;
	if (type & PERF_SAMPLE_DATA_PAGE_SIZE) {
		data->data_page_size = *array;
		array++;
	}

	if (type & PERF_SAMPLE_AUX) {
		OVERFLOW_CHECK_u64(array);
		sz = *array++;
+1 −1
Original line number Diff line number Diff line
@@ -35,7 +35,7 @@ static void __p_sample_type(char *buf, size_t size, u64 value)
		bit_name(BRANCH_STACK), bit_name(REGS_USER), bit_name(STACK_USER),
		bit_name(IDENTIFIER), bit_name(REGS_INTR), bit_name(DATA_SRC),
		bit_name(WEIGHT), bit_name(PHYS_ADDR), bit_name(AUX),
		bit_name(CGROUP),
		bit_name(CGROUP), bit_name(DATA_PAGE_SIZE),
		{ .name = NULL, }
	};
#undef bit_name
Loading