Commit 06cc1a47 authored by Kan Liang's avatar Kan Liang Committed by Arnaldo Carvalho de Melo

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: default avatarKan Liang <kan.liang@intel.com>
Acked-by: default avatarJiri 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.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 204721d7
...@@ -2245,7 +2245,7 @@ static int perf_c2c__browse_cacheline(struct hist_entry *he) ...@@ -2245,7 +2245,7 @@ static int perf_c2c__browse_cacheline(struct hist_entry *he)
c2c_browser__update_nr_entries(browser); c2c_browser__update_nr_entries(browser);
while (1) { while (1) {
key = hist_browser__run(browser, "? - help"); key = hist_browser__run(browser, "? - help", true);
switch (key) { switch (key) {
case 's': case 's':
...@@ -2314,7 +2314,7 @@ static int perf_c2c__hists_browse(struct hists *hists) ...@@ -2314,7 +2314,7 @@ static int perf_c2c__hists_browse(struct hists *hists)
c2c_browser__update_nr_entries(browser); c2c_browser__update_nr_entries(browser);
while (1) { while (1) {
key = hist_browser__run(browser, "? - help"); key = hist_browser__run(browser, "? - help", true);
switch (key) { switch (key) {
case 'q': case 'q':
......
...@@ -530,7 +530,8 @@ static int report__browse_hists(struct report *rep) ...@@ -530,7 +530,8 @@ static int report__browse_hists(struct report *rep)
case 1: case 1:
ret = perf_evlist__tui_browse_hists(evlist, help, NULL, ret = perf_evlist__tui_browse_hists(evlist, help, NULL,
rep->min_percent, rep->min_percent,
&session->header.env); &session->header.env,
true);
/* /*
* Usually "ret" is the last pressed key, and we only * Usually "ret" is the last pressed key, and we only
* care if the key notifies us to switch data file. * care if the key notifies us to switch data file.
......
...@@ -611,7 +611,7 @@ static void *display_thread_tui(void *arg) ...@@ -611,7 +611,7 @@ static void *display_thread_tui(void *arg)
perf_evlist__tui_browse_hists(top->evlist, help, &hbt, perf_evlist__tui_browse_hists(top->evlist, help, &hbt,
top->min_percent, top->min_percent,
&top->session->header.env); &top->session->header.env, true);
done = 1; done = 1;
return NULL; return NULL;
......
...@@ -608,7 +608,8 @@ static int hist_browser__title(struct hist_browser *browser, char *bf, size_t si ...@@ -608,7 +608,8 @@ static int hist_browser__title(struct hist_browser *browser, char *bf, size_t si
return browser->title ? browser->title(browser, bf, size) : 0; return browser->title ? browser->title(browser, bf, size) : 0;
} }
int hist_browser__run(struct hist_browser *browser, const char *help) int hist_browser__run(struct hist_browser *browser, const char *help,
bool warn_lost_event)
{ {
int key; int key;
char title[160]; char title[160];
...@@ -638,8 +639,9 @@ int hist_browser__run(struct hist_browser *browser, const char *help) ...@@ -638,8 +639,9 @@ int hist_browser__run(struct hist_browser *browser, const char *help)
nr_entries = hist_browser__nr_entries(browser); nr_entries = hist_browser__nr_entries(browser);
ui_browser__update_nr_entries(&browser->b, nr_entries); ui_browser__update_nr_entries(&browser->b, nr_entries);
if (browser->hists->stats.nr_lost_warned != if (warn_lost_event &&
browser->hists->stats.nr_events[PERF_RECORD_LOST]) { (browser->hists->stats.nr_lost_warned !=
browser->hists->stats.nr_events[PERF_RECORD_LOST])) {
browser->hists->stats.nr_lost_warned = browser->hists->stats.nr_lost_warned =
browser->hists->stats.nr_events[PERF_RECORD_LOST]; browser->hists->stats.nr_events[PERF_RECORD_LOST];
ui_browser__warn_lost_events(&browser->b); 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,7 +2765,8 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events,
bool left_exits, bool left_exits,
struct hist_browser_timer *hbt, struct hist_browser_timer *hbt,
float min_pcnt, float min_pcnt,
struct perf_env *env) struct perf_env *env,
bool warn_lost_event)
{ {
struct hists *hists = evsel__hists(evsel); struct hists *hists = evsel__hists(evsel);
struct hist_browser *browser = perf_evsel_browser__new(evsel, hbt, env); 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,7 +2847,8 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events,
nr_options = 0; nr_options = 0;
key = hist_browser__run(browser, helpline); key = hist_browser__run(browser, helpline,
warn_lost_event);
if (browser->he_selection != NULL) { if (browser->he_selection != NULL) {
thread = hist_browser__selected_thread(browser); thread = hist_browser__selected_thread(browser);
...@@ -3184,7 +3188,8 @@ static void perf_evsel_menu__write(struct ui_browser *browser, ...@@ -3184,7 +3188,8 @@ static void perf_evsel_menu__write(struct ui_browser *browser,
static int perf_evsel_menu__run(struct perf_evsel_menu *menu, static int perf_evsel_menu__run(struct perf_evsel_menu *menu,
int nr_events, const char *help, int nr_events, const char *help,
struct hist_browser_timer *hbt) struct hist_browser_timer *hbt,
bool warn_lost_event)
{ {
struct perf_evlist *evlist = menu->b.priv; struct perf_evlist *evlist = menu->b.priv;
struct perf_evsel *pos; struct perf_evsel *pos;
...@@ -3203,7 +3208,9 @@ static int perf_evsel_menu__run(struct perf_evsel_menu *menu, ...@@ -3203,7 +3208,9 @@ static int perf_evsel_menu__run(struct perf_evsel_menu *menu,
case K_TIMER: case K_TIMER:
hbt->timer(hbt->arg); hbt->timer(hbt->arg);
if (!menu->lost_events_warned && menu->lost_events) { if (!menu->lost_events_warned &&
menu->lost_events &&
warn_lost_event) {
ui_browser__warn_lost_events(&menu->b); ui_browser__warn_lost_events(&menu->b);
menu->lost_events_warned = true; menu->lost_events_warned = true;
} }
...@@ -3224,7 +3231,8 @@ static int perf_evsel_menu__run(struct perf_evsel_menu *menu, ...@@ -3224,7 +3231,8 @@ static int perf_evsel_menu__run(struct perf_evsel_menu *menu,
key = perf_evsel__hists_browse(pos, nr_events, help, key = perf_evsel__hists_browse(pos, nr_events, help,
true, hbt, true, hbt,
menu->min_pcnt, menu->min_pcnt,
menu->env); menu->env,
warn_lost_event);
ui_browser__show_title(&menu->b, title); ui_browser__show_title(&menu->b, title);
switch (key) { switch (key) {
case K_TAB: case K_TAB:
...@@ -3282,7 +3290,8 @@ static int __perf_evlist__tui_browse_hists(struct perf_evlist *evlist, ...@@ -3282,7 +3290,8 @@ static int __perf_evlist__tui_browse_hists(struct perf_evlist *evlist,
int nr_entries, const char *help, int nr_entries, const char *help,
struct hist_browser_timer *hbt, struct hist_browser_timer *hbt,
float min_pcnt, float min_pcnt,
struct perf_env *env) struct perf_env *env,
bool warn_lost_event)
{ {
struct perf_evsel *pos; struct perf_evsel *pos;
struct perf_evsel_menu menu = { struct perf_evsel_menu menu = {
...@@ -3309,13 +3318,15 @@ static int __perf_evlist__tui_browse_hists(struct perf_evlist *evlist, ...@@ -3309,13 +3318,15 @@ static int __perf_evlist__tui_browse_hists(struct perf_evlist *evlist,
menu.b.width = line_len; menu.b.width = line_len;
} }
return perf_evsel_menu__run(&menu, nr_entries, help, hbt); return perf_evsel_menu__run(&menu, nr_entries, help,
hbt, warn_lost_event);
} }
int perf_evlist__tui_browse_hists(struct perf_evlist *evlist, const char *help, int perf_evlist__tui_browse_hists(struct perf_evlist *evlist, const char *help,
struct hist_browser_timer *hbt, struct hist_browser_timer *hbt,
float min_pcnt, float min_pcnt,
struct perf_env *env) struct perf_env *env,
bool warn_lost_event)
{ {
int nr_entries = evlist->nr_entries; int nr_entries = evlist->nr_entries;
...@@ -3325,7 +3336,7 @@ int perf_evlist__tui_browse_hists(struct perf_evlist *evlist, const char *help, ...@@ -3325,7 +3336,7 @@ int perf_evlist__tui_browse_hists(struct perf_evlist *evlist, const char *help,
return perf_evsel__hists_browse(first, nr_entries, help, return perf_evsel__hists_browse(first, nr_entries, help,
false, hbt, min_pcnt, false, hbt, min_pcnt,
env); env, warn_lost_event);
} }
if (symbol_conf.event_group) { if (symbol_conf.event_group) {
...@@ -3342,5 +3353,6 @@ int perf_evlist__tui_browse_hists(struct perf_evlist *evlist, const char *help, ...@@ -3342,5 +3353,6 @@ int perf_evlist__tui_browse_hists(struct perf_evlist *evlist, const char *help,
} }
return __perf_evlist__tui_browse_hists(evlist, nr_entries, help, return __perf_evlist__tui_browse_hists(evlist, nr_entries, help,
hbt, min_pcnt, env); hbt, min_pcnt, env,
warn_lost_event);
} }
...@@ -28,7 +28,8 @@ struct hist_browser { ...@@ -28,7 +28,8 @@ struct hist_browser {
struct hist_browser *hist_browser__new(struct hists *hists); struct hist_browser *hist_browser__new(struct hists *hists);
void hist_browser__delete(struct hist_browser *browser); void hist_browser__delete(struct hist_browser *browser);
int hist_browser__run(struct hist_browser *browser, const char *help); int hist_browser__run(struct hist_browser *browser, const char *help,
bool warn_lost_event);
void hist_browser__init(struct hist_browser *browser, void hist_browser__init(struct hist_browser *browser,
struct hists *hists); struct hists *hists);
#endif /* _PERF_UI_BROWSER_HISTS_H_ */ #endif /* _PERF_UI_BROWSER_HISTS_H_ */
...@@ -430,7 +430,8 @@ int hist_entry__tui_annotate(struct hist_entry *he, struct perf_evsel *evsel, ...@@ -430,7 +430,8 @@ int hist_entry__tui_annotate(struct hist_entry *he, struct perf_evsel *evsel,
int perf_evlist__tui_browse_hists(struct perf_evlist *evlist, const char *help, int perf_evlist__tui_browse_hists(struct perf_evlist *evlist, const char *help,
struct hist_browser_timer *hbt, struct hist_browser_timer *hbt,
float min_pcnt, float min_pcnt,
struct perf_env *env); struct perf_env *env,
bool warn_lost_event);
int script_browse(const char *script_opt); int script_browse(const char *script_opt);
#else #else
static inline static inline
...@@ -438,7 +439,8 @@ int perf_evlist__tui_browse_hists(struct perf_evlist *evlist __maybe_unused, ...@@ -438,7 +439,8 @@ int perf_evlist__tui_browse_hists(struct perf_evlist *evlist __maybe_unused,
const char *help __maybe_unused, const char *help __maybe_unused,
struct hist_browser_timer *hbt __maybe_unused, struct hist_browser_timer *hbt __maybe_unused,
float min_pcnt __maybe_unused, float min_pcnt __maybe_unused,
struct perf_env *env __maybe_unused) struct perf_env *env __maybe_unused,
bool warn_lost_event __maybe_unused)
{ {
return 0; return 0;
} }
......
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