diff options
author | Alexey Bayduraev <alexey.v.bayduraev@linux.intel.com> | 2021-10-13 12:06:41 +0300 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2021-10-25 13:47:41 -0300 |
commit | 4c0028864cd937ae604f0d62282899108061a6f1 (patch) | |
tree | 503162a7fd07ad84b205620e1f2c63d655dae0a9 | |
parent | 5c10dc9244fe37855002f43297ff338d0fd253e2 (diff) | |
download | linux-4c0028864cd937ae604f0d62282899108061a6f1.tar.bz2 |
perf session: Introduce reader return codes
Add READER_OK and READER_NODATA return codes to make the code more
clear.
Suggested-by: Jiri Olsa <jolsa@kernel.org>
Reviewed-by: Jiri Olsa <jolsa@redhat.com>
Reviewed-by: Riccardo Mancini <rickyman7@gmail.com>
Signed-off-by: Alexey Bayduraev <alexey.v.bayduraev@linux.intel.com>
Tested-by: Riccardo Mancini <rickyman7@gmail.com>
Acked-by: Namhyung Kim <namhyung@gmail.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Antonov <alexander.antonov@linux.intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Alexei Budankov <abudankov@huawei.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: https://lore.kernel.org/r/5fca481e91c3c5d2ba033d4c6e9b969f8033ab0f.1634113027.git.alexey.v.bayduraev@linux.intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r-- | tools/perf/util/session.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c index d5a8811cf8ce..fee7a7171f1a 100644 --- a/tools/perf/util/session.c +++ b/tools/perf/util/session.c @@ -2263,12 +2263,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; @@ -2278,7 +2283,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; @@ -2330,7 +2335,7 @@ more: 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()) |