Skip to content

Commit

Permalink
Merge tag 'perf-core-for-mingo' of git://git.kernel.org/pub/scm/linux…
Browse files Browse the repository at this point in the history
…/kernel/git/acme/linux into perf/core

Pull perf/core improvements and fixes from Arnaldo Carvalho de Melo:

 - Rename libtraceevent 'private' struct member to 'priv' so that it works
   in C++, from Steven Rostedt

 - Remove lots of exit()/die() calls from tools so that the main perf exit
   routine can take place, from David Ahern

 - Fix x86 build on x86-64, from David Ahern.

 - Remove some headers that prevented perf from building on Android,
   from David Ahern

 - {int,str,rb}list fixes from Suzuki K Poulose

 - perf.data header fixes from Namhyung Kim

 - Replace needless mempcpy with memcpy, to allow build on Android, from Irina Tirdea

 - Allow user to indicate objdump path, needed in cross environments, from
   Maciek Borzecki

 - Fix hardware cache event name generation, fix from Jiri Olsa

 - Add round trip test for sw, hw and cache event names, catching the
   problem Jiri fixed, after Jiri's patch, the test passes successfully.

 - Clean target should do clean for lib/traceevent too, fix from David Ahern

 - Check the right variable for allocation failure, fix from Namhyung Kim

 - Set up evsel->tp_format regardless of evsel->name being set already,
   fix from Namhyung Kim

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
  • Loading branch information
Ingo Molnar committed Sep 7, 2012
2 parents bab57e9 + 275ef38 commit 479d875
Show file tree
Hide file tree
Showing 27 changed files with 550 additions and 202 deletions.
4 changes: 2 additions & 2 deletions tools/lib/traceevent/event-parse.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ struct pevent_record {
int cpu;
int ref_count;
int locked; /* Do not free, even if ref_count is zero */
void *private;
void *priv;
#if DEBUG_RECORD
struct pevent_record *prev;
struct pevent_record *next;
Expand Down Expand Up @@ -106,7 +106,7 @@ struct plugin_option {
char *plugin_alias;
char *description;
char *value;
void *private;
void *priv;
int set;
};

Expand Down
3 changes: 3 additions & 0 deletions tools/perf/Documentation/perf-annotate.txt
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ OPTIONS
-M::
--disassembler-style=:: Set disassembler style for objdump.

--objdump=<path>::
Path to objdump binary.

SEE ALSO
--------
linkperf:perf-record[1], linkperf:perf-report[1]
3 changes: 3 additions & 0 deletions tools/perf/Documentation/perf-report.txt
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,9 @@ OPTIONS
branch stacks and it will automatically switch to the branch view mode,
unless --no-branch-stack is used.

--objdump=<path>::
Path to objdump binary.

SEE ALSO
--------
linkperf:perf-stat[1], linkperf:perf-annotate[1]
9 changes: 6 additions & 3 deletions tools/perf/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,12 @@ AR = $(CROSS_COMPILE)ar

# Additional ARCH settings for x86
ifeq ($(ARCH),i386)
ARCH := x86
override ARCH := x86
NO_PERF_REGS := 0
LIBUNWIND_LIBS = -lunwind -lunwind-x86
endif
ifeq ($(ARCH),x86_64)
ARCH := x86
override ARCH := x86
IS_X86_64 := 0
ifeq (, $(findstring m32,$(EXTRA_CFLAGS)))
IS_X86_64 := $(shell echo __x86_64__ | ${CC} -E -xc - | tail -n 1)
Expand Down Expand Up @@ -917,6 +917,9 @@ $(LIB_FILE): $(LIB_OBJS)
$(LIBTRACEEVENT):
$(QUIET_SUBDIR0)$(TRACE_EVENT_DIR) $(QUIET_SUBDIR1) O=$(OUTPUT) libtraceevent.a

$(LIBTRACEEVENT)-clean:
$(QUIET_SUBDIR0)$(TRACE_EVENT_DIR) $(QUIET_SUBDIR1) O=$(OUTPUT) clean

help:
@echo 'Perf make targets:'
@echo ' doc - make *all* documentation (see below)'
Expand Down Expand Up @@ -1056,7 +1059,7 @@ quick-install-html:

### Cleaning rules

clean:
clean: $(LIBTRACEEVENT)-clean
$(RM) $(LIB_OBJS) $(BUILTIN_OBJS) $(LIB_FILE) $(OUTPUT)perf-archive $(OUTPUT)perf.o $(LANG_BINDINGS)
$(RM) $(ALL_PROGRAMS) perf
$(RM) *.spec *.pyc *.pyo */*.pyc */*.pyo $(OUTPUT)common-cmds.h TAGS tags cscope*
Expand Down
2 changes: 2 additions & 0 deletions tools/perf/builtin-annotate.c
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,8 @@ int cmd_annotate(int argc, const char **argv, const char *prefix __used)
"Display raw encoding of assembly instructions (default)"),
OPT_STRING('M', "disassembler-style", &disassembler_style, "disassembler style",
"Specify disassembler style (e.g. -M intel for intel syntax)"),
OPT_STRING(0, "objdump", &objdump_path, "path",
"objdump binary to use for disassembly and annotations"),
OPT_END()
};

