Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Wang Nan and committed by
Arnaldo Carvalho de Melo
f06149c0 626a6b78

+19 -3
+19 -3
tools/perf/util/session.c
··· 1499 1499 return err; 1500 1500 } 1501 1501 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 + 1502 1520 static void perf_session__warn_about_errors(const struct perf_session *session) 1503 1521 { 1504 1522 const struct events_stats *stats = &session->evlist->stats; 1505 - const struct ordered_events *oe = &session->ordered_events; 1506 1523 1507 1524 if (session->tool->lost == perf_event__process_lost && 1508 1525 stats->nr_events[PERF_RECORD_LOST] != 0) { ··· 1576 1559 stats->nr_unprocessable_samples); 1577 1560 } 1578 1561 1579 - if (oe->nr_unordered_events != 0) 1580 - ui__warning("%u out of order events recorded.\n", oe->nr_unordered_events); 1562 + perf_session__warn_order(session); 1581 1563 1582 1564 events_stats__auxtrace_error_warn(stats); 1583 1565