Skip to content

Commit f06149c

Browse files
WangNan0acmel
authored andcommitted
perf session: Don't warn about out of order event if write_backward is used
If write_backward attribute is set, records are written into kernel ring buffer from end to beginning, but read from beginning to end. To avoid 'XX out of order events recorded' warning message (timestamps of records is in reverse order when using write_backward), suppress the warning message if write_backward is selected by at lease one event. Result: Before this patch: # perf record -m 1 -e raw_syscalls:sys_exit/overwrite/ \ -e raw_syscalls:sys_enter \ dd if=/dev/zero of=/dev/null count=300 300+0 records in 300+0 records out 153600 bytes (154 kB) copied, 0.000601617 s, 255 MB/s [ perf record: Woken up 5 times to write data ] Warning: 40 out of order events recorded. [ perf record: Captured and wrote 0.096 MB perf.data (696 samples) ] After this patch: # perf record -m 1 -e raw_syscalls:sys_exit/overwrite/ \ -e raw_syscalls:sys_enter \ dd if=/dev/zero of=/dev/null count=300 300+0 records in 300+0 records out 153600 bytes (154 kB) copied, 0.000644873 s, 238 MB/s [ perf record: Woken up 5 times to write data ] [ perf record: Captured and wrote 0.096 MB perf.data (696 samples) ] Signed-off-by: Wang Nan <wangnan0@huawei.com> Acked-by: Jiri Olsa <jolsa@kernel.org> Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Masami Hiramatsu <mhiramat@kernel.org> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Nilay Vaish <nilayvaish@gmail.com> Cc: Zefan Li <lizefan@huawei.com> Cc: pi3orama@163.com Link: http://lkml.kernel.org/r/1468485287-33422-15-git-send-email-wangnan0@huawei.com Signed-off-by: He Kuang <hekuang@huawei.com> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
1 parent 626a6b7 commit f06149c

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

tools/perf/util/session.c

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1499,10 +1499,27 @@ int perf_session__register_idle_thread(struct perf_session *session)
14991499
return err;
15001500
}
15011501

1502+
static void
1503+
perf_session__warn_order(const struct perf_session *session)
1504+
{
1505+
const struct ordered_events *oe = &session->ordered_events;
1506+
struct perf_evsel *evsel;
1507+
bool should_warn = true;
1508+
1509+
evlist__for_each_entry(session->evlist, evsel) {
1510+
if (evsel->attr.write_backward)
1511+
should_warn = false;
1512+
}
1513+
1514+
if (!should_warn)
1515+
return;
1516+
if (oe->nr_unordered_events != 0)
1517+
ui__warning("%u out of order events recorded.\n", oe->nr_unordered_events);
1518+
}
1519+
15021520
static void perf_session__warn_about_errors(const struct perf_session *session)
15031521
{
15041522
const struct events_stats *stats = &session->evlist->stats;
1505-
const struct ordered_events *oe = &session->ordered_events;
15061523

15071524
if (session->tool->lost == perf_event__process_lost &&
15081525
stats->nr_events[PERF_RECORD_LOST] != 0) {
@@ -1559,8 +1576,7 @@ static void perf_session__warn_about_errors(const struct perf_session *session)
15591576
stats->nr_unprocessable_samples);
15601577
}
15611578

1562-
if (oe->nr_unordered_events != 0)
1563-
ui__warning("%u out of order events recorded.\n", oe->nr_unordered_events);
1579+
perf_session__warn_order(session);
15641580

15651581
events_stats__auxtrace_error_warn(stats);
15661582

0 commit comments

Comments
 (0)