perf/core improvements
Hi Ingo,
Please pull from:
git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux-2.6 perf/core
Regards,
- Arnaldo
Arnaldo Carvalho de Melo (1):
perf tools: Add --tui and --stdio to choose the UI
Kirill A. Shutemov (1):
perf tools: add test for strlcpy()
tools/perf/Documentation/perf-annotate.txt | 11 +++++++++-- tools/perf/Documentation/perf-report.txt | 7 +++++++ tools/perf/Makefile | 9 +++++++++ tools/perf/builtin-annotate.c | 9 ++++++++- tools/perf/builtin-report.c | 11 ++++++++++- tools/perf/feature-tests.mak | 11 +++++++++++ tools/perf/util/cache.h | 2 ++ tools/perf/util/path.c | 3 ++- 8 files changed, 58 insertions(+), 5 deletions(-)
PATCH 1/2 perf tools: Add --tui and --stdio to choose the UI
From: Arnaldo Carvalho de Melo <[email protected]>
Relying just on ~/.perfconfig or rebuilding the tool disabling support for the TUI is too cumbersome, so allow specifying which UI to use and make the command line switch override whatever is in ~/.perfconfig.
LKML-Reference: <new-submission>
--- tools/perf/Documentation/perf-annotate.txt | 11 +++++++++-- tools/perf/Documentation/perf-report.txt | 7 +++++++ tools/perf/builtin-annotate.c | 9 ++++++++- tools/perf/builtin-report.c | 11 ++++++++++- 4 files changed, 34 insertions(+), 4 deletions(-)
tools/perf/Documentation/perf-annotate.txt +9 -2
@@ -8,7 +8,7 @@ perf-annotate - Read perf.data (created by perf record) and display annotated co SYNOPSIS -------- [verse] -'perf annotate' [-i <file> | --input=file] symbol_name +'perf annotate' [-i <file> | --input=file] [symbol_name] DESCRIPTION -----------
@@ -24,6 +24,13 @@ OPTIONS --input=:: Input file name. (default: perf.data) +--stdio:: Use the stdio interface. + +--tui:: Use the TUI interface Use of --tui requires a tty, if one is not + present, as when piping to other commands, the stdio interface is + used. This interfaces starts by centering on the line with more + samples, TAB/UNTAB cycles thru the lines with more samples. + SEE ALSO -------- -linkperf:perf-record[1] +linkperf:perf-record[1], linkperf:perf-report[1]
tools/perf/Documentation/perf-report.txt +7 -0
@@ -65,6 +65,13 @@ OPTIONS the tree is considered as a new profiled object. + Default: fractal,0.5. +--stdio:: Use the stdio interface. + +--tui:: Use the TUI interface, that is integrated with annotate and allows + zooming into DSOs or threads, among other features. Use of --tui + requires a tty, if one is not present, as when piping to other + commands, the stdio interface is used. + SEE ALSO -------- linkperf:perf-stat[1]
tools/perf/builtin-annotate.c +8 -1
@@ -28,7 +28,7 @@static char const *input_name ="perf.data" ; -static bool force; +static bool force, use_tui, use_stdio;static bool full_paths;
@@ -427,6 +427,8 @@ static const struct option options[] = { "be more verbose (show symbol address, etc)"),OPT_BOOLEAN ('D' ,"dump-raw-trace" , &dump_trace,"dump raw trace in ASCII" ), +OPT_BOOLEAN (0 ,"tui" , &use_tui,"Use the TUI interface" ), +OPT_BOOLEAN (0 ,"stdio" , &use_stdio,"Use the stdio interface" ),OPT_STRING ('k' ,"vmlinux" , &symbol_conf.vmlinux_name,"file" ,"vmlinux pathname" ), OPT_BOOLEAN('m', "modules", &symbol_conf.use_modules,
@@ -442,6 +444,11 @@ int cmd_annotate(int argc, const char **argv, const char *prefix __used) { argc =parse_options (argc, argv, options, annotate_usage,0 ); +if (use_stdio) + use_browser =0 ; +else if (use_tui) + use_browser =1 ; +setup_browser (); symbol_conf.priv_size =sizeof (struct sym_priv );
tools/perf/builtin-report.c +10 -1
@@ -32,7 +32,7 @@static char const *input_name ="perf.data" ; -static bool force; +static bool force, use_tui, use_stdio;static bool hide_unresolved;static bool dont_use_callchains;
@@ -450,6 +450,8 @@ static const struct option options[] = { "Show per-thread event counters"),OPT_STRING (0 ,"pretty" , &pretty_printing_style,"key" ,"pretty printing style key: normal raw" ), +OPT_BOOLEAN (0 ,"tui" , &use_tui,"Use the TUI interface" ), +OPT_BOOLEAN (0 ,"stdio" , &use_stdio,"Use the stdio interface" ),OPT_STRING ('s' ,"sort" , &sort_order,"key[,key2...]" ,"sort by key(s): pid, comm, dso, symbol, parent" ), OPT_BOOLEAN(0, "showcpuutilization", &symbol_conf.show_cpu_utilization,
@@ -482,8 +484,15 @@ int cmd_report(int argc, const char **argv, const char *prefix __used) { argc =parse_options (argc, argv, options, report_usage,0 ); +if (use_stdio) + use_browser =0 ; +else if (use_tui) + use_browser =1 ; +if (strcmp (input_name,"-" ) !=0 )setup_browser (); +else + use_browser =0 ;/* * Only in the newt browser we are doing integrated annotation, * so don't allocate extra space that won't be used in the stdio
Signature · 1 line
1.6.2.5
Re: [PATCH 1/2] perf tools: Add --tui and --stdio to choose the UI
Quoted 5 lines · Arnaldo Carvalho de Melo
From: Arnaldo Carvalho de Melo <[email protected]>
Relying just on ~/.perfconfig or rebuilding the tool disabling support for the TUI is too cumbersome, so allow specifying which UI to use and make the command line switch override whatever is in ~/.perfconfig.
Much better than the current situation, thanks!
I still thinks commands like perf report should not be overloaded for two different user interfaces, that is a
perf report
should always be the line oriented interface, and the newt UI should be something like
perf treport
Btw, am I the only one that doesn't find the next interface too helpful? In general the line oriented interface seem to present the information much better, and in the cases where it gets too complicated the newt interface doesn't really helper either. A real gtk/qt interface with a proper tree widget would seem like the more useful interface for that.
Re: [PATCH 1/2] perf tools: Add --tui and --stdio to choose the UI
Em Sat, Aug 21, 2010 at 01:47:54PM -0400, Christoph Hellwig escreveu:
Quoted 14 lines · Arnaldo Carvalho de Melo
Quoted 5 lines
From: Arnaldo Carvalho de Melo <[email protected]>
Relying just on ~/.perfconfig or rebuilding the tool disabling support for the TUI is too cumbersome, so allow specifying which UI to use and make the command line switch override whatever is in ~/.perfconfig.
Much better than the current situation, thanks!
I still thinks commands like perf report should not be overloaded for two different user interfaces, that is a
perf report
Quoted 8 lines
should always be the line oriented interface, and the newt UI should be something like
perf treport
Btw, am I the only one that doesn't find the next interface too helpful? In general the line oriented interface seem to present the information much better, and in the cases where it gets too complicated the newt
Much better how, exactly?
Quoted 2 lines
interface doesn't really helper either. A real gtk/qt interface with a proper tree widget would seem like the more useful interface for that.
What would a gtk/qt interface buy us that is not present on the TUI right now?
I'm not saying it wouldn't buy something, just interested in what is this something :)
And yes, gtk/qt interfaces should be added. The experience with the TUI is helping organize the data structures for that.
- Arnaldo
Re: [PATCH 1/2] perf tools: Add --tui and --stdio to choose the UI
Quoted 5 lines · Arnaldo Carvalho de Melo
Quoted 3 lines
Btw, am I the only one that doesn't find the next interface too helpful? In general the line oriented interface seem to present the information much better, and in the cases where it gets too complicated the newt
Much better how, exactly?
- it uses the space available in a terminal window much more efficiently. Output starts in row 0, column 0 and expands all the way that's needed.
- it incluses a descruption of what the columns of output mean
- it provides percentages for the individual callchains parts after branching out
- in graph/fractal modes there are lines that show how the parts are connected, making it possible to read the output, unlinke the TUI mode where the "expanind" nodes are very hard to follow.
- just running perf reports gets an overview of all callchains instead of having to expand dozens of things
- the colour scheme is the normal shell one (light gray on black for me) instead of one hurting the eyes
Quoted 5 lines
Quoted 2 lines
interface doesn't really helper either. A real gtk/qt interface with a proper tree widget would seem like the more useful interface for that.
What would a gtk/qt interface buy us that is not present on the TUI right now?
Generally for tree/graph like data structures a real X GUI provides much nicer rendering. It'll allow to render the connected lines just as in the line oriented interface, but in a nicer way using real thin lines in a tree widget. It'll also genereally allow better text placement in the window compared to the single centered window in the newt
interface. Also the GUI programs follow the common color scheme of the
rest of the desktop instead of hurting your eye. In addition to that scrollbars (horizontal / vertical) are a lot more intuitive in a typical X GUI than in newt.
Re: [PATCH 1/2] perf tools: Add --tui and --stdio to choose the UI
Em Sun, Aug 22, 2010 at 04:20:03AM -0400, Christoph Hellwig escreveu:
Quoted 7 lines · Arnaldo Carvalho de Melo
Quoted 5 lines
Quoted 3 lines
Btw, am I the only one that doesn't find the next interface too helpful? In general the line oriented interface seem to present the information much better, and in the cases where it gets too complicated the newt
Much better how, exactly?
Quoted 13 lines
- it uses the space available in a terminal window much more efficiently. Output starts in row 0, column 0 and expands all the way that's needed.
- it incluses a descruption of what the columns of output mean
- it provides percentages for the individual callchains parts after branching out
- in graph/fractal modes there are lines that show how the parts are connected, making it possible to read the output, unlinke the TUI mode where the "expanind" nodes are very hard to follow.
- just running perf reports gets an overview of all callchains instead of having to expand dozens of things
- the colour scheme is the normal shell one (light gray on black for me) instead of one hurting the eyes
All good points, will work on them, thanks for pointing them out!
Quoted 10 lines
Quoted 6 lines
Quoted 3 lines
interface doesn't really helper either. A real gtk/qt interface with a proper tree widget would seem like the more useful interface for that.
What would a gtk/qt interface buy us that is not present on the TUI right now?
Generally for tree/graph like data structures a real X GUI provides much nicer rendering. It'll allow to render the connected lines just as in the line oriented interface, but in a nicer way using real thin lines
Cool, connected lines is something that indeed has to happen, just like mutt in threaded mode, will work on that.
Quoted 4 lines
in a tree widget. It'll also genereally allow better text placement in the window compared to the single centered window in the newt
interface. Also the GUI programs follow the common color scheme of the
rest of the desktop instead of hurting your eye. In addition to that
Lets stop hurting eyes!
Quoted 2 lines
scrollbars (horizontal / vertical) are a lot more intuitive in a typical X GUI than in newt.
Ok, thanks for the detailed description of the problems.
- Arnaldo
[tip:perf/core] perf ui browser: Don't use windows, slang is enough
In reply to Christoph HellwigCommit-ID: 469917ce8717b9f8c5298bf279fa138859baab8d Gitweb: http://git.kernel.org/tip/469917ce8717b9f8c5298bf279fa138859baab8d Author: Arnaldo Carvalho de Melo <[email protected]> AuthorDate: Mon, 13 Sep 2010 10:25:04 -0300 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Mon, 13 Sep 2010 10:25:04 -0300
perf ui browser: Don't use windows, slang is enough
They are useless and take away precious columns and lines, so stop using windows.
One more step in removing newt code, that after all is not being useful at all for the coalescing TUI model in perf.
LKML-Reference: <[email protected]>
--- tools/perf/util/ui/browser.c | 24 +++++++++----------- tools/perf/util/ui/browsers/hists.c | 41 ++++++++++++++++------------------ tools/perf/util/ui/browsers/map.c | 9 +++---- 3 files changed, 34 insertions(+), 40 deletions(-)
tools/perf/util/ui/browser.c +11 -13
@@ -130,13 +130,10 @@ void ui_browser__refresh_dimensions(struct ui_browser *self)int cols, rows;newtGetScreenSize (&cols, &rows); -if (self->width > cols -4 ) - self->width = cols -4 ; - self->height = rows -5 ; -if (self->height > self->nr_entries) - self->height = self->nr_entries; - self->y = (rows - self->height) /2 ; - self->x = (cols - self->width) /2 ; + self->width = cols -1 ; + self->height = rows -2 ; + self->y =1 ; + self->x =0 ; }void ui_browser__reset_index (struct ui_browser *self)
@@ -168,22 +165,24 @@ int ui_browser__show(struct ui_browser *self, const char *title,NEWT_KEY_PGDN ,NEWT_KEY_HOME ,NEWT_KEY_END ,' ' , NEWT_KEY_LEFT, NEWT_KEY_ESCAPE, 'q', CTRL('c'), 0 }; -if (self->form !=NULL ) { +if (self->form !=NULL )newtFormDestroy (self->form); -newtPopWindow (); - } +ui_browser__refresh_dimensions (self); -newtCenteredWindow (self->width, self->height, title); self->form =newtForm (NULL ,NULL ,0 );if (self->form ==NULL )return -1 ; - self->sb =newtVerticalScrollbar (self->width,0 , self->height, + self->sb =newtVerticalScrollbar (self->width,1 , self->height,HE_COLORSET_NORMAL ,HE_COLORSET_SELECTED );if (self->sb ==NULL )return -1 ; +SLsmg_gotorc (0 ,0 ); +ui_browser__set_color (self,NEWT_COLORSET_ROOT ); +slsmg_write_nstring (title, self->width); +ui_browser__add_exit_keys (self, keys);newtFormAddComponent (self->form, self->sb);
@@ -196,7 +195,6 @@ int ui_browser__show(struct ui_browser *self, const char *title,void ui_browser__hide (struct ui_browser *self) {newtFormDestroy (self->form); -newtPopWindow (); self->form =NULL ;ui_helpline__pop (); }
tools/perf/util/ui/browsers/hists.c +19 -22
84 lines not on this page · raw message
tools/perf/util/ui/browsers/map.c +4 -5
@@ -46,7 +46,6 @@ out_free_form:struct map_browser {struct ui_browser b;struct map *map; -u16 namelen;u8 addrlen; };
@@ -55,13 +54,16 @@ static void map_browser__write(struct ui_browser *self, void *nd, int row) struct symbol *sym = rb_entry(nd, struct symbol, rb_node); struct map_browser *mb = container_of(self, struct map_browser, b);bool current_entry =ui_browser__is_current_entry (self, row); +int width;ui_browser__set_percent_color (self,0 , current_entry);slsmg_printf ("%*llx %*llx %c " , mb->addrlen, sym->start, mb->addrlen, sym->end, sym->binding ==STB_GLOBAL ?'g' : sym->binding ==STB_LOCAL ?'l' :'w' ); -slsmg_write_nstring (sym->name, mb->namelen); + width = self->width - ((mb->addrlen *2 ) +4 ); +if (width >0 ) +slsmg_write_nstring (sym->name, width); }/* FIXME uber-kludgy, see comment on cmd_report... */
@@ -139,8 +141,6 @@ int map__browse(struct map *self)for (nd =rb_first (mb.b.entries); nd; nd =rb_next (nd)) { struct symbol *pos = rb_entry(nd, struct symbol, rb_node); -if (mb.namelen < pos->namelen) - mb.namelen = pos->namelen;if (maxaddr < pos->end) maxaddr = pos->end;if (verbose) {
@@ -151,6 +151,5 @@ int map__browse(struct map *self) } mb.addrlen =snprintf (tmp,sizeof (tmp),"%llx" , maxaddr); - mb.b.width += mb.addrlen *2 +4 + mb.namelen;return map_browser__run (&mb); }
PATCH 2/2 perf tools: add test for strlcpy()
In reply to Arnaldo Carvalho de MeloFrom: Kirill A. Shutemov <[email protected]>
Some Linux distributions like ALT Linux provides patched glibc with contains strlcpy(). It's confilcts with strlcpy() from perf.
Let's add check for strlcpy().
Cc: Peter Zijlstra <[email protected]>
Cc: Paul Mackerras <[email protected]>
LKML-Reference: <[email protected]>
--- tools/perf/Makefile | 9 +++++++++ tools/perf/feature-tests.mak | 11 +++++++++++ tools/perf/util/cache.h | 2 ++ tools/perf/util/path.c | 3 ++- 4 files changed, 24 insertions(+), 1 deletions(-)
tools/perf/Makefile +9 -0
@@ -647,6 +647,15 @@ else endif endif + +ifdef NO_STRLCPY + BASIC_CFLAGS += -DNO_STRLCPY +else + ifneq ($(call try-cc,$(SOURCE_STRLCPY),),y) + BASIC_CFLAGS += -DNO_STRLCPY + endif +endif + ifndef CC_LD_DYNPATH ifdef NO_R_TO_GCC_LINKER # Some gcc does not accept and pass -R to the linker to specify
tools/perf/feature-tests.mak +11 -0
@@ -110,6 +110,17 @@ int main(void) } endef +define SOURCE_STRLCPY +#include <stdlib.h> +extern size_t strlcpy(char *dest, const char *src, size_t size); + +int main(void) +{ + strlcpy(NULL, NULL, 0); + return 0; +} +endef + # try-cc # Usage: option = $(call try-cc, source-to-build, cc-options) try-cc = $(shell sh -c \
tools/perf/util/cache.h +2 -0
@@ -82,6 +82,8 @@ extern char *perf_path(const char *fmt, ...) __attribute__((format (printf, 1, 2extern char *perf_pathdup (const char *fmt, ...) __attribute__((format (printf,1 ,2 ))); +#ifdef NO_STRLCPY extern size_t strlcpy (char *dest,const char *src,size_t size); +#endif #endif /* __PERF_CACHE_H */
tools/perf/util/path.c +2 -1
@@ -22,6 +22,7 @@ static const char *get_perf_dir(void)return "." ; } +#ifdef NO_STRLCPY size_t strlcpy (char *dest,const char *src,size_t size) {size_t ret =strlen (src);
@@ -33,7 +34,7 @@ size_t strlcpy(char *dest, const char *src, size_t size) }return ret; } - +#endif static char *get_pathname (void ) {
Signature · 1 line
1.6.2.5
Quoted 16 lines · Arnaldo Carvalho de Melo
Hi Ingo,
Please pull from:
git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux-2.6perf/coreRegards,
- Arnaldo
Arnaldo Carvalho de Melo (1):
perf tools: Add --tui and --stdio to choose the UIKirill A. Shutemov (1):
perf tools: add test forstrlcpy()
Quoted 9 lines
tools/perf/Documentation/perf-annotate.txt | 11 +++++++++-- tools/perf/Documentation/perf-report.txt | 7 +++++++ tools/perf/Makefile | 9 +++++++++ tools/perf/builtin-annotate.c | 9 ++++++++- tools/perf/builtin-report.c | 11 ++++++++++- tools/perf/feature-tests.mak | 11 +++++++++++ tools/perf/util/cache.h | 2 ++ tools/perf/util/path.c | 3 ++- 8 files changed, 58 insertions(+), 5 deletions(-)
Pulled, thanks a lot Arnaldo!
Ingo