diff options
author | Hitoshi Mitake <mitake@dcl.info.waseda.ac.jp> | 2010-11-25 02:04:53 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2010-11-26 02:15:57 -0500 |
commit | ea7872b9d6a81101f6ba0ec141544a62fea35876 (patch) | |
tree | 569f13213fc6b1487b00cb403376b4fd70821302 | |
parent | 49ce8fc651794878189fd5f273228832cdfb5be9 (diff) |
perf bench: Add feature that measures the performance of the arch/x86/lib/memcpy_64.S memcpy routines via 'perf bench mem'
This patch ports arch/x86/lib/memcpy_64.S to perf bench mem
memcpy for benchmarking memcpy() in userland with tricky and
dirty way.
util/include/asm/cpufeature.h, util/include/asm/dwarf2.h, and
util/include/linux/linkage.h are mostly dummy files with small
wrappers, so that we are able to include memcpy_64.S
unmodified.
Signed-off-by: Hitoshi Mitake <mitake@dcl.info.waseda.ac.jp>
Cc: h.mitake@gmail.com
Cc: Miao Xie <miaox@cn.fujitsu.com>
Cc: Ma Ling <ling.ma@intel.com>
Cc: Zhao Yakui <yakui.zhao@intel.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Andi Kleen <andi@firstfloor.org>
LKML-Reference: <1290668693-27068-2-git-send-email-mitake@dcl.info.waseda.ac.jp>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r-- | tools/perf/Makefile | 11 | ||||
-rw-r--r-- | tools/perf/bench/mem-memcpy-arch.h | 12 | ||||
-rw-r--r-- | tools/perf/bench/mem-memcpy-x86-64-asm-def.h | 4 | ||||
-rw-r--r-- | tools/perf/bench/mem-memcpy-x86-64-asm.S | 2 | ||||
-rw-r--r-- | tools/perf/util/include/asm/cpufeature.h | 9 | ||||
-rw-r--r-- | tools/perf/util/include/asm/dwarf2.h | 11 | ||||
-rw-r--r-- | tools/perf/util/include/linux/linkage.h | 13 |
7 files changed, 62 insertions, 0 deletions
diff --git a/tools/perf/Makefile b/tools/perf/Makefile index 74b684da8f13..e0db1978c858 100644 --- a/tools/perf/Makefile +++ b/tools/perf/Makefile | |||
@@ -185,7 +185,10 @@ ifeq ($(ARCH),i386) | |||
185 | ARCH := x86 | 185 | ARCH := x86 |
186 | endif | 186 | endif |
187 | ifeq ($(ARCH),x86_64) | 187 | ifeq ($(ARCH),x86_64) |
188 | RAW_ARCH := x86_64 | ||
188 | ARCH := x86 | 189 | ARCH := x86 |
190 | ARCH_CFLAGS := -DARCH_X86_64 | ||
191 | ARCH_INCLUDE = ../../arch/x86/lib/memcpy_64.S | ||
189 | endif | 192 | endif |
190 | 193 | ||
191 | # CFLAGS and LDFLAGS are for the users to override from the command line. | 194 | # CFLAGS and LDFLAGS are for the users to override from the command line. |
@@ -375,6 +378,7 @@ LIB_H += util/include/linux/prefetch.h | |||
375 | LIB_H += util/include/linux/rbtree.h | 378 | LIB_H += util/include/linux/rbtree.h |
376 | LIB_H += util/include/linux/string.h | 379 | LIB_H += util/include/linux/string.h |
377 | LIB_H += util/include/linux/types.h | 380 | LIB_H += util/include/linux/types.h |
381 | LIB_H += util/include/linux/linkage.h | ||
378 | LIB_H += util/include/asm/asm-offsets.h | 382 | LIB_H += util/include/asm/asm-offsets.h |
379 | LIB_H += util/include/asm/bug.h | 383 | LIB_H += util/include/asm/bug.h |
380 | LIB_H += util/include/asm/byteorder.h | 384 | LIB_H += util/include/asm/byteorder.h |
@@ -383,6 +387,8 @@ LIB_H += util/include/asm/swab.h | |||
383 | LIB_H += util/include/asm/system.h | 387 | LIB_H += util/include/asm/system.h |
384 | LIB_H += util/include/asm/uaccess.h | 388 | LIB_H += util/include/asm/uaccess.h |
385 | LIB_H += util/include/dwarf-regs.h | 389 | LIB_H += util/include/dwarf-regs.h |
390 | LIB_H += util/include/asm/dwarf2.h | ||
391 | LIB_H += util/include/asm/cpufeature.h | ||
386 | LIB_H += perf.h | 392 | LIB_H += perf.h |
387 | LIB_H += util/cache.h | 393 | LIB_H += util/cache.h |
388 | LIB_H += util/callchain.h | 394 | LIB_H += util/callchain.h |
@@ -417,6 +423,7 @@ LIB_H += util/probe-finder.h | |||
417 | LIB_H += util/probe-event.h | 423 | LIB_H += util/probe-event.h |
418 | LIB_H += util/pstack.h | 424 | LIB_H += util/pstack.h |
419 | LIB_H += util/cpumap.h | 425 | LIB_H += util/cpumap.h |
426 | LIB_H += $(ARCH_INCLUDE) | ||
420 | 427 | ||
421 | LIB_OBJS += $(OUTPUT)util/abspath.o | 428 | LIB_OBJS += $(OUTPUT)util/abspath.o |
422 | LIB_OBJS += $(OUTPUT)util/alias.o | 429 | LIB_OBJS += $(OUTPUT)util/alias.o |
@@ -472,6 +479,9 @@ BUILTIN_OBJS += $(OUTPUT)builtin-bench.o | |||
472 | # Benchmark modules | 479 | # Benchmark modules |
473 | BUILTIN_OBJS += $(OUTPUT)bench/sched-messaging.o | 480 | BUILTIN_OBJS += $(OUTPUT)bench/sched-messaging.o |
474 | BUILTIN_OBJS += $(OUTPUT)bench/sched-pipe.o | 481 | BUILTIN_OBJS += $(OUTPUT)bench/sched-pipe.o |
482 | ifeq ($(RAW_ARCH),x86_64) | ||
483 | BUILTIN_OBJS += $(OUTPUT)bench/mem-memcpy-x86-64-asm.o | ||
484 | endif | ||
475 | BUILTIN_OBJS += $(OUTPUT)bench/mem-memcpy.o | 485 | BUILTIN_OBJS += $(OUTPUT)bench/mem-memcpy.o |
476 | 486 | ||
477 | BUILTIN_OBJS += $(OUTPUT)builtin-diff.o | 487 | BUILTIN_OBJS += $(OUTPUT)builtin-diff.o |
@@ -898,6 +908,7 @@ BASIC_CFLAGS += -DSHA1_HEADER='$(SHA1_HEADER_SQ)' \ | |||
898 | LIB_OBJS += $(COMPAT_OBJS) | 908 | LIB_OBJS += $(COMPAT_OBJS) |
899 | 909 | ||
900 | ALL_CFLAGS += $(BASIC_CFLAGS) | 910 | ALL_CFLAGS += $(BASIC_CFLAGS) |
911 | ALL_CFLAGS += $(ARCH_CFLAGS) | ||
901 | ALL_LDFLAGS += $(BASIC_LDFLAGS) | 912 | ALL_LDFLAGS += $(BASIC_LDFLAGS) |
902 | 913 | ||
903 | export TAR INSTALL DESTDIR SHELL_PATH | 914 | export TAR INSTALL DESTDIR SHELL_PATH |
diff --git a/tools/perf/bench/mem-memcpy-arch.h b/tools/perf/bench/mem-memcpy-arch.h new file mode 100644 index 000000000000..a72e36cb5394 --- /dev/null +++ b/tools/perf/bench/mem-memcpy-arch.h | |||
@@ -0,0 +1,12 @@ | |||
1 | |||
2 | #ifdef ARCH_X86_64 | ||
3 | |||
4 | #define MEMCPY_FN(fn, name, desc) \ | ||
5 | extern void *fn(void *, const void *, size_t); | ||
6 | |||
7 | #include "mem-memcpy-x86-64-asm-def.h" | ||
8 | |||
9 | #undef MEMCPY_FN | ||
10 | |||
11 | #endif | ||
12 | |||
diff --git a/tools/perf/bench/mem-memcpy-x86-64-asm-def.h b/tools/perf/bench/mem-memcpy-x86-64-asm-def.h new file mode 100644 index 000000000000..d588b87696fc --- /dev/null +++ b/tools/perf/bench/mem-memcpy-x86-64-asm-def.h | |||
@@ -0,0 +1,4 @@ | |||
1 | |||
2 | MEMCPY_FN(__memcpy, | ||
3 | "x86-64-unrolled", | ||
4 | "unrolled memcpy() in arch/x86/lib/memcpy_64.S") | ||
diff --git a/tools/perf/bench/mem-memcpy-x86-64-asm.S b/tools/perf/bench/mem-memcpy-x86-64-asm.S new file mode 100644 index 000000000000..a57b66e853c2 --- /dev/null +++ b/tools/perf/bench/mem-memcpy-x86-64-asm.S | |||
@@ -0,0 +1,2 @@ | |||
1 | |||
2 | #include "../../../arch/x86/lib/memcpy_64.S" | ||
diff --git a/tools/perf/util/include/asm/cpufeature.h b/tools/perf/util/include/asm/cpufeature.h new file mode 100644 index 000000000000..acffd5e4d1d4 --- /dev/null +++ b/tools/perf/util/include/asm/cpufeature.h | |||
@@ -0,0 +1,9 @@ | |||
1 | |||
2 | #ifndef PERF_CPUFEATURE_H | ||
3 | #define PERF_CPUFEATURE_H | ||
4 | |||
5 | /* cpufeature.h ... dummy header file for including arch/x86/lib/memcpy_64.S */ | ||
6 | |||
7 | #define X86_FEATURE_REP_GOOD 0 | ||
8 | |||
9 | #endif /* PERF_CPUFEATURE_H */ | ||
diff --git a/tools/perf/util/include/asm/dwarf2.h b/tools/perf/util/include/asm/dwarf2.h new file mode 100644 index 000000000000..bb4198e7837a --- /dev/null +++ b/tools/perf/util/include/asm/dwarf2.h | |||
@@ -0,0 +1,11 @@ | |||
1 | |||
2 | #ifndef PERF_DWARF2_H | ||
3 | #define PERF_DWARF2_H | ||
4 | |||
5 | /* dwarf2.h ... dummy header file for including arch/x86/lib/memcpy_64.S */ | ||
6 | |||
7 | #define CFI_STARTPROC | ||
8 | #define CFI_ENDPROC | ||
9 | |||
10 | #endif /* PERF_DWARF2_H */ | ||
11 | |||
diff --git a/tools/perf/util/include/linux/linkage.h b/tools/perf/util/include/linux/linkage.h new file mode 100644 index 000000000000..06387cffe125 --- /dev/null +++ b/tools/perf/util/include/linux/linkage.h | |||
@@ -0,0 +1,13 @@ | |||
1 | |||
2 | #ifndef PERF_LINUX_LINKAGE_H_ | ||
3 | #define PERF_LINUX_LINKAGE_H_ | ||
4 | |||
5 | /* linkage.h ... for including arch/x86/lib/memcpy_64.S */ | ||
6 | |||
7 | #define ENTRY(name) \ | ||
8 | .globl name; \ | ||
9 | name: | ||
10 | |||
11 | #define ENDPROC(name) | ||
12 | |||
13 | #endif /* PERF_LINUX_LINKAGE_H_ */ | ||