Skip to content

Commit

Permalink
perf session: Introduce reader EOF function
Browse files Browse the repository at this point in the history
Introduce function to check end-of-file status.

Reviewed-by: Jiri Olsa <jolsa@redhat.com>
Signed-off-by: Alexey Bayduraev <alexey.v.bayduraev@linux.intel.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>
Cc: Riccardo Mancini <rickyman7@gmail.com>
Link: https://lore.kernel.org/r/b3b0e0904da01f9ec84d4ae9368df99ecd231598.1634113027.git.alexey.v.bayduraev@linux.intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
  • Loading branch information
Alexey Bayduraev authored and Arnaldo Carvalho de Melo committed Oct 25, 2021
1 parent 4c00288 commit 25900ea
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion tools/perf/util/session.c
Original file line number Diff line number Diff line change
Expand Up @@ -2314,6 +2314,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)
Expand Down Expand Up @@ -2341,7 +2347,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:
Expand Down

0 comments on commit 25900ea

Please sign in to comment.