summaryrefslogtreecommitdiffstats
path: root/tools/perf/util/ui
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2011-09-01 14:27:58 -0300
committerArnaldo Carvalho de Melo <acme@redhat.com>2011-09-29 16:41:38 -0300
commitdcc101d1d02eb80ab0349c5410f8728412c35636 (patch)
tree9f91b0f6da160c767bee572296e59a46017c25e7 /tools/perf/util/ui
parenteb489008312c848dce8ff76282b8e65c530c2e26 (diff)
perf top: Improve lost events warning
Now it warns everytime that new events are lost. And the TUI also warns now. Cc: David Ahern <dsahern@gmail.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Link: http://lkml.kernel.org/n/tip-w1n168yrvrppnq6887s4u0wx@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/ui')
-rw-r--r--tools/perf/util/ui/browsers/top.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/tools/perf/util/ui/browsers/top.c b/tools/perf/util/ui/browsers/top.c
index 9d938106510..9b6b43b32ac 100644
--- a/tools/perf/util/ui/browsers/top.c
+++ b/tools/perf/util/ui/browsers/top.c
@@ -11,10 +11,12 @@
#include "../helpline.h"
#include "../libslang.h"
#include "../util.h"
+#include "../ui.h"
#include "../../evlist.h"
#include "../../hist.h"
#include "../../sort.h"
#include "../../symbol.h"
+#include "../../session.h"
#include "../../top.h"
struct perf_top_browser {
@@ -143,6 +145,25 @@ do_annotation:
symbol__tui_annotate(sym, syme->map, 0, top->delay_secs * 1000);
}
+static void perf_top_browser__warn_lost(struct perf_top_browser *browser)
+{
+ struct perf_top *top = browser->b.priv;
+ char msg[128];
+ int len;
+
+ top->total_lost_warned = top->session->hists.stats.total_lost;
+ pthread_mutex_lock(&ui__lock);
+ ui_browser__set_color(&browser->b, HE_COLORSET_TOP);
+ len = snprintf(msg, sizeof(msg),
+ " WARNING: LOST %" PRIu64 " events, Check IO/CPU overload",
+ top->total_lost_warned);
+ if (len > browser->b.width)
+ len = browser->b.width;
+ SLsmg_gotorc(0, browser->b.width - len);
+ slsmg_write_nstring(msg, len);
+ pthread_mutex_unlock(&ui__lock);
+}
+
static int perf_top_browser__run(struct perf_top_browser *browser)
{
int key;
@@ -174,6 +195,9 @@ static int perf_top_browser__run(struct perf_top_browser *browser)
ui_browser__set_color(&browser->b, NEWT_COLORSET_ROOT);
SLsmg_gotorc(0, 0);
slsmg_write_nstring(title, browser->b.width);
+
+ if (top->total_lost_warned != top->session->hists.stats.total_lost)
+ perf_top_browser__warn_lost(browser);
break;
case 'a':
case NEWT_KEY_RIGHT: