Re: [PATCH V4 12/15] perf hists browser: add parameter to disable lost event warning

From: Namhyung Kim
Date: Tue Jan 16 2018 - 22:53:14 EST


Hi,

On Mon, Jan 15, 2018 at 12:20:48PM -0800, kan.liang@xxxxxxxxx wrote:
> From: Kan Liang <kan.liang@xxxxxxxxx>
>
> 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@xxxxxxxxx>
> ---

[SNIP]
> diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
> index 68146f4..e458920 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
> 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 no_lost_event_warning)
> {
> int key;
> char title[160];
> @@ -638,8 +639,9 @@ int hist_browser__run(struct hist_browser *browser, const char *help)
> nr_entries = hist_browser__nr_entries(browser);
> ui_browser__update_nr_entries(&browser->b, nr_entries);
>
> - if (browser->hists->stats.nr_lost_warned !=
> - browser->hists->stats.nr_events[PERF_RECORD_LOST]) {
> + if (!no_lost_event_warning &&

Double negation is always confusing (at least for me), why not making
it "warn_lost_event"?

Thanks,
Namhyung


> + (browser->hists->stats.nr_lost_warned !=
> + browser->hists->stats.nr_events[PERF_RECORD_LOST])) {
> browser->hists->stats.nr_lost_warned =
> browser->hists->stats.nr_events[PERF_RECORD_LOST];
> ui_browser__warn_lost_events(&browser->b);