From 25900ea85ceef35e19234682e7c9dfc8ca2addbe Mon Sep 17 00:00:00 2001 From: Alexey Bayduraev Date: Wed, 13 Oct 2021 12:06:42 +0300 Subject: [PATCH] perf session: Introduce reader EOF function Introduce function to check end-of-file status. Reviewed-by: Jiri Olsa Signed-off-by: Alexey Bayduraev Cc: Adrian Hunter Cc: Alexander Antonov Cc: Alexander Shishkin Cc: Alexei Budankov Cc: Andi Kleen Cc: Ingo Molnar Cc: Namhyung Kim Cc: Peter Zijlstra Cc: Riccardo Mancini Link: https://lore.kernel.org/r/b3b0e0904da01f9ec84d4ae9368df99ecd231598.1634113027.git.alexey.v.bayduraev@linux.intel.com Signed-off-by: Arnaldo Carvalho de Melo --- 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 fee7a7171f1a..51bf2efceb7f 100644 --- a/tools/perf/util/session.c +++ b/tools/perf/util/session.c @@ -2314,6 +2314,12 @@ out: 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) @@ -2341,7 +2347,7 @@ more: if (session_done()) goto out; - if (rd->file_pos < rd->data_size + rd->data_offset) + if (!reader__eof(rd)) goto more; out: