perf top: Move perf_top__reset_sample_counters() to after counts display
authorJiri Olsa <jolsa@kernel.org>
Tue, 13 Nov 2018 10:15:34 +0000 (11:15 +0100)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Mon, 17 Dec 2018 17:58:47 +0000 (14:58 -0300)
Move the perf_top__reset_sample_counters() call to right after we
display the counters so we can see the updated numbers for longer.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Acked-by: David S. Miller <davem@davemloft.net>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: https://lkml.kernel.org/n/tip-o72pyiwt05f3p2juprwmz2jo@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/builtin-top.c
tools/perf/ui/browsers/hists.c
tools/perf/util/top.c

index f22c531be3660a0b7d667ea0067d5bbd3350d464..fe3ecfb2e64bee40b2a8bc60726402aec2b0ef56 100644 (file)
@@ -273,8 +273,6 @@ static void perf_top__print_sym_table(struct perf_top *top)
        perf_top__header_snprintf(top, bf, sizeof(bf));
        printf("%s\n", bf);
 
-       perf_top__reset_sample_counters(top);
-
        printf("%-*.*s\n", win_width, win_width, graph_dotted_line);
 
        if (!top->record_opts.overwrite &&
@@ -573,8 +571,6 @@ static void perf_top__sort_new_samples(void *arg)
 
        if (t->lost || t->drop)
                pr_warning("Too slow to read ring buffer (change period (-c/-F) or limit CPUs (-C)\n");
-
-       perf_top__reset_sample_counters(t);
 }
 
 static void stop_top(void)
index 36b262c49f51897574a0b72575c9b8a0bddf5337..ffac1d54a3d4cde8a00d6529a6754489106d1ac2 100644 (file)
@@ -2229,8 +2229,11 @@ static int hists_browser__scnprintf_title(struct hist_browser *browser, char *bf
 
                if (top->zero)
                        printed += scnprintf(bf + printed, size - printed, " [z]");
+
+               perf_top__reset_sample_counters(top);
        }
 
+
        return printed;
 }
 
index 31a8dee9af691d7ebd219f02dbb02d5b5ad87501..4c8da8c4435f5adb7138900addd9e14f2b7c3641 100644 (file)
@@ -107,6 +107,7 @@ size_t perf_top__header_snprintf(struct perf_top *top, char *bf, size_t size)
                                        top->evlist->cpus->nr > 1 ? "s" : "");
        }
 
+       perf_top__reset_sample_counters(top);
        return ret;
 }