Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp5334118pxu; Wed, 21 Oct 2020 22:16:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxnYjix2D1ddmsKiIXSJ/+zyLpJUHSJQpVC50W+ZnGOdJq6bwTuN2XbAKdLFwGcLd5u5FkT X-Received: by 2002:a50:a410:: with SMTP id u16mr721083edb.350.1603343794154; Wed, 21 Oct 2020 22:16:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603343794; cv=none; d=google.com; s=arc-20160816; b=caK3ckbjJMSAIeX2X9L6r79JPKir+XJxUaXXrKzG1DTZcsILlj1QVgNDP+wLafHEZk Fe7hJ/k+V3c56r7FYJ9tSx517bPpjb00vCXtQ0dUlqilkK/UAfryxAT/UNrAFSMV/YtD 71BIOMMOVWTMPnzaYNvppmjR0JiO3VSVvFdzFHRDKJpG1w9ZzUJUy+Fr156JeczJZSuF VJdOcS+UA0Lq3NctevQTtT6+Bo2oGtMAujogwyoSGFQNqiM0d1DcAr79+ZQWFJMRo8vD 5msCqols+Gs+eJPp7Y/ZscTkYAcYDXTI7IX+wdkVv/3GV8CqJffWzA2ySQvpNCB8w+pp nMtg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:organization :references:cc:to:from:subject:ironport-sdr:ironport-sdr; bh=BHvtojh+nawDFIr/bu9GLfMaUIP63Yuhb8mYk/W16sU=; b=ZGmdr/Dg/rOb6D7CeownrZxhTw6StHDI76bnhrNzR707aqotPqBjmJapLqsO7N8nAJ tl3/6AJwdtbrvLJdzt8uVtql1YGn5N/rm61XB1tPdwGCARi15Q+2JzxOZeW3je0RZJVj MO+U/J2o6w8ISVUPqwRKOXGSM5f6WDCVyFxh6ZsqsH+eID6u7ZPmQBbUEQKUA+I+flYa NO34BS782CUFCLZxLtCJbFJL7g1CwDVSn0BMqiPMk15lYbPhe6M56hU1LejCWc/mmYw/ DTraAlo9iu2UssDzjJhliis79Alb3vuj+Yw1ez275GdGtclFvRX6sjrK2Lcjw8RGQWr3 mC3w== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b6si248150eja.565.2020.10.21.22.16.11; Wed, 21 Oct 2020 22:16:34 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2444327AbgJUQAy (ORCPT + 99 others); Wed, 21 Oct 2020 12:00:54 -0400 Received: from mga14.intel.com ([192.55.52.115]:7416 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2444323AbgJUQAy (ORCPT ); Wed, 21 Oct 2020 12:00:54 -0400 IronPort-SDR: KA9Wh5MMkeeF4Im4wo8ONAnZBj1TLlV+C3PXRDtaJq/5618bpwfwrajJbjWx3UVg92xeckLsUS bBn3assm+WNQ== X-IronPort-AV: E=McAfee;i="6000,8403,9780"; a="166613549" X-IronPort-AV: E=Sophos;i="5.77,401,1596524400"; d="scan'208";a="166613549" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Oct 2020 09:00:34 -0700 IronPort-SDR: JGNosnvwsmzI1DYofw4J6jZHXntvyUgkpjmeFa2kSwx/b74Ou+Ko3gdw5TEFp+SzzV4CzZf30W V/WiKWFXn8sg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,401,1596524400"; d="scan'208";a="522790278" Received: from linux.intel.com ([10.54.29.200]) by fmsmga006.fm.intel.com with ESMTP; 21 Oct 2020 09:00:34 -0700 Received: from [10.249.231.46] (abudanko-mobl.ccr.corp.intel.com [10.249.231.46]) by linux.intel.com (Postfix) with ESMTP id ADDC5580720; Wed, 21 Oct 2020 09:00:31 -0700 (PDT) Subject: [PATCH v2 05/15] perf session: introduce decompressor into trace reader object From: Alexey Budankov To: Arnaldo Carvalho de Melo , Jiri Olsa Cc: Namhyung Kim , Alexander Shishkin , Adrian Hunter , Andi Kleen , Peter Zijlstra , Ingo Molnar , linux-kernel References: <1ec29ed6-0047-d22f-630b-a7f5ccee96b4@linux.intel.com> Organization: Intel Corp. Message-ID: Date: Wed, 21 Oct 2020 19:00:30 +0300 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.12.1 MIME-Version: 1.0 In-Reply-To: <1ec29ed6-0047-d22f-630b-a7f5ccee96b4@linux.intel.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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); 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