[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <5fca481e91c3c5d2ba033d4c6e9b969f8033ab0f.1634113027.git.alexey.v.bayduraev@linux.intel.com>
Date: Wed, 13 Oct 2021 12:06:41 +0300
From: Alexey Bayduraev <alexey.v.bayduraev@...ux.intel.com>
To: Arnaldo Carvalho de Melo <acme@...nel.org>
Cc: Jiri Olsa <jolsa@...hat.com>, Namhyung Kim <namhyung@...nel.org>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>,
linux-kernel <linux-kernel@...r.kernel.org>,
Andi Kleen <ak@...ux.intel.com>,
Adrian Hunter <adrian.hunter@...el.com>,
Alexander Antonov <alexander.antonov@...ux.intel.com>,
Alexei Budankov <abudankov@...wei.com>,
Riccardo Mancini <rickyman7@...il.com>
Subject: [PATCH v4 7/8] perf session: Introduce reader return codes
Adding reader READER_OK and READER_NODATA return codes to make
the code more clear.
Suggested-by: Jiri Olsa <jolsa@...nel.org>
Acked-by: Namhyung Kim <namhyung@...il.com>
Reviewed-by: Riccardo Mancini <rickyman7@...il.com>
Tested-by: Riccardo Mancini <rickyman7@...il.com>
Signed-off-by: Alexey Bayduraev <alexey.v.bayduraev@...ux.intel.com>
---
tools/perf/util/session.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index 68d130fe51c2..9714881839e3 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -2258,12 +2258,17 @@ reader__mmap(struct reader *rd, struct perf_session *session)
return 0;
}
+enum {
+ READER_OK,
+ READER_NODATA,
+};
+
static int
reader__read_event(struct reader *rd, struct perf_session *session,
struct ui_progress *prog)
{
u64 size;
- int err = 0;
+ int err = READER_OK;
union perf_event *event;
s64 skip;
@@ -2273,7 +2278,7 @@ reader__read_event(struct reader *rd, struct perf_session *session,
return PTR_ERR(event);
if (!event)
- return 1;
+ return READER_NODATA;
size = event->header.size;
@@ -2325,7 +2330,7 @@ reader__process_events(struct reader *rd, struct perf_session *session,
err = reader__read_event(rd, session, prog);
if (err < 0)
goto out;
- else if (err == 1)
+ else if (err == READER_NODATA)
goto remap;
if (session_done())
--
2.19.0
Powered by blists - more mailing lists