perf top: Switch to non overwrite mode
authorArnaldo Carvalho de Melo <acme@redhat.com>
Sat, 29 Jan 2011 14:08:00 +0000 (12:08 -0200)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Sat, 29 Jan 2011 18:24:57 +0000 (16:24 -0200)
Just like 'perf record'. Warn the user when PERF_RECORD_LOST events
happen.

Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Tom Zanussi <tzanussi@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/builtin-top.c

index ce2e50c891c76dd674e881c379fbe1d0a1186953..7f92ab7696f7841579f5dec8f1247e74ba5ae9e4 100644 (file)
@@ -464,7 +464,7 @@ static void rb_insert_active_sym(struct rb_root *tree, struct sym_entry *se)
        rb_insert_color(&se->rb_node, tree);
 }
 
-static void print_sym_table(void)
+static void print_sym_table(struct perf_session *session)
 {
        int printed = 0, j;
        struct perf_evsel *counter;
@@ -513,7 +513,6 @@ static void print_sym_table(void)
 
        puts(CONSOLE_CLEAR);
 
-       printf("%-*.*s\n", win_width, win_width, graph_dotted_line);
        if (!perf_guest) {
                printf("   PerfTop:%8.0f irqs/sec  kernel:%4.1f%%"
                        "  exact: %4.1f%% [",
@@ -578,6 +577,12 @@ static void print_sym_table(void)
 
        printf("%-*.*s\n", win_width, win_width, graph_dotted_line);
 
+       if (session->hists.stats.total_lost != 0) {
+               color_fprintf(stdout, PERF_COLOR_RED, "WARNING:");
+               printf(" LOST %" PRIu64 " events, Check IO/CPU overload\n",
+                      session->hists.stats.total_lost);
+       }
+
        if (sym_filter_entry) {
                show_details(sym_filter_entry);
                return;
@@ -919,7 +924,7 @@ repeat:
        getc(stdin);
 
        do {
-               print_sym_table();
+               print_sym_table(session);
        } while (!poll(&stdin_poll, 1, delay_msecs) == 1);
 
        c = getc(stdin);
@@ -1176,7 +1181,7 @@ try_again:
                }
        }
 
-       if (perf_evlist__mmap(evlist, cpus, threads, mmap_pages, true) < 0)
+       if (perf_evlist__mmap(evlist, cpus, threads, mmap_pages, false) < 0)
                die("failed to mmap with %d (%s)\n", errno, strerror(errno));
 }