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 in the latest perf/core improvements and fixes.

Signed-off-by: Ingo Molnar <mingo@elte.hu>
  • Loading branch information
Ingo Molnar committed Jan 26, 2012
2 parents 96070c8 + f8f4b28 commit 939ddcf
Show file tree
Hide file tree
Showing 37 changed files with 597 additions and 47 deletions.
4 changes: 4 additions & 0 deletions tools/perf/Documentation/perf-record.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ OPTIONS
--tid=::
Record events on existing thread ID.

-u::
--uid=::
Record events in threads owned by uid. Name or number.

-r::
--realtime=::
Collect data with this RT SCHED_FIFO priority.
Expand Down
4 changes: 4 additions & 0 deletions tools/perf/Documentation/perf-top.txt
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ Default is to monitor all CPUS.
--tid=<tid>::
Profile events on existing thread ID.

-u::
--uid=::
Record events in threads owned by uid. Name or number.

-r <priority>::
--realtime=<priority>::
Collect data with this RT SCHED_FIFO priority.
Expand Down
11 changes: 5 additions & 6 deletions tools/perf/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ ifeq ($(ARCH),x86_64)
ifeq (${IS_X86_64}, 1)
RAW_ARCH := x86_64
ARCH_CFLAGS := -DARCH_X86_64
ARCH_INCLUDE = ../../arch/x86/lib/memcpy_64.S
ARCH_INCLUDE = ../../arch/x86/lib/memcpy_64.S ../../arch/x86/lib/memset_64.S
endif
endif

Expand Down Expand Up @@ -104,7 +104,7 @@ endif

