perfcounters updates and fixes
Subsystems (4)
Linus,
Please consider pulling the latest perfcounters-fixes-for-linus git tree from:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip.git perfcounters-fixes-for-linus
This is the last bigger batch of perfcounters updates - but if it's too large i can cut it down some by phasing the atomic64_t patches to v2.6.32. I included it here because 32-bit atomic64_t is new in 2.6.31 so there's no risk of regression. The remaining generic impact is:
arch/x86/include/asm/stacktrace.h | 2 + arch/x86/kernel/dumpstack_32.c | 6 + arch/x86/kernel/dumpstack_64.c | 22 +-
Which change is related to callchains. The tree is well-tested, the last commit is 5 days old and the tree has calmed down.
The updates are:
- module symbols and annotation support
- complete call-chain support on the tooling side
- atomic64_t cleanups
- cleanups/code-removal
- fixes
Thanks,
Ingo
------------------>
Anton Blanchard (7):
perf report: Fix -z option
perf_counter tools: Remove zlib dependency
perf top: Move skip symbols to an array
perf top: Add ppc64 specific skip symbols and strip ppc64 . prefix perf report: Fix reporting of hypervisor
perf report: Add hypervisor dso
powerpc/perf_counter: Enable alternate PR/HV bits for POWER7
Arnaldo Carvalho de Melo (3):
perf_counter tools: Share rbtree.with the kernel perf_counter tools: Share list.h with the kernel perf_counter tools: Adjust symbols in ET_EXEC files too
Eric Dumazet (5):
x86: atomic64: The atomic64_t data type should be 8 bytes aligned on 32-bit too
x86: atomic64: Improve atomic64_read()
x86: atomic64: Improve cmpxchg8b()
x86: atomic64: Improve atomic64_read()
x86: atomic64: Inline atomic64_read() againFrederic Weisbecker (16):
perf_counter tools: Fix storage size allocation of callchain list perf_counter tools: Resolve symbols in callchains
perf_counter tools: Various fixes for callchains
perf_counter: Ignore the nmi call frames in the x86-64 backtraces
perf stat: Handle pipe read failures in perf stat
perf_counter tools: Create new chain_for_each_child() iterator perf_counter tools: Add new OPT_CALLBACK_DEFAULT option
perf report: Add support for callchain graph output
perf_counter tools: Set the minimum percent for callchains to be displayed perf_counter tools: Provide helper to print percents color
perf_counter tools: Display percents of hits in callchain with overhead colors perf report: Warn on callchain output request from non-callchain file perf report: Use a modifiable string for default callchain options
perf report: Change default callchain parameters
perf_counter tools: callchains: Manage the cumul hits on the fly
perf report: Add "Fractal" mode output - support callchains with relative overhead rate
Ingo Molnar (11):
perf report: Fix HV bit mismerge
perf_counter tools: Add more warnings and fix/annotate them perf report: Annotate variable initialization
x86: atomic64: Move the 32-bit atomic64_t implementation to a .c file
x86: atomic64: Improve atomic64_add_return()
x86: atomic64: Reduce size of functions
x86: atomic64: Make atomic_read() type-safe
x86: atomic64: Fix unclean type use in atomic64_xchg()
x86: atomic64: Export APIs to modules
x86: atomic64: Improve atomic64_xchg()
x86: atomic64: Clean up atomic64_sub_and_test() and atomic64_add_negative()
Jaswinder Singh Rajput (2):
perf stat: Define MATCH_EVENT for easy attr checking perf list: Add cache events
Mike Galbraith (4):
perf_counter tools: Make symbol loading consistently return number of loaded symbols perf_counter tools: Add infrastructure to support loading of kernel module symbols perf_counter tools: Connect module support infrastructure to symbol loading infrastructure perf_counter tools: Enable kernel module symbol loading in tools
Paul Mackerras (2):
perf_counter tools: Rework event string parsing/syntax
x86: atomic64: Code atomic(64)_read and atomic(64)_set in C not CPP
arch/powerpc/kernel/power7-pmu.c | 1 + arch/x86/include/asm/atomic_32.h | 185 +++------- arch/x86/include/asm/atomic_64.h | 42 ++- arch/x86/include/asm/stacktrace.h | 2 + arch/x86/kernel/cpu/perf_counter.c | 8 +- arch/x86/kernel/dumpstack_32.c | 6 + arch/x86/kernel/dumpstack_64.c | 22 +- arch/x86/lib/Makefile | 1 + arch/x86/lib/atomic64_32.c | 230 ++++++++++++ tools/perf/Makefile | 20 +- tools/perf/builtin-annotate.c | 69 ++-- tools/perf/builtin-help.c | 6 +- tools/perf/builtin-list.c | 2 +- tools/perf/builtin-record.c | 4 +- tools/perf/builtin-report.c | 383 +++++++++++++++---- tools/perf/builtin-stat.c | 51 ++-- tools/perf/builtin-top.c | 70 ++-- tools/perf/perf.c | 5 +- tools/perf/perf.h | 2 + tools/perf/util/alias.c | 2 +- tools/perf/util/cache.h | 1 + tools/perf/util/callchain.c | 255 ++++++++++--- tools/perf/util/callchain.h | 41 ++- tools/perf/util/color.c | 37 ++- tools/perf/util/color.h | 5 + tools/perf/util/config.c | 18 +- tools/perf/util/exec_cmd.c | 5 +- tools/perf/util/help.c | 26 +- tools/perf/util/help.h | 6 +- tools/perf/util/include/asm/system.h | 1 + tools/perf/util/include/linux/kernel.h | 21 + tools/perf/util/include/linux/list.h | 18 + tools/perf/util/include/linux/module.h | 6 + tools/perf/util/include/linux/poison.h | 1 + tools/perf/util/include/linux/prefetch.h | 6 + tools/perf/util/include/linux/rbtree.h | 1 + tools/perf/util/list.h | 603 ------------------------------ tools/perf/util/module.c | 509 +++++++++++++++++++++++++ tools/perf/util/module.h | 53 +++ tools/perf/util/parse-events.c | 251 +++++++++---- tools/perf/util/parse-options.c | 5 +- tools/perf/util/parse-options.h | 27 +- tools/perf/util/quote.c | 46 ++- tools/perf/util/quote.h | 2 +- tools/perf/util/rbtree.c | 383 ------------------- tools/perf/util/rbtree.h | 171 --------- tools/perf/util/strbuf.c | 13 +- tools/perf/util/strbuf.h | 10 +- tools/perf/util/strlist.h | 2 +- tools/perf/util/symbol.c | 179 ++++++++- tools/perf/util/symbol.h | 11 +- tools/perf/util/wrapper.c | 5 +- 52 files changed, 2105 insertions(+), 1724 deletions(-) create mode 100644 arch/x86/lib/atomic64_32.c create mode 100644 tools/perf/util/include/asm/system.h create mode 100644 tools/perf/util/include/linux/kernel.h create mode 100644 tools/perf/util/include/linux/list.h create mode 100644 tools/perf/util/include/linux/module.h create mode 100644 tools/perf/util/include/linux/poison.h create mode 100644 tools/perf/util/include/linux/prefetch.h create mode 100644 tools/perf/util/include/linux/rbtree.h delete mode 100644 tools/perf/util/list.h create mode 100644 tools/perf/util/module.c create mode 100644 tools/perf/util/module.h delete mode 100644 tools/perf/util/rbtree.c delete mode 100644 tools/perf/util/rbtree.h
arch/powerpc/kernel/power7-pmu.c +1 -0
@@ -358,6 +358,7 @@ static struct power_pmu power7_pmu = { .get_constraint = power7_get_constraint, .get_alternatives = power7_get_alternatives, .disable_pmc = power7_disable_pmc, + .flags = PPMU_ALT_SIPR, .n_generic = ARRAY_SIZE(power7_generic_events), .generic_events = power7_generic_events, .cache_events = &power7_cache_events,
arch/x86/include/asm/atomic_32.h +57 -128
289 lines not on this page · raw message
arch/x86/include/asm/atomic_64.h +34 -8
73 lines not on this page · raw message
arch/x86/include/asm/stacktrace.h +2 -0
@@ -3,6 +3,8 @@extern int kstack_depth_to_print; +int x86_is_stack_id (int id,char *name); +/* Generic stack tracer with callbacks */ struct stacktrace_ops {
arch/x86/kernel/cpu/perf_counter.c +7 -1
@@ -1561,6 +1561,7 @@ void callchain_store(struct perf_callchain_entry *entry, u64 ip) static DEFINE_PER_CPU(struct perf_callchain_entry, irq_entry); static DEFINE_PER_CPU(struct perf_callchain_entry, nmi_entry); +static DEFINE_PER_CPU(int, in_nmi_frame); static void
@@ -1576,7 +1577,9 @@ static void backtrace_warning(void *data, char *msg)static int backtrace_stack (void *data,char *name) { -/* Process all stacks: */ +per_cpu (in_nmi_frame,smp_processor_id ()) = +x86_is_stack_id (NMI_STACK , name); +return 0 ; }
@@ -1584,6 +1587,9 @@ static void backtrace_address(void *data, unsigned long addr, int reliable) {struct perf_callchain_entry *entry = data; +if (per_cpu (in_nmi_frame,smp_processor_id ())) +return ; +if (reliable)callchain_store (entry, addr); }
arch/x86/kernel/dumpstack_32.c +6 -0
@@ -19,6 +19,12 @@#include "dumpstack.h" +/* Just a stub for now */ +int x86_is_stack_id (int id,char *name) +{ +return 0 ; +} +void dump_trace (struct task_struct *task,struct pt_regs *regs,unsigned long *stack,unsigned long bp,const struct stacktrace_ops *ops,void *data)
arch/x86/kernel/dumpstack_64.c +15 -7
@@ -19,10 +19,8 @@#include "dumpstack.h" -static unsigned long *in_exception_stack (unsigned cpu,unsigned long stack, -unsigned *usedp,char **idp) -{ -static char ids[][8 ] = { + +static char x86_stack_ids[][8 ] = { [DEBUG_STACK -1 ] ="#DB" , [NMI_STACK -1 ] ="NMI" , [DOUBLEFAULT_STACK -1 ] ="#DF" ,
@@ -33,6 +31,15 @@ static unsigned long *in_exception_stack(unsigned cpu, unsigned long stack, N_EXCEPTION_STACKS + DEBUG_STKSZ / EXCEPTION_STKSZ - 2] = "#DB[?]"#endif }; + +int x86_is_stack_id (int id,char *name) +{ +return x86_stack_ids[id -1 ] == name; +} + +static unsigned long *in_exception_stack (unsigned cpu,unsigned long stack, +unsigned *usedp,char **idp) +{unsigned k;/*
@@ -61,7 +68,7 @@ static unsigned long *in_exception_stack(unsigned cpu, unsigned long stack,if (*usedp & (1U << k))break ; *usedp |=1U << k; - *idp = ids[k]; + *idp = x86_stack_ids[k];return (unsigned long *)end; }/*
@@ -81,12 +88,13 @@ static unsigned long *in_exception_stack(unsigned cpu, unsigned long stack,do { ++j; end -=EXCEPTION_STKSZ ; - ids[j][4 ] ='1' + (j -N_EXCEPTION_STACKS ); + x86_stack_ids[j][4 ] ='1' + + (j -N_EXCEPTION_STACKS ); }while (stack < end -EXCEPTION_STKSZ );if (*usedp & (1U << j))break ; *usedp |=1U << j; - *idp = ids[j]; + *idp = x86_stack_ids[j]; return (unsigned long *)end; }#endif
arch/x86/lib/Makefile +1 -0
@@ -10,6 +10,7 @@ lib-y += usercopy_$(BITS).o getuser.o putuser.o lib-y += memcpy_$(BITS).o ifeq ($(CONFIG_X86_32),y) + obj-y += atomic64_32.o lib-y += checksum_32.o lib-y += strstr_32.o lib-y += semaphore_32.o string_32.o
arch/x86/lib/atomic64_32.c new file +230 -0
230 lines not on this page · raw message
tools/perf/Makefile +10 -10
@@ -164,7 +164,7 @@ endif # CFLAGS and LDFLAGS are for the users to override from the command line. -CFLAGS = $(M64) -ggdb3 -Wall -Wstrict-prototypes -Wmissing-declarations -Wmissing-prototypes -std=gnu99 -Wdeclaration-after-statement -Werror -O6 +CFLAGS = $(M64) -ggdb3 -Wall -Wextra -Wstrict-prototypes -Wmissing-declarations -Wmissing-prototypes -std=gnu99 -Wdeclaration-after-statement -Werror -O6 LDFLAGS = -lpthread -lrt -lelf -lm ALL_CFLAGS = $(CFLAGS) ALL_LDFLAGS = $(LDFLAGS)
@@ -223,7 +223,7 @@ SPARSE_FLAGS = -D__BIG_ENDIAN__ -D__powerpc__ # Those must not be GNU-specific; they are shared with perl/ which may # be built by a different compiler. (Note that this is an artifact now # but it still might be nice to keep that distinction.) -BASIC_CFLAGS = +BASIC_CFLAGS = -Iutil/include BASIC_LDFLAGS = # Guard against environment variables
@@ -289,10 +289,11 @@ export PERL_PATH LIB_FILE=libperf.a LIB_H += ../../include/linux/perf_counter.h +LIB_H += ../../include/linux/rbtree.h +LIB_H += ../../include/linux/list.h +LIB_H += util/include/linux/list.h LIB_H += perf.h LIB_H += util/types.h -LIB_H += util/list.h -LIB_H += util/rbtree.h LIB_H += util/levenshtein.h LIB_H += util/parse-options.h LIB_H += util/parse-events.h
@@ -305,6 +306,7 @@ LIB_H += util/strlist.h LIB_H += util/run-command.h LIB_H += util/sigchain.h LIB_H += util/symbol.h +LIB_H += util/module.h LIB_H += util/color.h LIB_OBJS += util/abspath.o
@@ -328,6 +330,7 @@ LIB_OBJS += util/usage.o LIB_OBJS += util/wrapper.o LIB_OBJS += util/sigchain.o LIB_OBJS += util/symbol.o +LIB_OBJS += util/module.o LIB_OBJS += util/color.o LIB_OBJS += util/pager.o LIB_OBJS += util/header.o
@@ -381,12 +384,6 @@ ifndef CC_LD_DYNPATH endif endif -ifdef ZLIB_PATH - BASIC_CFLAGS += -I$(ZLIB_PATH)/include - EXTLIBS += -L$(ZLIB_PATH)/$(lib) $(CC_LD_DYNPATH)$(ZLIB_PATH)/$(lib) -endif -EXTLIBS += -lz - ifdef NEEDS_SOCKET EXTLIBS += -lsocket endif
@@ -697,6 +694,9 @@ builtin-init-db.o: builtin-init-db.c PERF-CFLAGS util/config.o: util/config.c PERF-CFLAGS $(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) -DETC_PERFCONFIG='"$(ETC_PERFCONFIG_SQ)"' $< +util/rbtree.o: ../../lib/rbtree.c PERF-CFLAGS + $(QUIET_CC)$(CC) -o util/rbtree.o -c $(ALL_CFLAGS) -DETC_PERFCONFIG='"$(ETC_PERFCONFIG_SQ)"' $< + perf-%$X: %.o $(PERFLIBS) $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS)
tools/perf/builtin-annotate.c +31 -38
184 lines not on this page · raw message
tools/perf/builtin-help.c +4 -2
@@ -3,6 +3,7 @@* * Builtin help command */ +#include "perf.h" #include "util/cache.h" #include "builtin.h" #include "util/exec_cmd.h"
@@ -277,7 +278,7 @@ static struct cmdnames main_cmds, other_cmds;void list_common_cmds_help (void ) { -int i, longest =0 ; +unsigned int i, longest =0 ;for (i =0 ; i <ARRAY_SIZE (common_cmds); i++) {if (longest <strlen (common_cmds[i].name))
@@ -415,9 +416,10 @@ static void show_html_page(const char *perf_cmd)open_html (page_path.buf); } -int cmd_help (int argc,const char **argv,const char *prefix) +int cmd_help (int argc,const char **argv,const char *prefix__used ) {const char *alias; +load_command_list ("perf-" , &main_cmds, &other_cmds);perf_config (perf_help_config,NULL );
tools/perf/builtin-list.c +1 -1
@@ -13,7 +13,7 @@#include "util/parse-options.h" #include "util/parse-events.h" -int cmd_list (int argc,const char **argv,const char *prefix) +int cmd_list (int argc__used ,const char **argv__used ,const char *prefix__used ) {print_events ();return 0 ;
tools/perf/builtin-record.c +2 -2
@@ -294,7 +294,7 @@ static void pid_synthesize_mmap_samples(pid_t pid)while (1 ) {char bf[BUFSIZ ], *pbf = bf;struct mmap_event mmap_ev = { - .header.type =PERF_EVENT_MMAP , + .header = { .type =PERF_EVENT_MMAP }, };int n;size_t size;
@@ -650,7 +650,7 @@ static const struct option options[] = { OPT_END() }; -int cmd_record (int argc,const char **argv,const char *prefix) +int cmd_record (int argc,const char **argv,const char *prefix__used ) {int counter;
tools/perf/builtin-report.c +303 -80
609 lines not on this page · raw message
tools/perf/builtin-stat.c +24 -27
139 lines not on this page · raw message
tools/perf/builtin-top.c +42 -28
157 lines not on this page · raw message
tools/perf/perf.c +1 -4
@@ -229,9 +229,6 @@ static int run_builtin(struct cmd_struct *p, int argc, const char **argv) use_pager =1 ;commit_pager_choice (); -if (p->option &NEED_WORK_TREE ) -/* setup_work_tree() */ ; - status = p->fn (argc, argv, prefix);if (status)return status &0xff ;
@@ -266,7 +263,7 @@ static void handle_internal_command(int argc, const char **argv) { "annotate", cmd_annotate, 0 }, { "version", cmd_version, 0 }, }; -int i; +unsigned int i;static const char ext[] =STRIP_EXTENSION ;if (sizeof (ext) >1 ) {
tools/perf/perf.h +2 -0
@@ -52,6 +52,8 @@ static inline unsigned long long rdclock(void)#define __user#define asmlinkage +#define __used __attribute__((__unused__)) +#define unlikely (x) __builtin_expect(!!(x), 0)#define min (x, y) ({ \ typeof(x) _min1 = (x); \
tools/perf/util/alias.c +1 -1
@@ -3,7 +3,7 @@static const char *alias_key;static char *alias_val; -static int alias_lookup_cb (const char *k,const char *v,void *cb) +static int alias_lookup_cb (const char *k,const char *v,void *cb__used ) {if (!prefixcmp (k,"alias." ) && !strcmp (k+6 , alias_key)) {if (!v)
tools/perf/util/cache.h +1 -0
@@ -3,6 +3,7 @@#include "util.h" #include "strbuf.h" +#include "../perf.h" #define PERF_DIR_ENVIRONMENT "PERF_DIR"#define PERF_WORK_TREE_ENVIRONMENT "PERF_WORK_TREE"
tools/perf/util/callchain.c +208 -47
367 lines not on this page · raw message
tools/perf/util/callchain.h +31 -10
59 lines not on this page · raw message
tools/perf/util/color.c +34 -3
@@ -11,7 +11,8 @@ static int parse_color(const char *name, int len) };char *end;int i; -for (i =0 ; i <ARRAY_SIZE (color_names); i++) { + +for (i =0 ; i < (int )ARRAY_SIZE (color_names); i++) {const char *str = color_names[i];if (!strncasecmp (name, str, len) && !str[len])return i -1 ;
@@ -28,7 +29,8 @@ static int parse_attr(const char *name, int len)static const char *const attr_names[] = {"bold" ,"dim" ,"ul" ,"blink" ,"reverse" }; -int i; +unsigned int i; +for (i =0 ; i <ARRAY_SIZE (attr_names); i++) {const char *str = attr_names[i];if (!strncasecmp (name, str, len) && !str[len])
@@ -222,10 +224,12 @@ int color_fwrite_lines(FILE *fp, const char *color, {if (!*color)return fwrite (buf, count,1 , fp) !=1 ; +while (count) {char *p =memchr (buf,'\n' , count); +if (p != buf && (fputs (color, fp) <0 || -fwrite (buf, p ? p - buf : count,1 , fp) !=1 || +fwrite (buf, p ? (size_t )(p - buf) : count,1 , fp) !=1 ||fputs (PERF_COLOR_RESET , fp) <0 ))return -1 ;if (!p)
@@ -238,4 +242,31 @@ int color_fwrite_lines(FILE *fp, const char *color,return 0 ; } +char *get_percent_color (double percent) +{ +char *color =PERF_COLOR_NORMAL ; +/* +* We color high-overhead entries in red, mid-overhead +* entries in green - and keep the low overhead places +* normal: +*/ +if (percent >=MIN_RED ) + color =PERF_COLOR_RED ; +else { +if (percent >MIN_GREEN ) + color =PERF_COLOR_GREEN ; + } +return color; +} + +int percent_color_fprintf (FILE *fp,const char *fmt,double percent) +{ +int r; +char *color; + + color =get_percent_color (percent); + r =color_fprintf (fp, color, fmt, percent); + +return r; +}
tools/perf/util/color.h +5 -0
@@ -15,6 +15,9 @@#define PERF_COLOR_CYAN "\033[36m"#define PERF_COLOR_BG_RED "\033[41m" +#define MIN_GREEN 0.5 +#define MIN_RED 5.0 +/* * This variable stores the value of color.ui */
@@ -32,5 +35,7 @@ void color_parse_mem(const char *value, int len, const char *var, char *dst);int color_fprintf (FILE *fp,const char *color,const char *fmt, ...);int color_fprintf_ln (FILE *fp,const char *color,const char *fmt, ...);int color_fwrite_lines (FILE *fp,const char *color,size_t count,const char *buf); +int percent_color_fprintf (FILE *fp,const char *fmt,double percent); +char *get_percent_color (double percent);#endif /* COLOR_H */
tools/perf/util/config.c +10 -8
@@ -47,10 +47,12 @@ static int get_next_char(void)static char *parse_value (void ) {static char value[1024 ]; -int quote =0 , comment =0 , len =0 , space =0 ; +int quote =0 , comment =0 , space =0 ; +size_t len =0 ;for (;;) {int c =get_next_char (); +if (len >=sizeof (value) -1 )return NULL ;if (c =='\n' ) {
@@ -353,13 +355,13 @@ int perf_config_string(const char **dest, const char *var, const char *value)return 0 ; } -static int perf_default_core_config (const char *var,const char *value) +static int perf_default_core_config (const char *var__used ,const char *value__used ) {/* Add other config variables here and to Documentation/config.txt. */ return 0 ; } -int perf_default_config (const char *var,const char *value,void *dummy) +int perf_default_config (const char *var,const char *value,void *dummy__used ) {if (!prefixcmp (var,"core." ))return perf_default_core_config (var, value);
@@ -471,10 +473,10 @@ static int matches(const char* key, const char* value) !regexec(store.value_regex, value, 0, NULL, 0))); } -static int store_aux (const char * key,const char * value,void *cb) +static int store_aux (const char * key,const char * value,void *cb__used ) { +int section_len;const char *ep; -size_t section_len;switch (store.state) {case KEY_SEEN :
@@ -551,7 +553,7 @@ static int store_write_section(int fd, const char* key)strbuf_addf (&sb,"[%.*s]\n" , store.baselen, key); } - success =write_in_full (fd, sb.buf, sb.len) == sb.len; + success = (write_in_full (fd, sb.buf, sb.len) == (ssize_t )sb.len);strbuf_release (&sb);return success;
@@ -599,7 +601,7 @@ static int store_write_pair(int fd, const char* key, const char* value) }strbuf_addf (&sb,"%s\n" , quote); - success =write_in_full (fd, sb.buf, sb.len) == sb.len; + success = (write_in_full (fd, sb.buf, sb.len) == (ssize_t )sb.len);strbuf_release (&sb);return success;
@@ -741,7 +743,7 @@ int perf_config_set_multivar(const char* key, const char* value, }else {struct stat st;char * contents; -size_t contents_sz, copy_begin, copy_end; +ssize_t contents_sz, copy_begin, copy_end;int i, new_line =0 ;if (value_regex ==NULL )
tools/perf/util/exec_cmd.c +4 -1
@@ -1,6 +1,9 @@#include "cache.h" #include "exec_cmd.h" #include "quote.h" + +#include <string.h> +#define MAX_ARGS 32extern char **environ;
@@ -51,7 +54,7 @@ const char *perf_extract_argv0_path(const char *argv0) slash--;if (slash >= argv0) { - argv0_path =strndup (argv0, slash - argv0); + argv0_path =xstrndup (argv0, slash - argv0);return slash +1 ; }
tools/perf/util/help.c +15 -11
@@ -26,7 +26,7 @@ static int term_columns(void)return 80 ; } -void add_cmdname (struct cmdnames *cmds,const char *name,int len) +void add_cmdname (struct cmdnames *cmds,const char *name,size_t len) {struct cmdname *ent =malloc (sizeof (*ent) + len +1 );
@@ -40,7 +40,8 @@ void add_cmdname(struct cmdnames *cmds, const char *name, int len)static void clean_cmdnames (struct cmdnames *cmds) { -int i; +unsigned int i; +for (i =0 ; i < cmds->cnt; ++i)free (cmds->names[i]);free (cmds->names);
@@ -57,7 +58,7 @@ static int cmdname_compare(const void *a_, const void *b_)static void uniq (struct cmdnames *cmds) { -int i, j; +unsigned int i, j;if (!cmds->cnt)return ;
@@ -71,7 +72,7 @@ static void uniq(struct cmdnames *cmds)void exclude_cmds (struct cmdnames *cmds,struct cmdnames *excludes) { -int ci, cj, ei; +size_t ci, cj, ei;int cmp; ci = cj = ei =0 ;
@@ -106,8 +107,9 @@ static void pretty_print_string_list(struct cmdnames *cmds, int longest)printf (" " );for (j =0 ; j < cols; j++) { -int n = j * rows + i; -int size = space; +unsigned int n = j * rows + i; +unsigned int size = space; +if (n >= cmds->cnt)break ;if (j == cols-1 || n + rows >= cmds->cnt)
@@ -208,7 +210,7 @@ void load_command_list(const char *prefix,void list_commands (const char *title,struct cmdnames *main_cmds,struct cmdnames *other_cmds) { -int i, longest =0 ; +unsigned int i, longest =0 ;for (i =0 ; i < main_cmds->cnt; i++)if (longest < main_cmds->names[i]->len)
@@ -239,7 +241,8 @@ void list_commands(const char *title, struct cmdnames *main_cmds,int is_in_cmdlist (struct cmdnames *c,const char *s) { -int i; +unsigned int i; +for (i =0 ; i < c->cnt; i++)if (!strcmp (s, c->names[i]->name))return 1 ;
@@ -271,7 +274,8 @@ static int levenshtein_compare(const void *p1, const void *p2)static void add_cmd_list (struct cmdnames *cmds,struct cmdnames *old) { -int i; +unsigned int i; +ALLOC_GROW (cmds->names, cmds->cnt + old->cnt, cmds->alloc);for (i =0 ; i < old->cnt; i++)
@@ -283,7 +287,7 @@ static void add_cmd_list(struct cmdnames *cmds, struct cmdnames *old)const char *help_unknown_cmd (const char *cmd) { -int i, n =0 , best_similarity =0 ; +unsigned int i, n =0 , best_similarity =0 ;struct cmdnames main_cmds, other_cmds;memset (&main_cmds,0 ,sizeof (main_cmds));
@@ -345,7 +349,7 @@ const char *help_unknown_cmd(const char *cmd)exit (1 ); } -int cmd_version (int argc,const char **argv,const char *prefix) +int cmd_version (int argc__used ,const char **argv__used ,const char *prefix__used ) {printf ("perf version %s\n" , perf_version_string);return 0 ;
tools/perf/util/help.h +3 -3
@@ -2,8 +2,8 @@#define HELP_H struct cmdnames { -int alloc; -int cnt; +size_t alloc; +size_t cnt;struct cmdname {size_t len;/* also used for similarity index in help.c */ char name[FLEX_ARRAY ];
@@ -19,7 +19,7 @@ static inline void mput_char(char c, unsigned int num)void load_command_list (const char *prefix,struct cmdnames *main_cmds,struct cmdnames *other_cmds); -void add_cmdname (struct cmdnames *cmds,const char *name,int len); +void add_cmdname (struct cmdnames *cmds,const char *name,size_t len);/* Here we require that excludes is a sorted list. */ void exclude_cmds (struct cmdnames *cmds,struct cmdnames *excludes);int is_in_cmdlist (struct cmdnames *c,const char *s);
tools/perf/util/include/asm/system.h new file +1 -0
@@ -0,0 +1 @@ +/* Empty */
tools/perf/util/include/linux/kernel.h new file +21 -0
@@ -0,0 +1,21 @@ +#ifndef PERF_LINUX_KERNEL_H_ +#define PERF_LINUX_KERNEL_H_ + +#ifndef offsetof +#define offsetof (TYPE ,MEMBER ) ((size_t) &((TYPE *)0)->MEMBER) +#endif + +#ifndef container_of +/** +* container_of - cast a member of a structure out to the containing structure +* @ptr: the pointer to the member. +* @type: the type of the container struct this is embedded in. +* @member: the name of the member within the struct. +* +*/ +#define container_of (ptr, type, member) ({ \ + const typeof(((type *)0)->member) * __mptr = (ptr); \ + (type *)((char *)__mptr - offsetof(type, member)); }) +#endif + +#endif
tools/perf/util/include/linux/list.h new file +18 -0
@@ -0,0 +1,18 @@ +#include "../../../../include/linux/list.h" + +#ifndef PERF_LIST_H +#define PERF_LIST_H +/** +* list_del_range - deletes range of entries from list. +* @begin: first element in the range to delete from the list. +* @end: last element in the range to delete from the list. +* Note: list_empty on the range of entries does not return true after this, +* the entries is in an undefined state. +*/ +static inline void list_del_range (struct list_head *begin, +struct list_head *end) +{ + begin->prev->next = end->next; + end->next->prev = begin->prev; +} +#endif
tools/perf/util/include/linux/module.h new file +6 -0
@@ -0,0 +1,6 @@ +#ifndef PERF_LINUX_MODULE_H +#define PERF_LINUX_MODULE_H + +#define EXPORT_SYMBOL (name) + +#endif
tools/perf/util/include/linux/poison.h new file +1 -0
@@ -0,0 +1 @@ +#include "../../../../include/linux/poison.h"
tools/perf/util/include/linux/prefetch.h new file +6 -0
@@ -0,0 +1,6 @@ +#ifndef PERF_LINUX_PREFETCH_H +#define PERF_LINUX_PREFETCH_H + +static inline void prefetch (void *a __attribute__((unused))) { } + +#endif
tools/perf/util/include/linux/rbtree.h new file +1 -0
@@ -0,0 +1 @@ +#include "../../../../include/linux/rbtree.h"
tools/perf/util/list.h deleted +0 -603
312 lines not on this page · raw message
tools/perf/util/module.c new file +509 -0
509 lines not on this page · raw message
tools/perf/util/module.h new file +53 -0
53 lines not on this page · raw message
tools/perf/util/parse-events.c +177 -74
251 lines not on this page · raw message
tools/perf/util/quote.c +25 -21
46 lines not on this page · raw message
tools/perf/util/rbtree.c deleted +0 -383
383 lines not on this page · raw message
tools/perf/util/rbtree.h deleted +0 -171
171 lines not on this page · raw message
tools/perf/util/symbol.c +161 -18
179 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Part of the diff is not shown here. View the raw message.
Quoted 5 lines · Ingo Molnar
Please consider pulling the latest perfcounters-fixes-for-linus git tree from:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip.gitperfcounters-fixes-for-linus
Forgot to push out?
Linus
Quoted 8 lines · Linus Torvalds
Quoted 5 lines · Ingo Molnar
Please consider pulling the latest perfcounters-fixes-for-linus git tree from:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip.gitperfcounters-fixes-for-linusForgot to push out?
Yeah, fixed that now - sorry.
Ingo