aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKan Liang <kan.liang@intel.com>2018-01-18 16:26:29 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2018-02-15 07:56:26 -0500
commit06cc1a470ab237b991901729b125404c164f3660 (patch)
tree992a40372d7020d766993ba8ed0b70b0d9bb1606
parent204721d7eabe6ee98aafce791ce3efdbc4715834 (diff)
perf hists browser: Add parameter to disable lost event warning
For overwrite mode, the ringbuffer will be paused. The event lost is expected. It needs a way to notify the browser not print the warning. It will be used later for perf top to disable lost event warning in overwrite mode. There is no behavior change for now. Signed-off-by: Kan Liang <kan.liang@intel.com> Acked-by: Jiri Olsa <jolsa@kernel.org> Cc: Andi Kleen <ak@linux.intel.com> Cc: Jin Yao <yao.jin@linux.intel.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Wang Nan <wangnan0@huawei.com> Link: http://lkml.kernel.org/r/1516310792-208685-15-git-send-email-kan.liang@intel.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r--tools/perf/builtin-c2c.c4
-rw-r--r--tools/perf/builtin-report.c3
-rw-r--r--tools/perf/builtin-top.c2
-rw-r--r--tools/perf/ui/browsers/hists.c38
-rw-r--r--tools/perf/ui/browsers/hists.h3
-rw-r--r--tools/perf/util/hist.h6
6 files changed, 36 insertions, 20 deletions
diff --git a/tools/perf/builtin-c2c.c b/tools/perf/builtin-c2c.c
index c0815a37fdb5..539c3d460158 100644
--- a/tools/perf/builtin-c2c.c
+++ b/tools/perf/builtin-c2c.c
@@ -2245,7 +2245,7 @@ static int perf_c2c__browse_cacheline(struct hist_entry *he)
2245 c2c_browser__update_nr_entries(browser); 2245 c2c_browser__update_nr_entries(browser);
2246 2246
2247 while (1) { 2247 while (1) {
2248 key = hist_browser__run(browser, "? - help"); 2248 key = hist_browser__run(browser, "? - help", true);
2249 2249
2250 switch (key) { 2250 switch (key) {
2251 case 's': 2251 case 's':
@@ -2314,7 +2314,7 @@ static int perf_c2c__hists_browse(struct hists *hists)
2314 c2c_browser__update_nr_entries(browser); 2314 c2c_browser__update_nr_entries(browser);
2315 2315
2316 while (1) { 2316 while (1) {
2317 key = hist_browser__run(browser, "? - help"); 2317 key = hist_browser__run(browser, "? - help", true);
2318 2318
2319 switch (key) { 2319 switch (key) {
2320 case 'q': 2320 case 'q':
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 42a52dcc41cd..4ad5dc649716 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -530,7 +530,8 @@ static int report__browse_hists(struct report *rep)
530 case 1: 530 case 1:
531 ret = perf_evlist__tui_browse_hists(evlist, help, NULL, 531 ret = perf_evlist__tui_browse_hists(evlist, help, NULL,
532 rep->min_percent, 532 rep->min_percent,
533 &session->header.env); 533 &session->header.env,
534 true);
534 /* 535 /*
535 * Usually "ret" is the last pressed key, and we only 536 * Usually "ret" is the last pressed key, and we only
536 * care if the key notifies us to switch data file. 537 * care if the key notifies us to switch data file.
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index ee4bba1e282c..7def861a9ec4 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -611,7 +611,7 @@ static void *display_thread_tui(void *arg)
611 611
612 perf_evlist__tui_browse_hists(top->evlist, help, &hbt, 612 perf_evlist__tui_browse_hists(top->evlist, help, &hbt,
613 top->min_percent, 613 top->min_percent,
614 &top->session->header.env); 614 &top->session->header.env, true);
615 615
616 done = 1; 616 done = 1;
617 return NULL; 617 return NULL;
diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index 68146f4620a5..6495ee55d9c3 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -608,7 +608,8 @@ static int hist_browser__title(struct hist_browser *browser, char *bf, size_t si
608 return browser->title ? browser->title(browser, bf, size) : 0; 608 return browser->title ? browser->title(browser, bf, size) : 0;
609} 609}
610 610
611int hist_browser__run(struct hist_browser *browser, const char *help) 611int hist_browser__run(struct hist_browser *browser, const char *help,
612 bool warn_lost_event)
612{ 613{
613 int key; 614 int key;
614 char title[160]; 615 char title[160];
@@ -638,8 +639,9 @@ int hist_browser__run(struct hist_browser *browser, const char *help)
638 nr_entries = hist_browser__nr_entries(browser); 639 nr_entries = hist_browser__nr_entries(browser);
639 ui_browser__update_nr_entries(&browser->b, nr_entries); 640 ui_browser__update_nr_entries(&browser->b, nr_entries);
640 641
641 if (browser->hists->stats.nr_lost_warned != 642 if (warn_lost_event &&
642 browser->hists->stats.nr_events[PERF_RECORD_LOST]) { 643 (browser->hists->stats.nr_lost_warned !=
644 browser->hists->stats.nr_events[PERF_RECORD_LOST])) {
643 browser->hists->stats.nr_lost_warned = 645 browser->hists->stats.nr_lost_warned =
644 browser->hists->stats.nr_events[PERF_RECORD_LOST]; 646 browser->hists->stats.nr_events[PERF_RECORD_LOST];
645 ui_browser__warn_lost_events(&browser->b); 647 ui_browser__warn_lost_events(&browser->b);
@@ -2763,7 +2765,8 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events,
2763 bool left_exits, 2765 bool left_exits,
2764 struct hist_browser_timer *hbt, 2766 struct hist_browser_timer *hbt,
2765 float min_pcnt, 2767 float min_pcnt,
2766 struct perf_env *env) 2768 struct perf_env *env,
2769 bool warn_lost_event)
2767{ 2770{
2768 struct hists *hists = evsel__hists(evsel); 2771 struct hists *hists = evsel__hists(evsel);
2769 struct hist_browser *browser = perf_evsel_browser__new(evsel, hbt, env); 2772 struct hist_browser *browser = perf_evsel_browser__new(evsel, hbt, env);
@@ -2844,7 +2847,8 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events,
2844 2847
2845 nr_options = 0; 2848 nr_options = 0;
2846 2849
2847 key = hist_browser__run(browser, helpline); 2850 key = hist_browser__run(browser, helpline,
2851 warn_lost_event);
2848 2852
2849 if (browser->he_selection != NULL) { 2853 if (browser->he_selection != NULL) {
2850 thread = hist_browser__selected_thread(browser); 2854 thread = hist_browser__selected_thread(browser);
@@ -3184,7 +3188,8 @@ static void perf_evsel_menu__write(struct ui_browser *browser,
3184 3188
3185static int perf_evsel_menu__run(struct perf_evsel_menu *menu, 3189static int perf_evsel_menu__run(struct perf_evsel_menu *menu,
3186 int nr_events, const char *help, 3190 int nr_events, const char *help,
3187 struct hist_browser_timer *hbt) 3191 struct hist_browser_timer *hbt,
3192 bool warn_lost_event)
3188{ 3193{
3189 struct perf_evlist *evlist = menu->b.priv; 3194 struct perf_evlist *evlist = menu->b.priv;
3190 struct perf_evsel *pos; 3195 struct perf_evsel *pos;
@@ -3203,7 +3208,9 @@ static int perf_evsel_menu__run(struct perf_evsel_menu *menu,
3203 case K_TIMER: 3208 case K_TIMER:
3204 hbt->timer(hbt->arg); 3209 hbt->timer(hbt->arg);
3205 3210
3206 if (!menu->lost_events_warned && menu->lost_events) { 3211 if (!menu->lost_events_warned &&
3212 menu->lost_events &&
3213 warn_lost_event) {
3207 ui_browser__warn_lost_events(&menu->b); 3214 ui_browser__warn_lost_events(&menu->b);
3208 menu->lost_events_warned = true; 3215 menu->lost_events_warned = true;
3209 } 3216 }
@@ -3224,7 +3231,8 @@ browse_hists:
3224 key = perf_evsel__hists_browse(pos, nr_events, help, 3231 key = perf_evsel__hists_browse(pos, nr_events, help,
3225 true, hbt, 3232 true, hbt,
3226 menu->min_pcnt, 3233 menu->min_pcnt,
3227 menu->env); 3234 menu->env,
3235 warn_lost_event);
3228 ui_browser__show_title(&menu->b, title); 3236 ui_browser__show_title(&menu->b, title);
3229 switch (key) { 3237 switch (key) {
3230 case K_TAB: 3238 case K_TAB:
@@ -3282,7 +3290,8 @@ static int __perf_evlist__tui_browse_hists(struct perf_evlist *evlist,
3282 int nr_entries, const char *help, 3290 int nr_entries, const char *help,
3283 struct hist_browser_timer *hbt, 3291 struct hist_browser_timer *hbt,
3284 float min_pcnt, 3292 float min_pcnt,
3285 struct perf_env *env) 3293 struct perf_env *env,
3294 bool warn_lost_event)
3286{ 3295{
3287 struct perf_evsel *pos; 3296 struct perf_evsel *pos;
3288 struct perf_evsel_menu menu = { 3297 struct perf_evsel_menu menu = {
@@ -3309,13 +3318,15 @@ static int __perf_evlist__tui_browse_hists(struct perf_evlist *evlist,
3309 menu.b.width = line_len; 3318 menu.b.width = line_len;
3310 } 3319 }
3311 3320
3312 return perf_evsel_menu__run(&menu, nr_entries, help, hbt); 3321 return perf_evsel_menu__run(&menu, nr_entries, help,
3322 hbt, warn_lost_event);
3313} 3323}
3314 3324
3315int perf_evlist__tui_browse_hists(struct perf_evlist *evlist, const char *help, 3325int perf_evlist__tui_browse_hists(struct perf_evlist *evlist, const char *help,
3316 struct hist_browser_timer *hbt, 3326 struct hist_browser_timer *hbt,
3317 float min_pcnt, 3327 float min_pcnt,
3318 struct perf_env *env) 3328 struct perf_env *env,
3329 bool warn_lost_event)
3319{ 3330{
3320 int nr_entries = evlist->nr_entries; 3331 int nr_entries = evlist->nr_entries;
3321 3332
@@ -3325,7 +3336,7 @@ single_entry:
3325 3336
3326 return perf_evsel__hists_browse(first, nr_entries, help, 3337 return perf_evsel__hists_browse(first, nr_entries, help,
3327 false, hbt, min_pcnt, 3338 false, hbt, min_pcnt,
3328 env); 3339 env, warn_lost_event);
3329 } 3340 }
3330 3341
3331 if (symbol_conf.event_group) { 3342 if (symbol_conf.event_group) {
@@ -3342,5 +3353,6 @@ single_entry:
3342 } 3353 }
3343 3354
3344 return __perf_evlist__tui_browse_hists(evlist, nr_entries, help, 3355 return __perf_evlist__tui_browse_hists(evlist, nr_entries, help,
3345 hbt, min_pcnt, env); 3356 hbt, min_pcnt, env,
3357 warn_lost_event);
3346} 3358}
diff --git a/tools/perf/ui/browsers/hists.h b/tools/perf/ui/browsers/hists.h
index ba431777f559..9428bee076f2 100644
--- a/tools/perf/ui/browsers/hists.h
+++ b/tools/perf/ui/browsers/hists.h
@@ -28,7 +28,8 @@ struct hist_browser {
28 28
29struct hist_browser *hist_browser__new(struct hists *hists); 29struct hist_browser *hist_browser__new(struct hists *hists);
30void hist_browser__delete(struct hist_browser *browser); 30void hist_browser__delete(struct hist_browser *browser);
31int hist_browser__run(struct hist_browser *browser, const char *help); 31int hist_browser__run(struct hist_browser *browser, const char *help,
32 bool warn_lost_event);
32void hist_browser__init(struct hist_browser *browser, 33void hist_browser__init(struct hist_browser *browser,
33 struct hists *hists); 34 struct hists *hists);
34#endif /* _PERF_UI_BROWSER_HISTS_H_ */ 35#endif /* _PERF_UI_BROWSER_HISTS_H_ */
diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h
index f6630cb95eff..02721b579746 100644
--- a/tools/perf/util/hist.h
+++ b/tools/perf/util/hist.h
@@ -430,7 +430,8 @@ int hist_entry__tui_annotate(struct hist_entry *he, struct perf_evsel *evsel,
430int perf_evlist__tui_browse_hists(struct perf_evlist *evlist, const char *help, 430int perf_evlist__tui_browse_hists(struct perf_evlist *evlist, const char *help,
431 struct hist_browser_timer *hbt, 431 struct hist_browser_timer *hbt,
432 float min_pcnt, 432 float min_pcnt,
433 struct perf_env *env); 433 struct perf_env *env,
434 bool warn_lost_event);
434int script_browse(const char *script_opt); 435int script_browse(const char *script_opt);
435#else 436#else
436static inline 437static inline
@@ -438,7 +439,8 @@ int perf_evlist__tui_browse_hists(struct perf_evlist *evlist __maybe_unused,
438 const char *help __maybe_unused, 439 const char *help __maybe_unused,
439 struct hist_browser_timer *hbt __maybe_unused, 440 struct hist_browser_timer *hbt __maybe_unused,
440 float min_pcnt __maybe_unused, 441 float min_pcnt __maybe_unused,
441 struct perf_env *env __maybe_unused) 442 struct perf_env *env __maybe_unused,
443 bool warn_lost_event __maybe_unused)
442{ 444{
443 return 0; 445 return 0;
444} 446}