From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C8D97C49EA2 for ; Tue, 22 Jun 2021 08:43:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B39296128C for ; Tue, 22 Jun 2021 08:43:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231280AbhFVIqD (ORCPT ); Tue, 22 Jun 2021 04:46:03 -0400 Received: from mga05.intel.com ([192.55.52.43]:57647 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231241AbhFVIpv (ORCPT ); Tue, 22 Jun 2021 04:45:51 -0400 IronPort-SDR: 8IRSKsRU94bFIKFreWDikev0U7EHKHx6Ld0Xct6ThZWcG/LtESq6gVlAfQiBznf7caNxIPsF6B qkBLh8LP7V1A== X-IronPort-AV: E=McAfee;i="6200,9189,10022"; a="292641617" X-IronPort-AV: E=Sophos;i="5.83,291,1616482800"; d="scan'208";a="292641617" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jun 2021 01:43:15 -0700 IronPort-SDR: fWKoOMJonN/8Uyg7c6iz+i6gk2R6FYJcuts4QG6R7KX9EvAmZwRBHOigc80lpd44nwwgC8v7wr 5GG7/dMB9r+g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,291,1616482800"; d="scan'208";a="417332635" Received: from nntpat99-84.inn.intel.com ([10.125.99.84]) by fmsmga007.fm.intel.com with ESMTP; 22 Jun 2021 01:43:12 -0700 From: Alexey Bayduraev To: Arnaldo Carvalho de Melo Cc: Jiri Olsa , Namhyung Kim , Alexander Shishkin , Peter Zijlstra , Ingo Molnar , linux-kernel , Andi Kleen , Adrian Hunter , Alexander Antonov , Alexei Budankov , Riccardo Mancini Subject: [PATCH v7 13/20] perf session: Move reader structure to the top Date: Tue, 22 Jun 2021 11:42:22 +0300 Message-Id: <1b6f5ffc73a9208db7b97c9a43581610175def97.1624350588.git.alexey.v.bayduraev@linux.intel.com> X-Mailer: git-send-email 2.19.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Moving reader structure to the top of the file. This is necessary for the further use of this structure in the decompressor. Signed-off-by: Alexey Bayduraev --- tools/perf/util/session.c | 56 +++++++++++++++++++-------------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c index 09efd7c02400..6ba7da8c5daa 100644 --- a/tools/perf/util/session.c +++ b/tools/perf/util/session.c @@ -36,6 +36,34 @@ #include "units.h" #include +/* + * On 64bit we can mmap the data file in one go. No need for tiny mmap + * slices. On 32bit we use 32MB. + */ +#if BITS_PER_LONG == 64 +#define MMAP_SIZE ULLONG_MAX +#define NUM_MMAPS 1 +#else +#define MMAP_SIZE (32 * 1024 * 1024ULL) +#define NUM_MMAPS 128 +#endif + +struct reader; + +typedef s64 (*reader_cb_t)(struct perf_session *session, + union perf_event *event, + u64 file_offset, + const char *file_path); + +struct reader { + int fd; + const char *path; + u64 data_size; + u64 data_offset; + reader_cb_t process; + bool in_place_update; +}; + #ifdef HAVE_ZSTD_SUPPORT static int perf_session__process_compressed_event(struct perf_session *session, union perf_event *event, u64 file_offset, @@ -2143,34 +2171,6 @@ static int __perf_session__process_decomp_events(struct perf_session *session) return 0; } -/* - * On 64bit we can mmap the data file in one go. No need for tiny mmap - * slices. On 32bit we use 32MB. - */ -#if BITS_PER_LONG == 64 -#define MMAP_SIZE ULLONG_MAX -#define NUM_MMAPS 1 -#else -#define MMAP_SIZE (32 * 1024 * 1024ULL) -#define NUM_MMAPS 128 -#endif - -struct reader; - -typedef s64 (*reader_cb_t)(struct perf_session *session, - union perf_event *event, - u64 file_offset, - const char *file_path); - -struct reader { - int fd; - const char *path; - u64 data_size; - u64 data_offset; - reader_cb_t process; - bool in_place_update; -}; - static int reader__process_events(struct reader *rd, struct perf_session *session, struct ui_progress *prog) -- 2.19.0