Expand Down
48 changes: 34 additions & 14 deletions tools/perf/builtin-help.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,14 @@ static struct man_viewer_info_list {
} *man_viewer_info_list;

enum help_format {
HELP_FORMAT_NONE,
HELP_FORMAT_MAN,
HELP_FORMAT_INFO,
HELP_FORMAT_WEB,
};

static bool show_all = false;
static enum help_format help_format = HELP_FORMAT_MAN;
static enum help_format help_format = HELP_FORMAT_NONE;
static struct option builtin_help_options[] = {
OPT_BOOLEAN('a', "all", &show_all, "print all available commands"),
OPT_SET_UINT('m', "man", &help_format, "show man page", HELP_FORMAT_MAN),
Expand All @@ -54,7 +55,9 @@ static enum help_format parse_help_format(const char *format)
return HELP_FORMAT_INFO;
if (!strcmp(format, "web") || !strcmp(format, "html"))
return HELP_FORMAT_WEB;
die("unrecognized help format '%s'", format);

pr_err("unrecognized help format '%s'", format);
return HELP_FORMAT_NONE;
}

static const char *get_man_viewer_info(const char *name)
Expand Down Expand Up @@ -259,6 +262,8 @@ static int perf_help_config(const char *var, const char *value, void *cb)
if (!value)
return config_error_nonbool(var);
help_format = parse_help_format(value);
if (help_format == HELP_FORMAT_NONE)
return -1;
return 0;
}
if (!strcmp(var, "man.viewer")) {
Expand Down Expand Up @@ -352,7 +357,7 @@ static void exec_viewer(const char *name, const char *page)
warning("'%s': unknown man viewer.", name);
}

static void show_man_page(const char *perf_cmd)
static int show_man_page(const char *perf_cmd)
{
struct man_viewer_list *viewer;
const char *page = cmd_to_page(perf_cmd);
Expand All @@ -365,28 +370,35 @@ static void show_man_page(const char *perf_cmd)
if (fallback)
exec_viewer(fallback, page);
exec_viewer("man", page);
die("no man viewer handled the request");

pr_err("no man viewer handled the request");
return -1;
}

static void show_info_page(const char *perf_cmd)
static int show_info_page(const char *perf_cmd)
{
const char *page = cmd_to_page(perf_cmd);
setenv("INFOPATH", system_path(PERF_INFO_PATH), 1);
execlp("info", "info", "perfman", page, NULL);
return -1;
}

static void get_html_page_path(struct strbuf *page_path, const char *page)
static int get_html_page_path(struct strbuf *page_path, const char *page)
{
struct stat st;
const char *html_path = system_path(PERF_HTML_PATH);

/* Check that we have a perf documentation directory. */
if (stat(mkpath("%s/perf.html", html_path), &st)
|| !S_ISREG(st.st_mode))
die("'%s': not a documentation directory.", html_path);
|| !S_ISREG(st.st_mode)) {
pr_err("'%s': not a documentation directory.", html_path);
return -1;
}

strbuf_init(page_path, 0);
strbuf_addf(page_path, "%s/%s.html", html_path, page);

return 0;
}

/*
Expand All @@ -401,19 +413,23 @@ static void open_html(const char *path)
}
#endif

static void show_html_page(const char *perf_cmd)
static int show_html_page(const char *perf_cmd)
{
const char *page = cmd_to_page(perf_cmd);
struct strbuf page_path; /* it leaks but we exec bellow */

get_html_page_path(&page_path, page);
if (get_html_page_path(&page_path, page) != 0)
return -1;

open_html(page_path.buf);

return 0;
}

int cmd_help(int argc, const char **argv, const char *prefix __used)
{
const char *alias;
int rc = 0;

load_command_list("perf-", &main_cmds, &other_cmds);

Expand Down Expand Up @@ -444,16 +460,20 @@ int cmd_help(int argc, const char **argv, const char *prefix __used)

switch (help_format) {
case HELP_FORMAT_MAN:
show_man_page(argv[0]);
rc = show_man_page(argv[0]);
break;
case HELP_FORMAT_INFO:
show_info_page(argv[0]);
rc = show_info_page(argv[0]);
break;
case HELP_FORMAT_WEB:
show_html_page(argv[0]);
rc = show_html_page(argv[0]);
break;
case HELP_FORMAT_NONE:
/* fall-through */
default:
rc = -1;
break;
}

return 0;
return rc;
}
Loading

0 comments on commit 479d875

Please sign in to comment.