perf bench mem: Reorganize the code a bit
authorIngo Molnar <mingo@kernel.org>
Mon, 19 Oct 2015 08:04:27 +0000 (10:04 +0200)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Mon, 19 Oct 2015 19:07:19 +0000 (16:07 -0300)
Reorder functions a bit, so that we synchronize the layout of the
memcpy() and memset() portions of the code.

This improves the code, especially after we'll add an strlcpy() variant
as well.

Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Hitoshi Mitake <mitake@dcl.info.waseda.ac.jp>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/1445241870-24854-12-git-send-email-mingo@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/bench/mem-functions.c

index 318da3421e69c0b77d87cd897c35ecaf57db323e..8d980d4a64e5d7e8d7d48d8805115fe892b39789 100644 (file)
@@ -58,25 +58,6 @@ struct routine {
        } fn;
 };
 
-struct routine memcpy_routines[] = {
-       { .name         = "default",
-         .desc         = "Default memcpy() provided by glibc",
-         .fn.memcpy    = memcpy },
-
-#ifdef HAVE_ARCH_X86_64_SUPPORT
-# define MEMCPY_FN(_fn, _name, _desc) {.name = _name, .desc = _desc, .fn.memcpy = _fn},
-# include "mem-memcpy-x86-64-asm-def.h"
-# undef MEMCPY_FN
-#endif
-
-       { NULL, }
-};
-
-static const char * const bench_mem_memcpy_usage[] = {
-       "perf bench mem memcpy <options>",
-       NULL
-};
-
 static struct perf_event_attr cycle_attr = {
        .type           = PERF_TYPE_HARDWARE,
        .config         = PERF_COUNT_HW_CPU_CYCLES
@@ -278,6 +259,25 @@ static double do_memcpy_gettimeofday(const struct routine *r, size_t size)
        return (double)(((double)size * iterations) / timeval2double(&tv_diff));
 }
 
+struct routine memcpy_routines[] = {
+       { .name         = "default",
+         .desc         = "Default memcpy() provided by glibc",
+         .fn.memcpy    = memcpy },
+
+#ifdef HAVE_ARCH_X86_64_SUPPORT
+# define MEMCPY_FN(_fn, _name, _desc) {.name = _name, .desc = _desc, .fn.memcpy = _fn},
+# include "mem-memcpy-x86-64-asm-def.h"
+# undef MEMCPY_FN
+#endif
+
+       { NULL, }
+};
+
+static const char * const bench_mem_memcpy_usage[] = {
+       "perf bench mem memcpy <options>",
+       NULL
+};
+
 int bench_mem_memcpy(int argc, const char **argv, const char *prefix __maybe_unused)
 {
        struct bench_mem_info info = {