perf record: Implement COMPRESSED event record and its attributes

Implemented PERF_RECORD_COMPRESSED event, related data types, header
feature and functions to write, read and print feature attributes from
the trace header section.

comp_mmap_len preserves the size of mmaped kernel buffer that was used
during collection. comp_mmap_len size is used on loading stage as the
size of decomp buffer for decompression of COMPRESSED events content.

Committer notes:

Fixed up conflict with BPF_PROG_INFO and BTF_BTF header features.

Signed-off-by: Alexey Budankov <alexey.budankov@linux.intel.com>
Reviewed-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/ebbaf031-8dda-3864-ebc6-7922d43ee515@linux.intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
Alexey Budankov
2019-03-18 20:41:33 +03:00
committed by Arnaldo Carvalho de Melo
parent d3c8c08e75
commit 42e1fd80a5
8 changed files with 105 additions and 0 deletions

View File

@@ -272,6 +272,19 @@ struct {
Two uint64_t for the time of first sample and the time of last sample.
HEADER_COMPRESSED = 27,
struct {
u32 version;
u32 type;
u32 level;
u32 ratio;
u32 mmap_len;
};
Indicates that trace contains records of PERF_RECORD_COMPRESSED type
that have perf_events records in compressed form.
other bits are reserved and should ignored for now
HEADER_FEAT_BITS = 256,
@@ -437,6 +450,17 @@ struct auxtrace_error_event {
Describes a header feature. These are records used in pipe-mode that
contain information that otherwise would be in perf.data file's header.
PERF_RECORD_COMPRESSED = 81,
struct compressed_event {
struct perf_event_header header;
char data[];
};
The header is followed by compressed data frame that can be decompressed
into array of perf trace records. The size of the entire compressed event
record including the header is limited by the max value of header.size.
Event types
Define the event attributes with their IDs.