Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp1378723pxu; Sat, 24 Oct 2020 08:50:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxh0NICCepjxKaWqjmisDnWgSmJZQV5jS/0LST8VCQ1pcdtcR87vg7Y7NOUzoLCBUoL8/EN X-Received: by 2002:a17:906:274b:: with SMTP id a11mr1108762ejd.129.1603554640796; Sat, 24 Oct 2020 08:50:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603554640; cv=none; d=google.com; s=arc-20160816; b=hJEoMaezEW2+PxsOsUvzZ4KQ/Y7OGq0sNDFeDLyEDzl+iGja00hUFJ3avnZYTBUNv0 93U1zZRXFsZ+JHRGYWK6Ef9h1bbNx8+OxljF7VLrDyGI/8YL7lpM2kxXu2KlGQGdqigY 6PMp1bbd6Nquwvz7iefoaisAoLUm6OzPX19ssYzvg8VPh9mW7ieMQEaQlNq5foKGfWIp QyvUEoRtHtHymwrhjEjte1oIu2LElK65kdPQfLBHW6azREM/rqQbpePUmO7ZOU00QCRS xhIe/Y3LfvSKGE0/pmBmNgH4EWMzukvk5CCgSNgSvJDlzSZdAZmyxJKGshpuSPaMxTFI SR5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=0wAda7TDqK/ulZz/rTqmSI7BdeMAlzw6CIJ0PXAH3Ys=; b=B99uIZDVufB9765I5Tsjrv9KukfbZJ34G3z9PaNtmDzNkJsd2h2uKdqVSf41yrHYaU GO8UHZ8d/PUyP/qUkgw3JQc5fW4ZgQH3C3jQIvU4rLzeDdhrMh+/jlGq4ZGp+ubhY6WW s2q7934EY23eoQ5HZtC86RmMNl0vE+UrPl7kwMur6cUKW8st2N/gBFBSxovWuUm6oCfi J9FfQHSVUMmzdoONCY8D0j9XpwbYWeFbtHwGoEIjgFGNjcpFPzO+Zfm6CkV8727oyIcy ThzoaFOq6HLwoE1+F7oX1Bf5SUuGrmbC5BxkHsiDvWEzjCpnGW2I5Bz4d0qugqnT5UK/ vLtw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=JuAjWTLD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z10si3358134edk.224.2020.10.24.08.50.18; Sat, 24 Oct 2020 08:50:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=JuAjWTLD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1762131AbgJXPos (ORCPT + 99 others); Sat, 24 Oct 2020 11:44:48 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:28161 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1762128AbgJXPos (ORCPT ); Sat, 24 Oct 2020 11:44:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1603554287; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=0wAda7TDqK/ulZz/rTqmSI7BdeMAlzw6CIJ0PXAH3Ys=; b=JuAjWTLDQ1T9KO1feRXIsT6q0rHQGK07rmFFyAKKugGnyjfDOokuzeZAI7PjGuAnKFoqGb oTruRS2UE9QMwihTEIy/kJETec5ETu7Z1QOaLo59gmfYt8xc6K5YKIHdVHcKRU1yqeLw0K y5SknCgA9363o6kua6pmc/fZO+GVgSw= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-464-pUbfwcDEM3yNtth9wlEs-g-1; Sat, 24 Oct 2020 11:44:43 -0400 X-MC-Unique: pUbfwcDEM3yNtth9wlEs-g-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A4D4A805F0A; Sat, 24 Oct 2020 15:44:41 +0000 (UTC) Received: from krava (unknown [10.40.192.80]) by smtp.corp.redhat.com (Postfix) with SMTP id BAF8855762; Sat, 24 Oct 2020 15:44:39 +0000 (UTC) Date: Sat, 24 Oct 2020 17:44:38 +0200 From: Jiri Olsa To: Alexey Budankov Cc: Arnaldo Carvalho de Melo , Namhyung Kim , Alexander Shishkin , Adrian Hunter , Andi Kleen , Peter Zijlstra , Ingo Molnar , linux-kernel Subject: Re: [PATCH v2 05/15] perf session: introduce decompressor into trace reader object Message-ID: <20201024154438.GI2589351@krava> References: <1ec29ed6-0047-d22f-630b-a7f5ccee96b4@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Oct 21, 2020 at 07:00:30PM +0300, Alexey Budankov wrote: > > Introduce decompressor to trace reader object so that decompression > could be executed on per trace file basis separately for every > trace file located in trace directory. > > Signed-off-by: Alexey Budankov > --- > tools/perf/util/session.c | 4 +++- > tools/perf/util/session.h | 1 + > 2 files changed, 4 insertions(+), 1 deletion(-) > > diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c > index 911b2dbcd0ac..6afc670fdf0c 100644 > --- a/tools/perf/util/session.c > +++ b/tools/perf/util/session.c > @@ -44,6 +44,8 @@ static int perf_session__process_compressed_event(struct perf_session *session, > u64 decomp_last_rem = 0; > size_t mmap_len, decomp_len = session->header.env.comp_mmap_len; > struct decomp *decomp, *decomp_last = session->decomp_last; > + struct zstd_data *zstd_data = session->reader ? > + &(session->reader->zstd_data) : &(session->zstd_data); I don't think we're using braces in these cases, they are not necessary jirka > > if (decomp_last) { > decomp_last_rem = decomp_last->size - decomp_last->head; > @@ -71,7 +73,7 @@ static int perf_session__process_compressed_event(struct perf_session *session, > src = (void *)event + sizeof(struct perf_record_compressed); > src_size = event->pack.header.size - sizeof(struct perf_record_compressed); > > - decomp_size = zstd_decompress_stream(&(session->zstd_data), src, src_size, > + decomp_size = zstd_decompress_stream(zstd_data, src, src_size, > &(decomp->data[decomp_last_rem]), decomp_len - decomp_last_rem); > if (!decomp_size) { > munmap(decomp, mmap_len); > diff --git a/tools/perf/util/session.h b/tools/perf/util/session.h > index abdb8518a81f..4fc9ccdf7970 100644 > --- a/tools/perf/util/session.h > +++ b/tools/perf/util/session.h > @@ -42,6 +42,7 @@ struct reader { > u64 data_size; > u64 data_offset; > reader_cb_t process; > + struct zstd_data zstd_data; > }; > > struct perf_session { > -- > 2.24.1 > >