aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2011-02-17 08:46:35 -0500
committerIngo Molnar <mingo@elte.hu>2011-02-17 08:46:35 -0500
commitbee96907383e71d3996ba2bd0682fefaa492d942 (patch)
tree3233fb93a559eabd05581373ce41d342e956d79e /tools
parent5beda5f6e4e4523e8dbe596bf163a01b45776808 (diff)
parent8737ebdea02315eaffaebb3b73d55f2f726a4fe0 (diff)
Merge branch 'perf/core' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux-2.6 into perf/core
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/Documentation/Makefile19
-rw-r--r--tools/perf/Documentation/perf-probe.txt7
-rw-r--r--tools/perf/Makefile31
-rw-r--r--tools/perf/util/annotate.c3
-rw-r--r--tools/perf/util/probe-event.c17
-rw-r--r--tools/perf/util/ui/browser.c7
-rw-r--r--tools/perf/util/ui/browsers/annotate.c5
-rw-r--r--tools/perf/util/ui/helpline.c5
-rw-r--r--tools/perf/util/ui/setup.c3
-rw-r--r--tools/perf/util/ui/ui.h8
10 files changed, 85 insertions, 20 deletions
diff --git a/tools/perf/Documentation/Makefile b/tools/perf/Documentation/Makefile
index bd498d496952..4626a398836a 100644
--- a/tools/perf/Documentation/Makefile
+++ b/tools/perf/Documentation/Makefile
@@ -178,8 +178,8 @@ install-pdf: pdf
178 $(INSTALL) -d -m 755 $(DESTDIR)$(pdfdir) 178 $(INSTALL) -d -m 755 $(DESTDIR)$(pdfdir)
179 $(INSTALL) -m 644 user-manual.pdf $(DESTDIR)$(pdfdir) 179 $(INSTALL) -m 644 user-manual.pdf $(DESTDIR)$(pdfdir)
180 180
181install-html: html 181#install-html: html
182 '$(SHELL_PATH_SQ)' ./install-webdoc.sh $(DESTDIR)$(htmldir) 182# '$(SHELL_PATH_SQ)' ./install-webdoc.sh $(DESTDIR)$(htmldir)
183 183
184../PERF-VERSION-FILE: .FORCE-PERF-VERSION-FILE 184../PERF-VERSION-FILE: .FORCE-PERF-VERSION-FILE
185 $(QUIET_SUBDIR0)../ $(QUIET_SUBDIR1) PERF-VERSION-FILE 185 $(QUIET_SUBDIR0)../ $(QUIET_SUBDIR1) PERF-VERSION-FILE
@@ -288,15 +288,16 @@ $(patsubst %.txt,%.html,$(wildcard howto/*.txt)): %.html : %.txt
288 sed -e '1,/^$$/d' $< | $(ASCIIDOC) -b xhtml11 - >$@+ && \ 288 sed -e '1,/^$$/d' $< | $(ASCIIDOC) -b xhtml11 - >$@+ && \
289 mv $@+ $@ 289 mv $@+ $@
290 290
291install-webdoc : html 291# UNIMPLEMENTED
292 '$(SHELL_PATH_SQ)' ./install-webdoc.sh $(WEBDOC_DEST) 292#install-webdoc : html
293# '$(SHELL_PATH_SQ)' ./install-webdoc.sh $(WEBDOC_DEST)
293 294
294quick-install: quick-install-man 295# quick-install: quick-install-man
295 296
296quick-install-man: 297# quick-install-man:
297 '$(SHELL_PATH_SQ)' ./install-doc-quick.sh $(DOC_REF) $(DESTDIR)$(mandir) 298# '$(SHELL_PATH_SQ)' ./install-doc-quick.sh $(DOC_REF) $(DESTDIR)$(mandir)
298 299
299quick-install-html: 300#quick-install-html:
300 '$(SHELL_PATH_SQ)' ./install-doc-quick.sh $(HTML_REF) $(DESTDIR)$(htmldir) 301# '$(SHELL_PATH_SQ)' ./install-doc-quick.sh $(HTML_REF) $(DESTDIR)$(htmldir)
301 302
302.PHONY: .FORCE-PERF-VERSION-FILE 303.PHONY: .FORCE-PERF-VERSION-FILE
diff --git a/tools/perf/Documentation/perf-probe.txt b/tools/perf/Documentation/perf-probe.txt
index 81c3220e04f3..02bafce4b341 100644
--- a/tools/perf/Documentation/perf-probe.txt
+++ b/tools/perf/Documentation/perf-probe.txt
@@ -16,7 +16,7 @@ or
16or 16or
17'perf probe' --list 17'perf probe' --list
18or 18or
19'perf probe' [options] --line='FUNC[:RLN[+NUM|:RLN2]]|SRC:ALN[+NUM|:ALN2]' 19'perf probe' [options] --line='LINE'
20or 20or
21'perf probe' [options] --vars='PROBEPOINT' 21'perf probe' [options] --vars='PROBEPOINT'
22 22
@@ -128,13 +128,14 @@ LINE SYNTAX
128----------- 128-----------
129Line range is described by following syntax. 129Line range is described by following syntax.
130 130
131 "FUNC[:RLN[+NUM|-RLN2]]|SRC[:ALN[+NUM|-ALN2]]" 131 "FUNC[@SRC][:RLN[+NUM|-RLN2]]|SRC[:ALN[+NUM|-ALN2]]"
132 132
133FUNC specifies the function name of showing lines. 'RLN' is the start line 133FUNC specifies the function name of showing lines. 'RLN' is the start line
134number from function entry line, and 'RLN2' is the end line number. As same as 134number from function entry line, and 'RLN2' is the end line number. As same as
135probe syntax, 'SRC' means the source file path, 'ALN' is start line number, 135probe syntax, 'SRC' means the source file path, 'ALN' is start line number,
136and 'ALN2' is end line number in the file. It is also possible to specify how 136and 'ALN2' is end line number in the file. It is also possible to specify how
137many lines to show by using 'NUM'. 137many lines to show by using 'NUM'. Moreover, 'FUNC@SRC' combination is good
138for searching a specific function when several functions share same name.
138So, "source.c:100-120" shows lines between 100th to l20th in source.c file. And "func:10+20" shows 20 lines from 10th line of func function. 139So, "source.c:100-120" shows lines between 100th to l20th in source.c file. And "func:10+20" shows 20 lines from 10th line of func function.
139 140
140LAZY MATCHING 141LAZY MATCHING
diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index bc4d9bf8a556..7c75f1d45f59 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -637,6 +637,7 @@ else
637 LIB_H += util/ui/libslang.h 637 LIB_H += util/ui/libslang.h
638 LIB_H += util/ui/progress.h 638 LIB_H += util/ui/progress.h
639 LIB_H += util/ui/util.h 639 LIB_H += util/ui/util.h
640 LIB_H += util/ui/ui.h
640 endif 641 endif
641endif 642endif
642 643
@@ -1101,6 +1102,36 @@ $(sort $(dir $(DIRECTORY_DEPS))):
1101$(LIB_FILE): $(LIB_OBJS) 1102$(LIB_FILE): $(LIB_OBJS)
1102 $(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $(LIB_OBJS) 1103 $(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $(LIB_OBJS)
1103 1104
1105help:
1106 @echo 'Perf make targets:'
1107 @echo ' doc - make *all* documentation (see below)'
1108 @echo ' man - make manpage documentation (access with man <foo>)'
1109 @echo ' html - make html documentation'
1110 @echo ' info - make GNU info documentation (access with info <foo>)'
1111 @echo ' pdf - make pdf documentation'
1112 @echo ' TAGS - use etags to make tag information for source browsing'
1113 @echo ' tags - use ctags to make tag information for source browsing'
1114 @echo ' cscope - use cscope to make interactive browsing database'
1115 @echo ''
1116 @echo 'Perf install targets:'
1117 @echo ' NOTE: documentation build requires asciidoc, xmlto packages to be installed'
1118 @echo ' HINT: use "make prefix=<path> <install target>" to install to a particular'
1119 @echo ' path like make prefix=/usr/local install install-doc'
1120 @echo ' install - install compiled binaries'
1121 @echo ' install-doc - install *all* documentation'
1122 @echo ' install-man - install manpage documentation'
1123 @echo ' install-html - install html documentation'
1124 @echo ' install-info - install GNU info documentation'
1125 @echo ' install-pdf - install pdf documentation'
1126 @echo ''
1127 @echo ' quick-install-doc - alias for quick-install-man'
1128 @echo ' quick-install-man - install the documentation quickly'
1129 @echo ' quick-install-html - install the html documentation quickly'
1130 @echo ''
1131 @echo 'Perf maintainer targets:'
1132 @echo ' distclean - alias to clean'
1133 @echo ' clean - clean all binary objects and build output'
1134
1104doc: 1135doc:
1105 $(MAKE) -C Documentation all 1136 $(MAKE) -C Documentation all
1106 1137
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
index 02976b895f27..70ec422ddb64 100644
--- a/tools/perf/util/annotate.c
+++ b/tools/perf/util/annotate.c
@@ -541,11 +541,12 @@ void symbol__annotate_decay_histogram(struct symbol *sym, int evidx)
541 struct annotation *notes = symbol__annotation(sym); 541 struct annotation *notes = symbol__annotation(sym);
542 struct sym_hist *h = annotation__histogram(notes, evidx); 542 struct sym_hist *h = annotation__histogram(notes, evidx);
543 struct objdump_line *pos; 543 struct objdump_line *pos;
544 int len = sym->end - sym->start;
544 545
545 h->sum = 0; 546 h->sum = 0;
546 547
547 list_for_each_entry(pos, &notes->src->source, node) { 548 list_for_each_entry(pos, &notes->src->source, node) {
548 if (pos->offset != -1) { 549 if (pos->offset != -1 && pos->offset < len) {
549 h->addr[pos->offset] = h->addr[pos->offset] * 7 / 8; 550 h->addr[pos->offset] = h->addr[pos->offset] * 7 / 8;
550 h->sum += h->addr[pos->offset]; 551 h->sum += h->addr[pos->offset];
551 } 552 }
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index 9d237e3cff5d..0e3ea1321103 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -409,7 +409,7 @@ int show_line_range(struct line_range *lr, const char *module)
409 setup_pager(); 409 setup_pager();
410 410
411 if (lr->function) 411 if (lr->function)
412 fprintf(stdout, "<%s:%d>\n", lr->function, 412 fprintf(stdout, "<%s@%s:%d>\n", lr->function, lr->path,
413 lr->start - lr->offset); 413 lr->start - lr->offset);
414 else 414 else
415 fprintf(stdout, "<%s:%d>\n", lr->path, lr->start); 415 fprintf(stdout, "<%s:%d>\n", lr->path, lr->start);
@@ -595,11 +595,11 @@ static int parse_line_num(char **ptr, int *val, const char *what)
595 * The line range syntax is described by: 595 * The line range syntax is described by:
596 * 596 *
597 * SRC[:SLN[+NUM|-ELN]] 597 * SRC[:SLN[+NUM|-ELN]]
598 * FNC[:SLN[+NUM|-ELN]] 598 * FNC[@SRC][:SLN[+NUM|-ELN]]
599 */ 599 */
600int parse_line_range_desc(const char *arg, struct line_range *lr) 600int parse_line_range_desc(const char *arg, struct line_range *lr)
601{ 601{
602 char *range, *name = strdup(arg); 602 char *range, *file, *name = strdup(arg);
603 int err; 603 int err;
604 604
605 if (!name) 605 if (!name)
@@ -649,7 +649,16 @@ int parse_line_range_desc(const char *arg, struct line_range *lr)
649 } 649 }
650 } 650 }
651 651
652 if (strchr(name, '.')) 652 file = strchr(name, '@');
653 if (file) {
654 *file = '\0';
655 lr->file = strdup(++file);
656 if (lr->file == NULL) {
657 err = -ENOMEM;
658 goto err;
659 }
660 lr->function = name;
661 } else if (strchr(name, '.'))
653 lr->file = name; 662 lr->file = name;
654 else 663 else
655 lr->function = name; 664 lr->function = name;
diff --git a/tools/perf/util/ui/browser.c b/tools/perf/util/ui/browser.c
index 8bc010edca25..60d6c815e1db 100644
--- a/tools/perf/util/ui/browser.c
+++ b/tools/perf/util/ui/browser.c
@@ -1,4 +1,5 @@
1#include "libslang.h" 1#include "libslang.h"
2#include "ui.h"
2#include <linux/compiler.h> 3#include <linux/compiler.h>
3#include <linux/list.h> 4#include <linux/list.h>
4#include <linux/rbtree.h> 5#include <linux/rbtree.h>
@@ -178,6 +179,7 @@ int ui_browser__show(struct ui_browser *self, const char *title,
178 if (self->sb == NULL) 179 if (self->sb == NULL)
179 return -1; 180 return -1;
180 181
182 pthread_mutex_lock(&ui__lock);
181 SLsmg_gotorc(0, 0); 183 SLsmg_gotorc(0, 0);
182 ui_browser__set_color(self, NEWT_COLORSET_ROOT); 184 ui_browser__set_color(self, NEWT_COLORSET_ROOT);
183 slsmg_write_nstring(title, self->width); 185 slsmg_write_nstring(title, self->width);
@@ -188,25 +190,30 @@ int ui_browser__show(struct ui_browser *self, const char *title,
188 va_start(ap, helpline); 190 va_start(ap, helpline);
189 ui_helpline__vpush(helpline, ap); 191 ui_helpline__vpush(helpline, ap);
190 va_end(ap); 192 va_end(ap);
193 pthread_mutex_unlock(&ui__lock);
191 return 0; 194 return 0;
192} 195}
193 196
194void ui_browser__hide(struct ui_browser *self) 197void ui_browser__hide(struct ui_browser *self)
195{ 198{
199 pthread_mutex_lock(&ui__lock);
196 newtFormDestroy(self->form); 200 newtFormDestroy(self->form);
197 self->form = NULL; 201 self->form = NULL;
198 ui_helpline__pop(); 202 ui_helpline__pop();
203 pthread_mutex_unlock(&ui__lock);
199} 204}
200 205
201int ui_browser__refresh(struct ui_browser *self) 206int ui_browser__refresh(struct ui_browser *self)
202{ 207{
203 int row; 208 int row;
204 209
210 pthread_mutex_lock(&ui__lock);
205 newtScrollbarSet(self->sb, self->index, self->nr_entries - 1); 211 newtScrollbarSet(self->sb, self->index, self->nr_entries - 1);
206 row = self->refresh(self); 212 row = self->refresh(self);
207 ui_browser__set_color(self, HE_COLORSET_NORMAL); 213 ui_browser__set_color(self, HE_COLORSET_NORMAL);
208 SLsmg_fill_region(self->y + row, self->x, 214 SLsmg_fill_region(self->y + row, self->x,
209 self->height - row, self->width, ' '); 215 self->height - row, self->width, ' ');
216 pthread_mutex_unlock(&ui__lock);
210 217
211 return 0; 218 return 0;
212} 219}
diff --git a/tools/perf/util/ui/browsers/annotate.c b/tools/perf/util/ui/browsers/annotate.c
index 1aa39658539c..cfb5a27f15d2 100644
--- a/tools/perf/util/ui/browsers/annotate.c
+++ b/tools/perf/util/ui/browsers/annotate.c
@@ -44,8 +44,6 @@ static void annotate_browser__write(struct ui_browser *self, void *entry, int ro
44 struct objdump_line_rb_node *olrb = objdump_line__rb(ol); 44 struct objdump_line_rb_node *olrb = objdump_line__rb(ol);
45 ui_browser__set_percent_color(self, olrb->percent, current_entry); 45 ui_browser__set_percent_color(self, olrb->percent, current_entry);
46 slsmg_printf(" %7.2f ", olrb->percent); 46 slsmg_printf(" %7.2f ", olrb->percent);
47 if (!current_entry)
48 ui_browser__set_color(self, HE_COLORSET_CODE);
49 } else { 47 } else {
50 ui_browser__set_percent_color(self, 0, current_entry); 48 ui_browser__set_percent_color(self, 0, current_entry);
51 slsmg_write_nstring(" ", 9); 49 slsmg_write_nstring(" ", 9);
@@ -57,6 +55,9 @@ static void annotate_browser__write(struct ui_browser *self, void *entry, int ro
57 slsmg_write_nstring(" ", width - 18); 55 slsmg_write_nstring(" ", width - 18);
58 else 56 else
59 slsmg_write_nstring(ol->line, width - 18); 57 slsmg_write_nstring(ol->line, width - 18);
58
59 if (!current_entry)
60 ui_browser__set_color(self, HE_COLORSET_CODE);
60} 61}
61 62
62static double objdump_line__calc_percent(struct objdump_line *self, 63static double objdump_line__calc_percent(struct objdump_line *self,
diff --git a/tools/perf/util/ui/helpline.c b/tools/perf/util/ui/helpline.c
index 8d79daa4458a..f36d2ff509ed 100644
--- a/tools/perf/util/ui/helpline.c
+++ b/tools/perf/util/ui/helpline.c
@@ -5,6 +5,7 @@
5 5
6#include "../debug.h" 6#include "../debug.h"
7#include "helpline.h" 7#include "helpline.h"
8#include "ui.h"
8 9
9void ui_helpline__pop(void) 10void ui_helpline__pop(void)
10{ 11{
@@ -55,7 +56,8 @@ int ui_helpline__show_help(const char *format, va_list ap)
55 int ret; 56 int ret;
56 static int backlog; 57 static int backlog;
57 58
58 ret = vsnprintf(ui_helpline__last_msg + backlog, 59 pthread_mutex_lock(&ui__lock);
60 ret = vsnprintf(ui_helpline__last_msg + backlog,
59 sizeof(ui_helpline__last_msg) - backlog, format, ap); 61 sizeof(ui_helpline__last_msg) - backlog, format, ap);
60 backlog += ret; 62 backlog += ret;
61 63
@@ -64,6 +66,7 @@ int ui_helpline__show_help(const char *format, va_list ap)
64 newtRefresh(); 66 newtRefresh();
65 backlog = 0; 67 backlog = 0;
66 } 68 }
69 pthread_mutex_unlock(&ui__lock);
67 70
68 return ret; 71 return ret;
69} 72}
diff --git a/tools/perf/util/ui/setup.c b/tools/perf/util/ui/setup.c
index fbf1a145492f..ee46d671db59 100644
--- a/tools/perf/util/ui/setup.c
+++ b/tools/perf/util/ui/setup.c
@@ -6,6 +6,9 @@
6#include "../debug.h" 6#include "../debug.h"
7#include "browser.h" 7#include "browser.h"
8#include "helpline.h" 8#include "helpline.h"
9#include "ui.h"
10
11pthread_mutex_t ui__lock = PTHREAD_MUTEX_INITIALIZER;
9 12
10static void newt_suspend(void *d __used) 13static void newt_suspend(void *d __used)
11{ 14{
diff --git a/tools/perf/util/ui/ui.h b/tools/perf/util/ui/ui.h
new file mode 100644
index 000000000000..d264e059c829
--- /dev/null
+++ b/tools/perf/util/ui/ui.h
@@ -0,0 +1,8 @@
1#ifndef _PERF_UI_H_
2#define _PERF_UI_H_ 1
3
4#include <pthread.h>
5
6extern pthread_mutex_t ui__lock;
7
8#endif /* _PERF_UI_H_ */