aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/ui (follow)
AgeCommit message (Collapse)AuthorFilesLines
2012-01-30perf tools: Remove unnecessary ctype.h inclusionNamhyung Kim1-1/+1
There are unnecessary #include <ctype.h> out there, and they might cause a nasty build failure in some environment. As we already have most of ctype macros in util.h, just get rid of them. A few of exceptions are util/symbol.c which needs isupper() macro util.h doesn't provide and perl scripting support code which includes ctype.h internally. Suggested-by: Ingo Molnar <mingo@elte.hu> Cc: Ingo Molnar <mingo@elte.hu> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/r/1327827356-8786-4-git-send-email-namhyung@gmail.com Signed-off-by: Namhyung Kim <namhyung@gmail.com> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2012-01-24perf tools: Fix broken build by defining _GNU_SOURCE in MakefileDavid Daney2-3/+0
When building on my Debian/mips system, util/util.c fails to build because commit 1aed2671738785e8f5aea663a6fda91aa7ef59b5 (perf kvm: Do guest-only counting by default) indirectly includes stdio.h before the feature selection in util.h is done. This prevents _GNU_SOURCE in util.h from enabling the declaration of getline(), from now second inclusion of stdio.h, and the build is broken. There is another breakage in util/evsel.c caused by include ordering, but I didn't fully track down the commit that caused it. The root cause of all this is an inconsistent definition of _GNU_SOURCE, so I move the definition into the Makefile so that it is passed to all invocations of the compiler and used uniformly for all system header files. All other #define and #undef of _GNU_SOURCE are removed as they cause conflicts with the definition passed to the compiler. All the features.h definitions (_LARGEFILE64_SOURCE _FILE_OFFSET_BITS=64 and _GNU_SOURCE) are needed by the python glue code too, so they are moved to BASIC_CFLAGS, and the misleading comments about BASIC_CFLAGS are removed. This gives me a clean build on x86_64 (fc12) and mips (Debian). Cc: David Daney <david.daney@cavium.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Joerg Roedel <joerg.roedel@amd.com> Cc: Namhyung Kim <namhyung.kim@lge.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/r/1326836461-11952-1-git-send-email-ddaney.cavm@gmail.com Signed-off-by: David Daney <david.daney@cavium.com> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2012-01-24perf tools: Introduce per user viewArnaldo Carvalho de Melo1-0/+3
The new --uid command line option will show only the tasks for a given user, using the proc interface to figure out the existing tasks. Kernel work is needed to close races at startup, but this should already be useful in many use cases. 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-bdnspm000gw2l984a2t53o8z@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2011-11-28perf symbols: Add nr_events to symbol_confArnaldo Carvalho de Melo2-10/+8
Since symbol__alloc_hists need it, to avoid passing it around in many functions have it in the symbol_conf struct. 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-cwv8ysvpywzjq4v3xtbd4zwv@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2011-11-28perf ui progress: Fix divide by zeroArnaldo Carvalho de Melo1-0/+3
Happens in a perf.data file where one of the events had no samples. 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-j7st3oyiotvfxqde2nc41kxb@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2011-11-02perf hists browser: Warn about lost eventsArnaldo Carvalho de Melo3-11/+62
Just like the old perf top --tui and the --stdio version. But because we have the initial menu to choose which event to show in a session with multiple events we can see how many chunks were lost in each of the event types, clarifying which events are being affected the most. 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-47yyqbubmjzch2chezmb21m6@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2011-10-26perf ui browser: Handle K_RESIZE in dialog windowsArnaldo Carvalho de Melo7-20/+87
Just provide wrappers for things like ui__warning, ui__dialog_yesno and if they return K_RESIZE, refresh dimensions, redraw the entries, etc. 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-3ih7hyk9weryxaxb501sfq4u@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2011-10-26perf ui browser: No need to switch char sets that oftenArnaldo Carvalho de Melo1-3/+5
Just before and after the loop. 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-0lh91cedngyg1pqarbky5vn7@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2011-10-26perf hists browser: Use K_TIMERArnaldo Carvalho de Melo1-3/+2
In the switch case entry for the timer routine. 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-ypw3i9kmxoq28skx7jy914it@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2011-10-26perf ui: Reimplement the popup windows using libslangArnaldo Carvalho de Melo4-64/+70
Just another step in stopping the use of libnewt in perf. 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-vtxnmz1t1807ykprapnk9njl@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2011-10-26perf ui: Reimplement ui__popup_menu using ui__browserArnaldo Carvalho de Melo3-30/+97
Right now let it work just like the other browsers: in full screen, at the top left corner. If people complain we can revisit, I found it OK and the laziest/quickest approach at reusing the ui_browser ;-) 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-4bgeqizcxh04q0sk24cw43gk@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2011-10-26perf ui: Reimplement ui_helpline using libslangArnaldo Carvalho de Melo1-4/+6
Just another step in stopping the use of libnewt in perf. 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-gh7e1v2z7pzqmok02r6zvp17@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2011-10-26perf ui: Improve handling sigwinch a bitArnaldo Carvalho de Melo5-47/+82
No need to unblock it at each ui__getch() and also allow other users to check if a resize is needed, or force an refresh of terminal dimensions. The 'force' one shouldn't be needed, but its in a slow path, so leave it like that for now, I'll revisit this another day. 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-aujchu6yx3bfy64non1rky0w@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2011-10-26perf ui progress: Reimplement using slangArnaldo Carvalho de Melo2-53/+18
Just another step in stopping the use of libnewt in perf. 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-vkb9jh5kkzl5ep3puoatd6an@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2011-10-21perf hists browser: Refuse 'a' hotkey on non symbolic viewsArnaldo Carvalho de Melo1-0/+7
We don't allocate the histogram data structures for --sort lists without "sym", so, just like was done for the menu, don't try to annotate when 'a' is pressed, just warn the user about it. Reported-by: David Ahern <dsahern@gmail.com> 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-27mjg02s2mbw8lfxqv7jpzec@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2011-10-20perf ui browser: Use libslang to read keysArnaldo Carvalho de Melo6-54/+117
Just another step in stopping the use of libnewt in perf. 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-uy6s534uqxq8tenh6s3k8ocj@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2011-10-20perf hists browser: Elide DSO column when it is set to just one DSO, ditto for threadsArnaldo Carvalho de Melo1-0/+4
And also no leed to show the [.] (level: k, . for userspace) when showing just one DSO. 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-4h3f6ro5o7ebepjbssxf0dd3@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2011-10-19perf hists browser: Honour symbol_conf.show_{nr_samples,total_period}Arnaldo Carvalho de Melo1-0/+10
We lost that when we move it outside hist_entry__snprintf, but better leave it untangled of 'perf diff' stuff (pair_hist, etc). 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-qlhb6ictf5twykog6x344s0b@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2011-10-19perf hists browser: Do not exit on tab key with single eventDavid Ahern1-0/+2
TUI help states for multiple event sessions the TAB/UNTAB keys are used to switch events. For single event sessions (e.g., the default) the tab key currently causes the tui to exit. Change that to do nothing since there is not no second event to switch to. Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Peter Zijlstra <peterz@infradead.org> Link: http://lkml.kernel.org/r/1319045867-12728-1-git-send-email-dsahern@gmail.com Signed-off-by: David Ahern <dsahern@gmail.com> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2011-10-19perf annotate browser: Don't change selection line when returning from callqArnaldo Carvalho de Melo1-1/+1
When the user navigates to another annotation browser pressing -> on a 'callq' line, on exit (<-) return to the originating 'callq' line. Reported-by: Ingo Molnar <mingo@elte.hu> 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-z5vgver0jgevbiicfndqni5g@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2011-10-19perf hists: Move the dso and thread filters from hist_browserArnaldo Carvalho de Melo1-26/+22
Since with dynamic addition of new hist entries we need to apply those filters as we merge new batches of hist_entry instances, for instance in perf top. 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-zjhhf8kh9w1buty9p10od6rz@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2011-10-19perf ui browser: Honour the xterm colorsArnaldo Carvalho de Melo1-5/+5
So slang after all _has_ a 'default' color, call me color blind. Change the default to it. Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Mike Galbraith <efault@gmx.de> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Cc: Tom Zanussi <tzanussi@gmail.com> Link: http://lkml.kernel.org/n/tip-1dfxivxv0jhwldpds3v4zla2@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2011-10-18perf top tui: Give color hints just on the percentage, like on --stdioArnaldo Carvalho de Melo1-0/+3
And like it was in the old top. Another change so that the familiarity with the old visual is maintained. 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-ypmyx9p0ah4byqaygrnb09x8@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2011-10-18perf ui browser: Make the colors configurable and change the defaultsArnaldo Carvalho de Melo1-18/+81
Just use as a starting point the "[colors]" section of tools/perf/Documentation/perfconfig.example. Changed the colors to be the ones in the old perf tool if used in a green on black xterm. The next patches should allow using the colors configured for the xterm. 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-3vqmyerkaqltqolmnlehonew@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2011-10-18perf tui: Remove unneeded call to newtCls on startupArnaldo Carvalho de Melo1-1/+0
That was just filling the screen with blue, even if not a crash, not something pleasant nor useful ;-) 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-58znjqvan9b1mv5pojxboidg@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2011-10-18perf hists: Don't format the percentage on hist_entry__snprintfArnaldo Carvalho de Melo1-3/+4
We can't have color correctly set there because in libslang (and in a future GUI) the colors must be set on a separate function call, so move that part to a separate function and make the stdio fprintf function call it. 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-jpgy42438ce9tgbqppm397lq@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2011-10-18perf ui browser: Allow initial use without navigation UI elementsArnaldo Carvalho de Melo4-17/+39
The selection and scroll bar are really needed only when the user starts navigating, before that it just provide distractions. This also brings the initial screen to look more like the stdio UI, which more people are used to. The new code is flexible enough that menu like browsers can opt out and start with those UI elements. 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-jfgok30kkerpfw8wtcltgy6z@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2011-10-18perf tui: Catch signals to exit gracefullyArnaldo Carvalho de Melo1-1/+23
Resetting the terminal to a sane state. Reported-by: Ingo Molnar <mingo@elte.hu> 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-myu44ujofadcy3y6an2mk383@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2011-10-18perf hists browser: Add missing hotkeys to the help windowArnaldo Carvalho de Melo1-10/+13
The navigation keys were missing (UP, DOWN arrows, etc). 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-3pnln0bws5v0yoqwd3f020nx@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2011-10-17perf hists browser: Add missing stdarg.h includeMike Galbraith1-0/+1
CC util/ui/browsers/annotate.o In file included from util/ui/browsers/annotate.c:2:0: util/ui/browsers/../helpline.h:9:42: error: expected declaration specifiers or ‘...’ before ‘va_list’ CC util/ui/browsers/hists.o make: *** [util/ui/browsers/annotate.o] Error 1 make: *** Waiting for unfinished jobs.... Signed-off-by: Mike Galbraith <efault@gmx.de> Link: http://lkml.kernel.org/n/tip-9vefl2807smi7t4luhs00tg6@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2011-10-14perf annotate browser: Allow toggling the visualization of source code linesArnaldo Carvalho de Melo1-5/+71
Just press 'S' on any assembly line and the source code will be hidden while the current line remains selected. Press 'S' again to show them back. 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-efmxm5etouebb7es0kkyqqwa@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2011-10-14perf ui browser: Add filter methodArnaldo Carvalho de Melo2-9/+43
Its becoming common to allow the user to filter out parts of the data structure being browsed, like already done in the hists browser and in the annotate browser in the next commit, so provide it directly in the ui_browser class list_head helpers. More work required to move the equivalent routines found now in the hists browser to the rb_tree helpers. 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-jk7danyt1d9ji4e3o2xuthpn@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2011-10-14perf annotate browser: Exit when pressing ESC or the left arrowArnaldo Carvalho de Melo1-0/+2
We lost that functionality on ed7e566, restore it. 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-z8eb8af2x46x42lgpn1ustid@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2011-10-14perf hists browser: Invalidate ui_browser->top after timer callsArnaldo Carvalho de Melo2-2/+14
With underlying dynamic data structures we need to invalidate pointers to them after a timer, as that entry may have vanished (decayed in top, for instance). I forgot about browser_ui->top. Fix it by resetting it to null after a timer. The seek operation from SEEK_SET will then set it to a valid entry because it starts from rb_first(&hists->entries). Reported-by: Ingo Molnar <mingo@elte.hu> 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-2ssjm0ouh9tsz4dwkcu7c40n@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2011-10-13perf hists browser: Fix handling of TAB/UNTAB for multiple eventsArnaldo Carvalho de Melo1-17/+31
When using multiple events the 'top' and 'report' tools will first present the user with a menu to choose the event to browse. After that the user can either press <- to go back to the menu and choose another event or instead press TAB to go the next event without having to go back to the menu or shift-TAB (UNTAB) to go the previous event, useful to quickly visually see if multiple events are correlated. The handling of each hists browser return was broken by the ed7e566, that combined both switches, the first that was for choosing the event and the second that was for checking if switching to the next event without passing thru the events menu. Repeat with me: Don't be clever like that. Fix it by moving the switch to right after the call to the hists browser, making abundantly clear that the two switches are unrelated. This also fixes a compiler warning about the 'pos' variable being possibly used unitialized. Reported-by: Ingo Molnar <mingo@elte.hu> [ committer note: the line above is for the compiler warning ] 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-ujxkbvj9vy8w6xe2op5m51tb@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2011-10-13perf ui browser: Remove ui_browser__add_exit_keysArnaldo Carvalho de Melo5-51/+12
Users (hist_browser, etc) should just handle all keys, discarding the ones they don't handle. 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-fjouann12v2k58t6vdd2wawb@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2011-10-13perf ui browser: Handle SIGWINCHArnaldo Carvalho de Melo6-65/+100
To do that we needed to stop using newtForm, as we don't want libnewt to catch the xterm resize signal. Remove some more newt calls and instead use the underlying libslang directly. In time tools/perf will use just libslang. 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-h1824yjiru5n2ivz4bseizwj@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2011-10-13perf hists: Don't free decayed entries if in the annotation browserArnaldo Carvalho de Melo1-1/+5
Just let it there till the user exits the annotation browser. 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-nmaxuzreqhm5k10t2co5sk9a@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2011-10-11perf hists browser: Recalculate browser pointers after resort/decayArnaldo Carvalho de Melo3-7/+26
In browsers that access dynamic underlying data structures, like in the hists browser and its hist_entry rb_tree, we need to revalidate any reference to the underlying data structure, because they can have gone away, decayed. This fixes a problem where after a while the top entries get behind the top of the screen, i.e. the top_idx stays at 0, which means it is at the first entry in the rb_tree when in fact it wasn't because the browser->top didn't got revalidated after the timer ran and the underlying data structure got updated. 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-mhje66qssdko24q67a2lhlho@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2011-10-07perf hists browser: Update the browser.nr_entries after the timerArnaldo Carvalho de Melo1-0/+7
Previously the hist_browser dealt with a static tree of entries, now it needs to update the nr_entries in the browser after the timer runs. A better solution will come when moving using another thread for the collapse_resort, etc, but for now this is ok. 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-9eno2iq55sjr4iyo899buzaw@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2011-10-07perf hists browser: Fix TAB/UNTAB use with multiple eventsArnaldo Carvalho de Melo1-0/+2
When requesting multiple events, say: # perf top -e instructions -e cycles -e cache-misses The first screen lets the user chose what to see first, then to switch one can either use the left key to get back to the event menu or simply use TAB to go the next and shift+TAB to go the prev. When using TAB/UNTAB the call to perf_evlist__set_selected(event) was missing, fix it. 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-3xqqh3fwmt914gg43frey14y@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2011-10-07perf hists browser: Don't offer symbol actions when symbols not on --sortArnaldo Carvalho de Melo1-9/+17
Removing all the entries that only apply to symbols from the menu. 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-7bap0cy2fxtorlj5hgsp48m1@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2011-10-07perf annotate browser: Use -> to navigate on assembly linesArnaldo Carvalho de Melo1-6/+21
And add better explanations when the line isn't actionable, like non assembly lines and on other instructions. Suggested-by: Ingo Molnar <mingo@elte.hu> 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-375n844b5wra7lgq08ou153j@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2011-10-07perf annotate browser: Allow navigation to called functionsArnaldo Carvalho de Melo2-19/+70
I.e. when in the annotate TUI window, if Enter is pressed over an assembly line with a 'callq' it will try to open another TUI window with that symbol. This is just a proof of concept and works only on x86_64, more work is needed to support kernel modules, userland, other arches, etc, but should already be useful as-is. Suggested-by: Ingo Molnar <mingo@elte.hu> 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-opyvskw5na3qdmkv8vxi3zbr@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2011-10-07perf top: Reuse the 'report' hist_entry/hists classesArnaldo Carvalho de Melo1-236/+0
This actually fixes several problems we had in the old 'perf top': 1. Unresolved symbols not show, limitation that came from the old "KernelTop" codebase, to solve it we would need to do changes that would make sym_entry have most of the hist_entry fields. 2. It was using the number of samples, not the sum of sample->period. And brings the --sort code that allows us to have all the views in 'perf report', for instance: [root@emilia ~]# perf top --sort dso PerfTop: 5903 irqs/sec kernel:77.5% exact: 0.0% [1000Hz cycles], (all, 8 CPUs) ------------------------------------------------------------------------------ 31.59% libcrypto.so.1.0.0 21.55% [kernel] 18.57% libpython2.6.so.1.0 7.04% libc-2.12.so 6.99% _backend_agg.so 4.72% sshd 1.48% multiarray.so 1.39% libfreetype.so.6.3.22 1.37% perf 0.71% libgobject-2.0.so.0.2200.5 0.53% [tg3] 0.48% libglib-2.0.so.0.2200.5 0.44% libstdc++.so.6.0.13 0.40% libcairo.so.2.10800.8 0.38% libm-2.12.so 0.34% umath.so 0.30% libgdk-x11-2.0.so.0.1800.9 0.22% libpthread-2.12.so 0.20% libgtk-x11-2.0.so.0.1800.9 0.20% librt-2.12.so 0.15% _path.so 0.13% libpango-1.0.so.0.2800.1 0.11% libatlas.so.3.0 0.09% ft2font.so 0.09% libpangoft2-1.0.so.0.2800.1 0.08% libX11.so.6.3.0 0.07% [vdso] 0.06% cyclictest ^C All the filter lists can be used as well: --dsos, --comms, --symbols, etc. The 'perf report' TUI is also reused, being possible to apply all the zoom operations, do annotation, etc. This change will allow multiple simplifications in the symbol system as well, that will be detailed in upcoming changesets. 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-xzaaldxq7zhqrrxdxjifk1mh@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2011-10-07perf browsers: Add live mode to the hists, annotate browsersArnaldo Carvalho de Melo3-46/+86
This allows passing a timer to be run periodically, which will update the hists tree that then gers refreshed on the screen, just like the Live mode (symbol entries, annotation) we already have in 'perf top --tui'. Will be used by the new hist_entry/hists based 'top' tool. 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-2r44qd8oe4sagzcgoikl8qzc@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2011-09-29perf top: Improve lost events warningArnaldo Carvalho de Melo1-0/+24
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>
2011-09-29perf top browser: Fix up line width calculationArnaldo Carvalho de Melo1-2/+2
Fixing an artifact where the last 3 chars of a long DSO name would remain on the screen sometimes. 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-dkiakcl3z69dh1bt9uegaktv@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2011-08-10perf top browser: Remove spurious helpline updateArnaldo Carvalho de Melo1-1/+0
It will be immediately replaced in perf_top_browser__run. 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-q7e2jzb44elqpkvdllk94x0i@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2011-05-10perf: Only include annotate.h once in tools/perf/util/ui/browsers/annotate.cJesper Juhl1-1/+0
Including "../../annotate.h" once in tools/perf/util/ui/browsers/annotate.c is enough. No need to do it twice. Signed-off-by: Jesper Juhl <jj@chaosbits.net> Signed-off-by: Jiri Kosina <jkosina@suse.cz>