Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3256358pxb; Wed, 13 Oct 2021 02:12:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwzP1wFQHAKd4lwiJY2JP6sLfnpX+7yrNe5P8421zQEVfoziUgAOaUfHr65YPTpfeTGRc9T X-Received: by 2002:a17:906:3784:: with SMTP id n4mr16463276ejc.129.1634116357659; Wed, 13 Oct 2021 02:12:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634116357; cv=none; d=google.com; s=arc-20160816; b=S/WVf0xpQlsWYuNVs8B2ew9wT7W5gWv3jj8JA38z/+3dgmHeSocn5xFWaFzvZWvCrA 64ujELhpr1x0fda47c4mrOExXJGtH3mCUQNQea6uS95UtPvwKDJAwLzkwJflh717LH5/ r6iH75pxxyppQtvm4ro8AK9XD2cYAQbv9eTNgdyEo2WUWVkK/PDmEySfzFm1ngAWEZJC VYjMza3R0BAmQDn0SCUI9MjpfDeB66l7nOrPa3MI37VIxZb9Gbego16UjM0Q99m7AGM+ oBu87rjJj2S/EDaRFISEbZ5UXsToKOJOl4kSCer1aC6klbqjVgJ0pzD5w/VPZBuWfiih LkIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=qw1XWOAl7QlsM0Z5WjmkwV3RZK6F4CkkS/wcxisu0uQ=; b=N6od7LOyj1pRpz83vzX02Lg9XVAfB2YCfBnFDL+KsqZYENrgYFH+kHBH+0JOsdV4CJ RYFgsOw0S5G4IF3tE9g7Y+mza+rvgVeW7x6Q1aQj+Luo5fRzHgDnnuAX8mGWmXYJsKrz HMODzNj+PGEyfcnpSJZ3oofNZTF32uSfgC9AQyxANBRJvX7IZKusMTCG9yKL8FXeAEZ6 TZs7OLy1Bu07g5CObqF7AIuFWQ4Drix0E/AJnimcDG/GqLbYJJlcN08SsY9LzkCykukG rxyJgGxYagMlpMXn0TfWdJcNAxfYS0r89kHCVPaOSa1zSctjnaqVmL1JbTdWRz+FiAA1 HTrA== 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 w13si18431495ejb.572.2021.10.13.02.12.12; Wed, 13 Oct 2021 02:12:37 -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 S239089AbhJMJJd (ORCPT + 99 others); Wed, 13 Oct 2021 05:09:33 -0400 Received: from mga07.intel.com ([134.134.136.100]:48251 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235203AbhJMJJ1 (ORCPT ); Wed, 13 Oct 2021 05:09:27 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10135"; a="290877037" X-IronPort-AV: E=Sophos;i="5.85,370,1624345200"; d="scan'208";a="290877037" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Oct 2021 02:07:24 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.85,370,1624345200"; d="scan'208";a="460706044" Received: from nntpat99-84.inn.intel.com ([10.125.99.84]) by orsmga002.jf.intel.com with ESMTP; 13 Oct 2021 02:07:21 -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 v4 8/8] perf session: Introduce reader EOF function Date: Wed, 13 Oct 2021 12:06:42 +0300 Message-Id: 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 Introducing a function to check end-of-file status. Signed-off-by: Alexey Bayduraev --- tools/perf/util/session.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c index 9714881839e3..bca92ba7218a 100644 --- a/tools/perf/util/session.c +++ b/tools/perf/util/session.c @@ -2309,6 +2309,12 @@ reader__read_event(struct reader *rd, struct perf_session *session, return err; } +static inline bool +reader__eof(struct reader *rd) +{ + return (rd->file_pos >= rd->data_size + rd->data_offset); +} + static int reader__process_events(struct reader *rd, struct perf_session *session, struct ui_progress *prog) @@ -2336,7 +2342,7 @@ reader__process_events(struct reader *rd, struct perf_session *session, if (session_done()) goto out; - if (rd->file_pos < rd->data_size + rd->data_offset) + if (!reader__eof(rd)) goto more; out: -- 2.19.0