Reading from a overwrite ring buffer is unrelible. perf_evsel__pause()
should be called before reading from them.
Toggel overwrite_evt_paused director after receiving done or switch
output.
Signed-off-by: Wang Nan <wangnan0@xxxxxxxxxx>
Signed-off-by: He Kuang <hekuang@xxxxxxxxxx>
Cc: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
Cc: Jiri Olsa <jolsa@xxxxxxxxxx>
Cc: Masami Hiramatsu <masami.hiramatsu.pt@xxxxxxxxxxx>
Cc: Namhyung Kim <namhyung@xxxxxxxxxx>
Cc: Zefan Li <lizefan@xxxxxxxxxx>
Cc: pi3orama@xxxxxxx
---
tools/perf/builtin-record.c | 77 +++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 77 insertions(+)
+static void
+record__toggle_overwrite_evsels(struct record *rec,
+ enum overwrite_evt_state state)
+{
+ rec->overwrite_evt_state = state;This part is incorrect. We should pause ring buffers for each CPU
+
+ if (action == NONE)
+ return;
+
+ evlist__for_each(evlist, pos) {
+ if (!pos->overwrite)
+ continue;
+ perf_evsel__pause(pos, action == PAUSE);
+ }
+}
+