lkml.org 
[lkml]   [2019]   [Feb]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 4/4] perf report: support record trace file decompression
On Mon, Feb 11, 2019 at 11:25:00PM +0300, Alexey Budankov wrote:

SNIP

> +static int perf_session__process_compressed_event(struct perf_session *session,
> + union perf_event *event, u64 file_offset)
> +{
> + void *src;
> + size_t decomp_size, src_size;
> + u64 decomp_last_rem = 0;
> + size_t decomp_len = session->header.env.comp_mmap_len;
> + struct decomp *decomp, *decomp_last = session->decomp_last;
> +
> + decomp = mmap(NULL, sizeof(struct decomp) + decomp_len, PROT_READ|PROT_WRITE,
> + MAP_ANONYMOUS|MAP_PRIVATE, -1, 0);
> + if (decomp == MAP_FAILED) {
> + pr_err("Couldn't allocate memory for decompression\n");
> + return -1;
> + }
> +
> + decomp->file_pos = file_offset;
> + decomp->head = 0;
> +
> + if (decomp_last) {
> + decomp_last_rem = decomp_last->size - decomp_last->head;
> + memcpy(decomp->data, &(decomp_last->data[decomp_last->head]), decomp_last_rem);
> + decomp->size = decomp_last_rem;
> + }
> +
> + src = (void *)event + sizeof(struct compressed_event);
> + src_size = event->pack.header.size - sizeof(struct compressed_event);
> +
> + decomp_size = perf_session__zstd_decompress(session, src, src_size,
> + &(decomp->data[decomp_last_rem]), decomp_len - decomp_last_rem);
> + if (!decomp_size) {
> + munmap(decomp, sizeof(struct decomp) + decomp_len);
> + pr_err("Couldn't decompress data\n");
> + return -1;
> + }
> +
> + decomp->size += decomp_size;
> +
> + if (session->decomp == NULL) {
> + session->decomp = decomp;
> + session->decomp_last = decomp;
> + } else {
> + session->decomp_last->next = decomp;
> + session->decomp_last = decomp;
> + }

can this happen? can you process more compressed events
before you deliver them in __perf_session__process_decomp_events?

I think I asked similar question in my other email..

thanks,
jirka

\
 
 \ /
  Last update: 2019-02-12 14:10    [W:0.135 / U:5.324 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site