Commit f06149c0 authored by Wang Nan's avatar Wang Nan Committed by Arnaldo Carvalho de Melo

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: default avatarWang Nan <wangnan0@huawei.com>
Acked-by: default avatarJiri Olsa <jolsa@kernel.org>
Tested-by: default avatarArnaldo 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.comSigned-off-by: default avatarHe Kuang <hekuang@huawei.com>
Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 626a6b78
...@@ -1499,10 +1499,27 @@ int perf_session__register_idle_thread(struct perf_session *session) ...@@ -1499,10 +1499,27 @@ int perf_session__register_idle_thread(struct perf_session *session)
return err; return err;
} }
static void
perf_session__warn_order(const struct perf_session *session)
{
const struct ordered_events *oe = &session->ordered_events;
struct perf_evsel *evsel;
bool should_warn = true;
evlist__for_each_entry(session->evlist, evsel) {
if (evsel->attr.write_backward)
should_warn = false;
}
if (!should_warn)
return;
if (oe->nr_unordered_events != 0)
ui__warning("%u out of order events recorded.\n", oe->nr_unordered_events);
}
static void perf_session__warn_about_errors(const struct perf_session *session) static void perf_session__warn_about_errors(const struct perf_session *session)
{ {
const struct events_stats *stats = &session->evlist->stats; const struct events_stats *stats = &session->evlist->stats;
const struct ordered_events *oe = &session->ordered_events;
if (session->tool->lost == perf_event__process_lost && if (session->tool->lost == perf_event__process_lost &&
stats->nr_events[PERF_RECORD_LOST] != 0) { stats->nr_events[PERF_RECORD_LOST] != 0) {
...@@ -1559,8 +1576,7 @@ static void perf_session__warn_about_errors(const struct perf_session *session) ...@@ -1559,8 +1576,7 @@ static void perf_session__warn_about_errors(const struct perf_session *session)
stats->nr_unprocessable_samples); stats->nr_unprocessable_samples);
} }
if (oe->nr_unordered_events != 0) perf_session__warn_order(session);
ui__warning("%u out of order events recorded.\n", oe->nr_unordered_events);
events_stats__auxtrace_error_warn(stats); events_stats__auxtrace_error_warn(stats);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment