Merge branch 'perf/core' into perf/probes
authorIngo Molnar <mingo@elte.hu>
Tue, 17 Nov 2009 09:16:43 +0000 (10:16 +0100)
committerIngo Molnar <mingo@elte.hu>
Tue, 17 Nov 2009 09:17:47 +0000 (10:17 +0100)
Resolved merge conflict in tools/perf/Makefile

Merge reason: we want to queue up a dependent patch.

Signed-off-by: Ingo Molnar <mingo@elte.hu>
1  2 
arch/x86/Makefile
tools/perf/Makefile
tools/perf/builtin.h
tools/perf/command-list.txt
tools/perf/perf.c
tools/perf/util/util.h

diff --combined arch/x86/Makefile
index ba7a6df4db92d389580da32f0bd4b4582abe5f31,d2d24c9ee64d926de80a249330e938095623ca85..78b32be55e9e7a82dafcdf96a5b59be4a26decd8
@@@ -76,7 -76,6 +76,6 @@@ ifdef CONFIG_CC_STACKPROTECTO
        cc_has_sp := $(srctree)/scripts/gcc-x86_$(BITS)-has-stack-protector.sh
          ifeq ($(shell $(CONFIG_SHELL) $(cc_has_sp) $(CC) $(biarch)),y)
                  stackp-y := -fstack-protector
-                 stackp-$(CONFIG_CC_STACKPROTECTOR_ALL) += -fstack-protector-all
                  KBUILD_CFLAGS += $(stackp-y)
          else
                  $(warning stack protector enabled but no compiler support)
@@@ -156,9 -155,6 +155,9 @@@ all: bzImag
  KBUILD_IMAGE := $(boot)/bzImage
  
  bzImage: vmlinux
 +ifeq ($(CONFIG_X86_DECODER_SELFTEST),y)
 +      $(Q)$(MAKE) $(build)=arch/x86/tools posttest
 +endif
        $(Q)$(MAKE) $(build)=$(boot) $(KBUILD_IMAGE)
        $(Q)mkdir -p $(objtree)/arch/$(UTS_MACHINE)/boot
        $(Q)ln -fsn ../../x86/boot/bzImage $(objtree)/arch/$(UTS_MACHINE)/boot/$@
diff --combined tools/perf/Makefile
index 147e3cf035d307320971e13f1cd8b20e3bd6b4ec,46a58a81c9ad5df9fe68f02d5756c629c26a0d8b..3dbb5c5bb8c665bd41db347b5766842b18d4a17b
@@@ -177,8 -177,7 +177,7 @@@ endi
  # Include saner warnings here, which can catch bugs:
  #
  
- EXTRA_WARNINGS := -Wcast-align
- EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wformat
+ EXTRA_WARNINGS := -Wformat
  EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wformat-security
  EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wformat-y2k
  EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wshadow
@@@ -208,7 -207,7 +207,7 @@@ ifndef PERF_DEBU
    CFLAGS_OPTIMIZE = -O6
  endif
  
- CFLAGS = $(MBITS) -ggdb3 -Wall -Wextra -std=gnu99 -Werror $(CFLAGS_OPTIMIZE) -fstack-protector-all -D_FORTIFY_SOURCE=2 $(EXTRA_WARNINGS)
+ CFLAGS = $(MBITS) -ggdb3 -Wall -Wextra -std=gnu99 -Werror $(CFLAGS_OPTIMIZE) -D_FORTIFY_SOURCE=2 $(EXTRA_WARNINGS)
  LDFLAGS = -lpthread -lrt -lelf -lm
  ALL_CFLAGS = $(CFLAGS)
  ALL_LDFLAGS = $(LDFLAGS)
@@@ -260,6 -259,9 +259,9 @@@ PTHREAD_LIBS = -lpthrea
  # explicitly what architecture to check for. Fix this up for yours..
  SPARSE_FLAGS = -D__BIG_ENDIAN__ -D__powerpc__
  
+ ifeq ($(shell sh -c "echo 'int foo(void) {char X[2]; return 3;}' | $(CC) -x c -c -Werror -fstack-protector-all - -o /dev/null >/dev/null 2>&1 && echo y"), y)
+   CFLAGS := $(CFLAGS) -fstack-protector-all
+ endif
  
  
  ### --- END CONFIGURATION SECTION ---
