diff options
author | Alexey Bayduraev <alexey.v.bayduraev@linux.intel.com> | 2021-10-13 12:06:40 +0300 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2021-10-25 13:47:41 -0300 |
commit | 5c10dc9244fe37855002f43297ff338d0fd253e2 (patch) | |
tree | 93564ab12cd492410d8cb6e6f65eb34fe705fe0c /tools/perf/util | |
parent | de096489d00f7764934906d0b6688783be6b9dc0 (diff) | |
download | linux-stable-5c10dc9244fe37855002f43297ff338d0fd253e2.tar.gz linux-stable-5c10dc9244fe37855002f43297ff338d0fd253e2.tar.bz2 linux-stable-5c10dc9244fe37855002f43297ff338d0fd253e2.zip |
perf session: Move the event read code to a separate function
Separate the reading code of a single event to a new
reader__read_event() function.
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/ffe570d937138dd24f282978ce7ed9c46a06ff9b.1634113027.git.alexey.v.bayduraev@linux.intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util')
-rw-r--r-- | tools/perf/util/session.c | 46 |
1 files changed, 31 insertions, 15 deletions
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c index 4cbe66366d17..d5a8811cf8ce 100644 --- a/tools/perf/util/session.c +++ b/tools/perf/util/session.c @@ -2264,33 +2264,21 @@ reader__mmap(struct reader *rd, struct perf_session *session) } static int -reader__process_events(struct reader *rd, struct perf_session *session, - struct ui_progress *prog) +reader__read_event(struct reader *rd, struct perf_session *session, + struct ui_progress *prog) { u64 size; int err = 0; union perf_event *event; s64 skip; - err = reader__init(rd, &session->one_mmap); - if (err) - goto out; - - session->active_decomp = &rd->decomp_data; - -remap: - err = reader__mmap(rd, session); - if (err) - goto out; - -more: event = fetch_mmaped_event(rd->head, rd->mmap_size, rd->mmap_cur, session->header.needs_swap); if (IS_ERR(event)) return PTR_ERR(event); if (!event) - goto remap; + return 1; size = event->header.size; @@ -2317,6 +2305,34 @@ more: ui_progress__update(prog, size); +out: + return err; +} + +static int +reader__process_events(struct reader *rd, struct perf_session *session, + struct ui_progress *prog) +{ + int err; + + err = reader__init(rd, &session->one_mmap); + if (err) + goto out; + + session->active_decomp = &rd->decomp_data; + +remap: + err = reader__mmap(rd, session); + if (err) + goto out; + +more: + err = reader__read_event(rd, session, prog); + if (err < 0) + goto out; + else if (err == 1) + goto remap; + if (session_done()) goto out; |