Skip to content

Commit

Permalink
Merge branch 'perf/core' of git://git.kernel.org/pub/scm/linux/kernel…
Browse files Browse the repository at this point in the history
…/git/acme/linux-2.6 into perf/core
  • Loading branch information
Ingo Molnar committed Feb 17, 2011
2 parents 5beda5f + 8737ebd commit bee9690
Show file tree
Hide file tree
Showing 10 changed files with 85 additions and 20 deletions.
19 changes: 10 additions & 9 deletions tools/perf/Documentation/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,8 @@ install-pdf: pdf
$(INSTALL) -d -m 755 $(DESTDIR)$(pdfdir)
$(INSTALL) -m 644 user-manual.pdf $(DESTDIR)$(pdfdir)

install-html: html
'$(SHELL_PATH_SQ)' ./install-webdoc.sh $(DESTDIR)$(htmldir)
#install-html: html
# '$(SHELL_PATH_SQ)' ./install-webdoc.sh $(DESTDIR)$(htmldir)

../PERF-VERSION-FILE: .FORCE-PERF-VERSION-FILE
$(QUIET_SUBDIR0)../ $(QUIET_SUBDIR1) PERF-VERSION-FILE
Expand Down Expand Up @@ -288,15 +288,16 @@ $(patsubst %.txt,%.html,$(wildcard howto/*.txt)): %.html : %.txt
sed -e '1,/^$$/d' $< | $(ASCIIDOC) -b xhtml11 - >$@+ && \
mv $@+ $@

install-webdoc : html
'$(SHELL_PATH_SQ)' ./install-webdoc.sh $(WEBDOC_DEST)
# UNIMPLEMENTED
#install-webdoc : html
# '$(SHELL_PATH_SQ)' ./install-webdoc.sh $(WEBDOC_DEST)

quick-install: quick-install-man
# quick-install: quick-install-man

quick-install-man:
'$(SHELL_PATH_SQ)' ./install-doc-quick.sh $(DOC_REF) $(DESTDIR)$(mandir)
# quick-install-man:
# '$(SHELL_PATH_SQ)' ./install-doc-quick.sh $(DOC_REF) $(DESTDIR)$(mandir)

quick-install-html:
'$(SHELL_PATH_SQ)' ./install-doc-quick.sh $(HTML_REF) $(DESTDIR)$(htmldir)
#quick-install-html:
# '$(SHELL_PATH_SQ)' ./install-doc-quick.sh $(HTML_REF) $(DESTDIR)$(htmldir)

.PHONY: .FORCE-PERF-VERSION-FILE
7 changes: 4 additions & 3 deletions tools/perf/Documentation/perf-probe.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ or
or
'perf probe' --list
or
'perf probe' [options] --line='FUNC[:RLN[+NUM|:RLN2]]|SRC:ALN[+NUM|:ALN2]'
'perf probe' [options] --line='LINE'
or
'perf probe' [options] --vars='PROBEPOINT'

Expand Down Expand Up @@ -128,13 +128,14 @@ LINE SYNTAX
-----------
Line range is described by following syntax.

"FUNC[:RLN[+NUM|-RLN2]]|SRC[:ALN[+NUM|-ALN2]]"
"FUNC[@SRC][:RLN[+NUM|-RLN2]]|SRC[:ALN[+NUM|-ALN2]]"

FUNC specifies the function name of showing lines. 'RLN' is the start line
number from function entry line, and 'RLN2' is the end line number. As same as
probe syntax, 'SRC' means the source file path, 'ALN' is start line number,
and 'ALN2' is end line number in the file. It is also possible to specify how
many lines to show by using 'NUM'.
many lines to show by using 'NUM'. Moreover, 'FUNC@SRC' combination is good
for searching a specific function when several functions share same name.
So, "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.

LAZY MATCHING
Expand Down
31 changes: 31 additions & 0 deletions tools/perf/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -637,6 +637,7 @@ else
LIB_H += util/ui/libslang.h
LIB_H += util/ui/progress.h
LIB_H += util/ui/util.h
LIB_H += util/ui/ui.h
endif
endif

Expand Down Expand Up @@ -1101,6 +1102,36 @@ $(sort $(dir $(DIRECTORY_DEPS))):
$(LIB_FILE): $(LIB_OBJS)
$(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $(LIB_OBJS)

help:
@echo 'Perf make targets:'
@echo ' doc - make *all* documentation (see below)'
@echo ' man - make manpage documentation (access with man <foo>)'
@echo ' html - make html documentation'
@echo ' info - make GNU info documentation (access with info <foo>)'
@echo ' pdf - make pdf documentation'
@echo ' TAGS - use etags to make tag information for source browsing'
@echo ' tags - use ctags to make tag information for source browsing'
@echo ' cscope - use cscope to make interactive browsing database'
@echo ''
@echo 'Perf install targets:'
@echo ' NOTE: documentation build requires asciidoc, xmlto packages to be installed'
@echo ' HINT: use "make prefix=<path> <install target>" to install to a particular'
@echo ' path like make prefix=/usr/local install install-doc'
@echo ' install - install compiled binaries'
@echo ' install-doc - install *all* documentation'
@echo ' install-man - install manpage documentation'
@echo ' install-html - install html documentation'
@echo ' install-info - install GNU info documentation'
@echo ' install-pdf - install pdf documentation'
@echo ''
@echo ' quick-install-doc - alias for quick-install-man'
@echo ' quick-install-man - install the documentation quickly'
@echo ' quick-install-html - install the html documentation quickly'
@echo ''
@echo 'Perf maintainer targets:'
@echo ' distclean - alias to clean'
@echo ' clean - clean all binary objects and build output'

doc:
$(MAKE) -C Documentation all

Expand Down
3 changes: 2 additions & 1 deletion tools/perf/util/annotate.c
Original file line number Diff line number Diff line change
Expand Up @@ -541,11 +541,12 @@ void symbol__annotate_decay_histogram(struct symbol *sym, int evidx)
struct annotation *notes = symbol__annotation(sym);
struct sym_hist *h = annotation__histogram(notes, evidx);
struct objdump_line *pos;
int len = sym->end - sym->start;

h->sum = 0;

list_for_each_entry(pos, &notes->src->source, node) {
if (pos->offset != -1) {
if (pos->offset != -1 && pos->offset < len) {
h->addr[pos->offset] = h->addr[pos->offset] * 7 / 8;
h->sum += h->addr[pos->offset];
}
Expand Down
17 changes: 13 additions & 4 deletions tools/perf/util/probe-event.c
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ int show_line_range(struct line_range *lr, const char *module)
setup_pager();

if (lr->function)
fprintf(stdout, "<%s:%d>\n", lr->function,
fprintf(stdout, "<%s@%s:%d>\n", lr->function, lr->path,
lr->start - lr->offset);
else
fprintf(stdout, "<%s:%d>\n", lr->path, lr->start);
Expand Down Expand Up @@ -595,11 +595,11 @@ static int parse_line_num(char **ptr, int *val, const char *what)
* The line range syntax is described by:
*
* SRC[:SLN[+NUM|-ELN]]
* FNC[:SLN[+NUM|-ELN]]
* FNC[@SRC][:SLN[+NUM|-ELN]]
*/
int parse_line_range_desc(const char *arg, struct line_range *lr)
{
char *range, *name = strdup(arg);
char *range, *file, *name = strdup(arg);
int err;

if (!name)
Expand Down Expand Up @@ -649,7 +649,16 @@ int parse_line_range_desc(const char *arg, struct line_range *lr)
}
}

if (strchr(name, '.'))
file = strchr(name, '@');
if (file) {
*file = '\0';
lr->file = strdup(++file);
if (lr->file == NULL) {
err = -ENOMEM;
goto err;
}
lr->function = name;
} else if (strchr(name, '.'))
lr->file = name;
else
lr->function = name;
Expand Down
7 changes: 7 additions & 0 deletions tools/perf/util/ui/browser.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "libslang.h"
#include "ui.h"
#include <linux/compiler.h>
#include <linux/list.h>
#include <linux/rbtree.h>
Expand Down Expand Up @@ -178,6 +179,7 @@ int ui_browser__show(struct ui_browser *self, const char *title,
if (self->sb == NULL)
return -1;

pthread_mutex_lock(&ui__lock);
SLsmg_gotorc(0, 0);
ui_browser__set_color(self, NEWT_COLORSET_ROOT);
slsmg_write_nstring(title, self->width);
Expand All @@ -188,25 +190,30 @@ int ui_browser__show(struct ui_browser *self, const char *title,
va_start(ap, helpline);
ui_helpline__vpush(helpline, ap);
va_end(ap);
pthread_mutex_unlock(&ui__lock);
return 0;
}

void ui_browser__hide(struct ui_browser *self)
{
pthread_mutex_lock(&ui__lock);
newtFormDestroy(self->form);
self->form = NULL;
ui_helpline__pop();
pthread_mutex_unlock(&ui__lock);
}

int ui_browser__refresh(struct ui_browser *self)
{
int row;

pthread_mutex_lock(&ui__lock);
newtScrollbarSet(self->sb, self->index, self->nr_entries - 1);
row = self->refresh(self);
ui_browser__set_color(self, HE_COLORSET_NORMAL);
SLsmg_fill_region(self->y + row, self->x,
self->height - row, self->width, ' ');
pthread_mutex_unlock(&ui__lock);

return 0;
}
Expand Down
5 changes: 3 additions & 2 deletions tools/perf/util/ui/browsers/annotate.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ static void annotate_browser__write(struct ui_browser *self, void *entry, int ro
struct objdump_line_rb_node *olrb = objdump_line__rb(ol);
ui_browser__set_percent_color(self, olrb->percent, current_entry);
slsmg_printf(" %7.2f ", olrb->percent);
if (!current_entry)
ui_browser__set_color(self, HE_COLORSET_CODE);
} else {
ui_browser__set_percent_color(self, 0, current_entry);
slsmg_write_nstring(" ", 9);
Expand All @@ -57,6 +55,9 @@ static void annotate_browser__write(struct ui_browser *self, void *entry, int ro
slsmg_write_nstring(" ", width - 18);
else
slsmg_write_nstring(ol->line, width - 18);

if (!current_entry)
ui_browser__set_color(self, HE_COLORSET_CODE);
}

static double objdump_line__calc_percent(struct objdump_line *self,
Expand Down
5 changes: 4 additions & 1 deletion tools/perf/util/ui/helpline.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

#include "../debug.h"
#include "helpline.h"
#include "ui.h"

void ui_helpline__pop(void)
{
Expand Down Expand Up @@ -55,7 +56,8 @@ int ui_helpline__show_help(const char *format, va_list ap)
int ret;
static int backlog;

ret = vsnprintf(ui_helpline__last_msg + backlog,
pthread_mutex_lock(&ui__lock);
ret = vsnprintf(ui_helpline__last_msg + backlog,
sizeof(ui_helpline__last_msg) - backlog, format, ap);
backlog += ret;

Expand All @@ -64,6 +66,7 @@ int ui_helpline__show_help(const char *format, va_list ap)
newtRefresh();
backlog = 0;
}
pthread_mutex_unlock(&ui__lock);

return ret;
}
3 changes: 3 additions & 0 deletions tools/perf/util/ui/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
#include "../debug.h"
#include "browser.h"
#include "helpline.h"
#include "ui.h"

pthread_mutex_t ui__lock = PTHREAD_MUTEX_INITIALIZER;

static void newt_suspend(void *d __used)
{
Expand Down
8 changes: 8 additions & 0 deletions tools/perf/util/ui/ui.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#ifndef _PERF_UI_H_
#define _PERF_UI_H_ 1

#include <pthread.h>

extern pthread_mutex_t ui__lock;

#endif /* _PERF_UI_H_ */

0 comments on commit bee9690

Please sign in to comment.