@@@ -335,7 -337,6 +337,7 @@@ LIB_FILE=libperf.
  LIB_H += ../../include/linux/perf_event.h
  LIB_H += ../../include/linux/rbtree.h
  LIB_H += ../../include/linux/list.h
 +LIB_H += ../../include/linux/stringify.h
  LIB_H += util/include/linux/bitmap.h
  LIB_H += util/include/linux/bitops.h
  LIB_H += util/include/linux/compiler.h
@@@ -355,6 -356,7 +357,7 @@@ LIB_H += util/include/asm/swab.
  LIB_H += util/include/asm/system.h
  LIB_H += util/include/asm/uaccess.h
  LIB_H += perf.h
+ LIB_H += util/debugfs.h
  LIB_H += util/event.h
  LIB_H += util/types.h
  LIB_H += util/levenshtein.h
@@@ -380,7 -382,9 +383,9 @@@ LIB_OBJS += util/abspath.
  LIB_OBJS += util/alias.o
  LIB_OBJS += util/config.o
  LIB_OBJS += util/ctype.o
+ LIB_OBJS += util/debugfs.o
  LIB_OBJS += util/environment.o
+ LIB_OBJS += util/event.o
  LIB_OBJS += util/exec_cmd.o
  LIB_OBJS += util/help.o
  LIB_OBJS += util/levenshtein.o
@@@ -417,8 -421,16 +422,16 @@@ LIB_OBJS += util/hist.
  LIB_OBJS += util/data_map.o
  
  BUILTIN_OBJS += builtin-annotate.o
+ BUILTIN_OBJS += builtin-bench.o
+ # Benchmark modules
+ BUILTIN_OBJS += bench/sched-messaging.o
+ BUILTIN_OBJS += bench/sched-pipe.o
  BUILTIN_OBJS += builtin-help.o
  BUILTIN_OBJS += builtin-sched.o
+ BUILTIN_OBJS += builtin-buildid-list.o
  BUILTIN_OBJS += builtin-list.o
  BUILTIN_OBJS += builtin-record.o
  BUILTIN_OBJS += builtin-report.o
@@@ -426,7 -438,6 +439,7 @@@ BUILTIN_OBJS += builtin-stat.
  BUILTIN_OBJS += builtin-timechart.o
  BUILTIN_OBJS += builtin-top.o
  BUILTIN_OBJS += builtin-trace.o
 +BUILTIN_OBJS += builtin-probe.o
  
  PERFLIBS = $(LIB_FILE)
  
