[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <9ce9d437-eda5-ac82-7109-dd64d17b4e7f@linux.intel.com>
Date: Wed, 20 Feb 2019 17:46:24 +0300
From: Alexey Budankov <alexey.budankov@...ux.intel.com>
To: Jiri Olsa <jolsa@...hat.com>
Cc: Arnaldo Carvalho de Melo <acme@...nel.org>,
Ingo Molnar <mingo@...hat.com>,
Peter Zijlstra <peterz@...radead.org>,
Namhyung Kim <namhyung@...nel.org>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Andi Kleen <ak@...ux.intel.com>,
linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2 4/4] perf report: support record trace file
decompression
On 12.02.2019 16:09, Jiri Olsa wrote:
> 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..
Answered to that mail.
Thanks,
Alexey
>
> thanks,
> jirka
>
Powered by blists - more mailing lists