CFLAGS = -fno-omit-frame-pointer -ggdb3 -Wall -Wextra -std=gnu99 $(CFLAGS_WERROR) $(CFLAGS_OPTIMIZE) -D_FORTIFY_SOURCE=2 $(EXTRA_WARNINGS) $(EXTRA_CFLAGS)
EXTLIBS = -lpthread -lrt -lelf -lm
ALL_CFLAGS = $(CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
ALL_CFLAGS = $(CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
ALL_LDFLAGS = $(LDFLAGS)
STRIP ?= strip

Expand Down Expand Up @@ -168,10 +168,7 @@ endif

### --- END CONFIGURATION SECTION ---

# 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 = -Iutil/include -Iarch/$(ARCH)/include
BASIC_CFLAGS = -Iutil/include -Iarch/$(ARCH)/include -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
BASIC_LDFLAGS =

# Guard against environment variables
Expand Down Expand Up @@ -362,8 +359,10 @@ BUILTIN_OBJS += $(OUTPUT)bench/sched-messaging.o
BUILTIN_OBJS += $(OUTPUT)bench/sched-pipe.o
ifeq ($(RAW_ARCH),x86_64)
BUILTIN_OBJS += $(OUTPUT)bench/mem-memcpy-x86-64-asm.o
BUILTIN_OBJS += $(OUTPUT)bench/mem-memset-x86-64-asm.o
endif
BUILTIN_OBJS += $(OUTPUT)bench/mem-memcpy.o
BUILTIN_OBJS += $(OUTPUT)bench/mem-memset.o

BUILTIN_OBJS += $(OUTPUT)builtin-diff.o
BUILTIN_OBJS += $(OUTPUT)builtin-evlist.o
Expand Down
1 change: 1 addition & 0 deletions tools/perf/bench/bench.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
extern int bench_sched_messaging(int argc, const char **argv, const char *prefix);
extern int bench_sched_pipe(int argc, const char **argv, const char *prefix);
extern int bench_mem_memcpy(int argc, const char **argv, const char *prefix __used);
extern int bench_mem_memset(int argc, const char **argv, const char *prefix);

#define BENCH_FORMAT_DEFAULT_STR "default"
#define BENCH_FORMAT_DEFAULT 0
Expand Down
8 changes: 8 additions & 0 deletions tools/perf/bench/mem-memcpy-x86-64-asm-def.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,11 @@
MEMCPY_FN(__memcpy,
"x86-64-unrolled",
"unrolled memcpy() in arch/x86/lib/memcpy_64.S")

MEMCPY_FN(memcpy_c,
"x86-64-movsq",
"movsq-based memcpy() in arch/x86/lib/memcpy_64.S")

MEMCPY_FN(memcpy_c_e,
"x86-64-movsb",
"movsb-based memcpy() in arch/x86/lib/memcpy_64.S")
6 changes: 5 additions & 1 deletion tools/perf/bench/mem-memcpy-x86-64-asm.S
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@

#define memcpy MEMCPY /* don't hide glibc's memcpy() */
#define altinstr_replacement text
#define globl p2align 4; .globl
#define Lmemcpy_c globl memcpy_c; memcpy_c
#define Lmemcpy_c_e globl memcpy_c_e; memcpy_c_e
#include "../../../arch/x86/lib/memcpy_64.S"
11 changes: 9 additions & 2 deletions tools/perf/bench/mem-memcpy.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

static const char *length_str = "1MB";
static const char *routine = "default";
static int iterations = 1;
static bool use_clock;
static int clock_fd;
static bool only_prefault;
Expand All @@ -35,6 +36,8 @@ static const struct option options[] = {
"available unit: B, MB, GB (upper and lower)"),
OPT_STRING('r', "routine", &routine, "default",
"Specify routine to copy"),
OPT_INTEGER('i', "iterations", &iterations,
"repeat memcpy() invocation this number of times"),
OPT_BOOLEAN('c', "clock", &use_clock,
"Use CPU clock for measuring"),
OPT_BOOLEAN('o', "only-prefault", &only_prefault,
Expand Down Expand Up @@ -121,14 +124,16 @@ static u64 do_memcpy_clock(memcpy_t fn, size_t len, bool prefault)
{
u64 clock_start = 0ULL, clock_end = 0ULL;
void *src = NULL, *dst = NULL;
int i;

alloc_mem(&src, &dst, len);

if (prefault)
fn(dst, src, len);

clock_start = get_clock();
fn(dst, src, len);
for (i = 0; i < iterations; ++i)
fn(dst, src, len);
clock_end = get_clock();

free(src);
Expand All @@ -140,14 +145,16 @@ static double do_memcpy_gettimeofday(memcpy_t fn, size_t len, bool prefault)
{
struct timeval tv_start, tv_end, tv_diff;
void *src = NULL, *dst = NULL;
int i;

alloc_mem(&src, &dst, len);

if (prefault)
fn(dst, src, len);

BUG_ON(gettimeofday(&tv_start, NULL));
fn(dst, src, len);
for (i = 0; i < iterations; ++i)
fn(dst, src, len);
BUG_ON(gettimeofday(&tv_end, NULL));

timersub(&tv_end, &tv_start, &tv_diff);
Expand Down
12 changes: 12 additions & 0 deletions tools/perf/bench/mem-memset-arch.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

#ifdef ARCH_X86_64

#define MEMSET_FN(fn, name, desc) \
extern void *fn(void *, int, size_t);

#include "mem-memset-x86-64-asm-def.h"

#undef MEMSET_FN

#endif

12 changes: 12 additions & 0 deletions tools/perf/bench/mem-memset-x86-64-asm-def.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

MEMSET_FN(__memset,
"x86-64-unrolled",
"unrolled memset() in arch/x86/lib/memset_64.S")

MEMSET_FN(memset_c,
"x86-64-stosq",
"movsq-based memset() in arch/x86/lib/memset_64.S")

MEMSET_FN(memset_c_e,
"x86-64-stosb",
"movsb-based memset() in arch/x86/lib/memset_64.S")
6 changes: 6 additions & 0 deletions tools/perf/bench/mem-memset-x86-64-asm.S
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#define memset MEMSET /* don't hide glibc's memset() */
#define altinstr_replacement text
#define globl p2align 4; .globl
#define Lmemset_c globl memset_c; memset_c
#define Lmemset_c_e globl memset_c_e; memset_c_e
#include "../../../arch/x86/lib/memset_64.S"
Loading

0 comments on commit 939ddcf

Please sign in to comment.