@@@ -457,23 -468,14 +470,27 @@@ ifeq ($(uname_S),Darwin
        PTHREAD_LIBS =
  endif
  
- ifneq ($(shell sh -c "(echo '\#include <libelf.h>'; echo 'int main(void) { Elf * elf = elf_begin(0, ELF_C_READ_MMAP, 0); return (long)elf; }') | $(CC) -x c - $(ALL_CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -o /dev/null $(ALL_LDFLAGS) > /dev/null 2>&1 && echo y"), y)
-       msg := $(error No libelf.h/libelf found, please install libelf-dev/elfutils-libelf-devel);
+ ifeq ($(shell sh -c "(echo '\#include <libelf.h>'; echo 'int main(void) { Elf * elf = elf_begin(0, ELF_C_READ, 0); return (long)elf; }') | $(CC) -x c - $(ALL_CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -o /dev/null $(ALL_LDFLAGS) > /dev/null 2>&1 && echo y"), y)
 +ifneq ($(shell sh -c "(echo '\#include <gnu/libc-version.h>'; echo 'int main(void) { const char * version = gnu_get_libc_version(); return (long)version; }') | $(CC) -x c - $(ALL_CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -o /dev/null $(ALL_LDFLAGS) > /dev/null 2>&1 && echo y"), y)
 +      msg := $(error No gnu/libc-version.h found, please install glibc-dev[el]);
 +endif
 +
+       ifneq ($(shell sh -c "(echo '\#include <libelf.h>'; echo 'int main(void) { Elf * elf = elf_begin(0, ELF_C_READ_MMAP, 0); return (long)elf; }') | $(CC) -x c - $(ALL_CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -o /dev/null $(ALL_LDFLAGS) > /dev/null 2>&1 && echo y"), y)
+               BASIC_CFLAGS += -DLIBELF_NO_MMAP
+       endif
+ else
+       msg := $(error No libelf.h/libelf found, please install libelf-dev/elfutils-libelf-devel and glibc-dev[el]);
  endif
  
 +ifneq ($(shell sh -c "(echo '\#include <libdwarf/dwarf.h>'; echo '\#include <libdwarf/libdwarf.h>'; echo 'int main(void) { Dwarf_Debug dbg; Dwarf_Error err; Dwarf_Ranges *rng; dwarf_init(0, DW_DLC_READ, 0, 0, &dbg, &err); dwarf_get_ranges(dbg, 0, &rng, 0, 0, &err); return (long)dbg; }') | $(CC) -x c - $(ALL_CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -ldwarf -lelf -o /dev/null $(ALL_LDFLAGS) > /dev/null 2>&1 && echo y"), y)
 +      msg := $(warning No libdwarf.h found or old libdwarf.h found, disables dwarf support. Please install libdwarf-dev/libdwarf-devel >= 20081231);
 +      BASIC_CFLAGS += -DNO_LIBDWARF
 +else
 +      EXTLIBS += -lelf -ldwarf
 +      LIB_H += util/probe-finder.h
 +      LIB_OBJS += util/probe-finder.o
 +endif
 +
  ifdef NO_DEMANGLE
        BASIC_CFLAGS += -DNO_DEMANGLE
  else
diff --combined tools/perf/builtin.h
index ad5f0f4c49ee54ba1abf0d590adfa4609959a546,e97954a0a3d2e23ea10abc08dcdaf8d21f910d1c..9b02d85091fe7b59a955830fefb653278bd3e86f
@@@ -15,6 -15,8 +15,8 @@@ extern int read_line_with_nul(char *buf
  extern int check_pager_config(const char *cmd);
  
  extern int cmd_annotate(int argc, const char **argv, const char *prefix);
+ extern int cmd_bench(int argc, const char **argv, const char *prefix);
+ extern int cmd_buildid_list(int argc, const char **argv, const char *prefix);
  extern int cmd_help(int argc, const char **argv, const char *prefix);
  extern int cmd_sched(int argc, const char **argv, const char *prefix);
  extern int cmd_list(int argc, const char **argv, const char *prefix);
@@@ -25,6 -27,5 +27,6 @@@ extern int cmd_timechart(int argc, cons
  extern int cmd_top(int argc, const char **argv, const char *prefix);
  extern int cmd_trace(int argc, const char **argv, const char *prefix);
  extern int cmd_version(int argc, const char **argv, const char *prefix);
 +extern int cmd_probe(int argc, const char **argv, const char *prefix);
  
  #endif
index 6475db4f194cde4eefc988c577d05cb5d3c9ab6f,d37b16cf18ff83566440e5bffc4aded9e35239ee..d3a6e18e4a5e2fcd9a4c38a1f969c6d622d40e46
@@@ -3,6 -3,8 +3,8 @@@
  # command name                        category [deprecated] [common]
  #
  perf-annotate                 mainporcelain common
+ perf-bench                    mainporcelain common
+ perf-buildid-list             mainporcelain common
  perf-list                     mainporcelain common
  perf-sched                    mainporcelain common
  perf-record                   mainporcelain common
@@@ -11,4 -13,3 +13,4 @@@ perf-stat                     mainporcelain commo
  perf-timechart                        mainporcelain common
  perf-top                      mainporcelain common
  perf-trace                    mainporcelain common
 +perf-probe                    mainporcelain common
diff --combined tools/perf/perf.c
index 9cafe5463266c37e0fab56f1dc460ed8876cf6dd,53359ebb369aca1dd0b4e35be91c35c9e5e82bba..89b82acac7d9d9800f63088a530029e95c1e601b
@@@ -14,6 -14,7 +14,7 @@@
  #include "util/run-command.h"
  #include "util/parse-events.h"
  #include "util/string.h"
+ #include "util/debugfs.h"
  
  const char perf_usage_string[] =
        "perf [--version] [--help] COMMAND [ARGS]";
@@@ -286,8 -287,10 +287,10 @@@ static void handle_internal_command(in
        static struct cmd_struct commands[] = {
                { "help", cmd_help, 0 },
                { "list", cmd_list, 0 },
+               { "buildid-list", cmd_buildid_list, 0 },
                { "record", cmd_record, 0 },
                { "report", cmd_report, 0 },
+               { "bench", cmd_bench, 0 },
                { "stat", cmd_stat, 0 },
                { "timechart", cmd_timechart, 0 },
                { "top", cmd_top, 0 },
                { "version", cmd_version, 0 },
                { "trace", cmd_trace, 0 },
                { "sched", cmd_sched, 0 },
 +              { "probe", cmd_probe, 0 },
        };
        unsigned int i;
        static const char ext[] = STRIP_EXTENSION;
@@@ -383,45 -385,12 +386,12 @@@ static int run_argv(int *argcp, const c
  /* mini /proc/mounts parser: searching for "^blah /mount/point debugfs" */
  static void get_debugfs_mntpt(void)
  {
-       FILE *file;
-       char fs_type[100];
-       char debugfs[MAXPATHLEN];
+       const char *path = debugfs_find_mountpoint();
  
-       /*
-        * try the standard location
-        */
-       if (valid_debugfs_mount("/sys/kernel/debug/") == 0) {
-               strcpy(debugfs_mntpt, "/sys/kernel/debug/");
-               return;
-       }
-       /*
-        * try the sane location
-        */
-       if (valid_debugfs_mount("/debug/") == 0) {
-               strcpy(debugfs_mntpt, "/debug/");
-               return;
-       }
-       /*
-        * give up and parse /proc/mounts
-        */
-       file = fopen("/proc/mounts", "r");
-       if (file == NULL)
-               return;
-       while (fscanf(file, "%*s %"
-                     STR(MAXPATHLEN)
-                     "s %99s %*s %*d %*d\n",
-                     debugfs, fs_type) == 2) {
-               if (strcmp(fs_type, "debugfs") == 0)
-                       break;
-       }
-       fclose(file);
-       if (strcmp(fs_type, "debugfs") == 0) {
-               strncpy(debugfs_mntpt, debugfs, MAXPATHLEN);
-               debugfs_mntpt[MAXPATHLEN - 1] = '\0';
-       }
+       if (path)
+               strncpy(debugfs_mntpt, path, sizeof(debugfs_mntpt));
+       else
+               debugfs_mntpt[0] = '\0';
  }
  
  int main(int argc, const char **argv)
diff --combined tools/perf/util/util.h
index 0daa341734f93ef0f09c9abc6bb75ffd37bc30ec,7bd5bdaeb2357344318a9966e556b9de4b7fe6a2..f2203a0946bcbb04917b5473f9788ae62dbc149d
@@@ -134,15 -134,6 +134,15 @@@ extern void die(const char *err, ...) N
  extern int error(const char *err, ...) __attribute__((format (printf, 1, 2)));
  extern void warning(const char *err, ...) __attribute__((format (printf, 1, 2)));
  
 +#include "../../../include/linux/stringify.h"
 +
 +#define DIE_IF(cnd)   \
 +      do { if (cnd)   \
 +              die(" at (" __FILE__ ":" __stringify(__LINE__) "): "    \
 +                  __stringify(cnd) "\n");                             \
 +      } while (0)
 +
 +
  extern void set_die_routine(void (*routine)(const char *err, va_list params) NORETURN);
  
  extern int prefixcmp(const char *str, const char *prefix);
@@@ -315,6 -306,7 +315,7 @@@ static inline int has_extension(const c
  #undef isascii
  #undef isspace
  #undef isdigit
+ #undef isxdigit
  #undef isalpha
  #undef isprint
  #undef isalnum
@@@ -332,6 -324,8 +333,8 @@@ extern unsigned char sane_ctype[256]
  #define isascii(x) (((x) & ~0x7f) == 0)
  #define isspace(x) sane_istest(x,GIT_SPACE)
  #define isdigit(x) sane_istest(x,GIT_DIGIT)
+ #define isxdigit(x)   \
+       (sane_istest(toupper(x), GIT_ALPHA | GIT_DIGIT) && toupper(x) < 'G')
  #define isalpha(x) sane_istest(x,GIT_ALPHA)
  #define isalnum(x) sane_istest(x,GIT_ALPHA | GIT_DIGIT)
  #define isprint(x) sane_istest(x,GIT_PRINT)
This page took 0.03824 seconds and 5 git commands to generate.