2009-11-05 08:31:31 +08:00
|
|
|
#ifndef BENCH_H
|
|
|
|
#define BENCH_H
|
|
|
|
|
2013-03-14 06:34:24 +08:00
|
|
|
/*
|
|
|
|
* The madvise transparent hugepage constants were added in glibc
|
|
|
|
* 2.13. For compatibility with older versions of glibc, define these
|
|
|
|
* tokens if they are not already defined.
|
|
|
|
*
|
|
|
|
* PA-RISC uses different madvise values from other architectures and
|
|
|
|
* needs to be special-cased.
|
|
|
|
*/
|
|
|
|
#ifdef __hppa__
|
|
|
|
# ifndef MADV_HUGEPAGE
|
|
|
|
# define MADV_HUGEPAGE 67
|
|
|
|
# endif
|
|
|
|
# ifndef MADV_NOHUGEPAGE
|
|
|
|
# define MADV_NOHUGEPAGE 68
|
|
|
|
# endif
|
|
|
|
#else
|
|
|
|
# ifndef MADV_HUGEPAGE
|
|
|
|
# define MADV_HUGEPAGE 14
|
|
|
|
# endif
|
|
|
|
# ifndef MADV_NOHUGEPAGE
|
|
|
|
# define MADV_NOHUGEPAGE 15
|
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
|
perf: Add 'perf bench numa mem' NUMA performance measurement suite
Add a suite of NUMA performance benchmarks.
The goal was simulate the behavior and access patterns of real NUMA
workloads, via a wide range of parameters, so this tool goes well
beyond simple bzero() measurements that most NUMA micro-benchmarks use:
- It processes the data and creates a chain of data dependencies,
like a real workload would. Neither the compiler, nor the
kernel (via KSM and other optimizations) nor the CPU can
eliminate parts of the workload.
- It randomizes the initial state and also randomizes the target
addresses of the processing - it's not a simple forward scan
of addresses.
- It provides flexible options to set process, thread and memory
relationship information: -G sets "global" memory shared between
all test processes, -P sets "process" memory shared by all
threads of a process and -T sets "thread" private memory.
- There's a NUMA convergence monitoring and convergence latency
measurement option via -c and -m.
- Micro-sleeps and synchronization can be injected to provoke lock
contention and scheduling, via the -u and -S options. This simulates
IO and contention.
- The -x option instructs the workload to 'perturb' itself artificially
every N seconds, by moving to the first and last CPU of the system
periodically. This way the stability of convergence equilibrium and
the number of steps taken for the scheduler to reach equilibrium again
can be measured.
- The amount of work can be specified via the -l loop count, and/or
via a -s seconds-timeout value.
- CPU and node memory binding options, to test hard binding scenarios.
THP can be turned on and off via madvise() calls.
- Live reporting of convergence progress in an 'at glance' output format.
Printing of convergence and deconvergence events.
The 'perf bench numa mem -a' option will start an array of about 30
individual tests that will each output such measurements:
# Running 5x5-bw-thread, "perf bench numa mem -p 5 -t 5 -P 512 -s 20 -zZ0q --thp 1"
5x5-bw-thread, 20.276, secs, runtime-max/thread
5x5-bw-thread, 20.004, secs, runtime-min/thread
5x5-bw-thread, 20.155, secs, runtime-avg/thread
5x5-bw-thread, 0.671, %, spread-runtime/thread
5x5-bw-thread, 21.153, GB, data/thread
5x5-bw-thread, 528.818, GB, data-total
5x5-bw-thread, 0.959, nsecs, runtime/byte/thread
5x5-bw-thread, 1.043, GB/sec, thread-speed
5x5-bw-thread, 26.081, GB/sec, total-speed
See the help text and the code for more details.
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: Rik van Riel <riel@redhat.com>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Hugh Dickins <hughd@google.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2012-12-06 20:51:59 +08:00
|
|
|
extern int bench_numa(int argc, const char **argv, const char *prefix);
|
2009-11-10 19:50:53 +08:00
|
|
|
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);
|
2012-09-11 06:15:03 +08:00
|
|
|
extern int bench_mem_memcpy(int argc, const char **argv,
|
|
|
|
const char *prefix __maybe_unused);
|
2012-01-24 20:03:22 +08:00
|
|
|
extern int bench_mem_memset(int argc, const char **argv, const char *prefix);
|
2009-11-05 08:31:31 +08:00
|
|
|
|
2009-11-10 19:50:53 +08:00
|
|
|
#define BENCH_FORMAT_DEFAULT_STR "default"
|
|
|
|
#define BENCH_FORMAT_DEFAULT 0
|
|
|
|
#define BENCH_FORMAT_SIMPLE_STR "simple"
|
|
|
|
#define BENCH_FORMAT_SIMPLE 1
|
2009-11-10 07:19:59 +08:00
|
|
|
|
2009-11-10 19:50:53 +08:00
|
|
|
#define BENCH_FORMAT_UNKNOWN -1
|
2009-11-10 07:19:59 +08:00
|
|
|
|
|
|
|
extern int bench_format;
|
|
|
|
|
2009-11-05 08:31:31 +08:00
|
|
|
#endif
|