Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf bench mem: Reorganize the code a bit

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>

authored by

Ingo Molnar and committed by
Arnaldo Carvalho de Melo
5dd93304 13b1fdce

+19 -19
+19 -19
tools/perf/bench/mem-functions.c
··· 58 58 } fn; 59 59 }; 60 60 61 - struct routine memcpy_routines[] = { 62 - { .name = "default", 63 - .desc = "Default memcpy() provided by glibc", 64 - .fn.memcpy = memcpy }, 65 - 66 - #ifdef HAVE_ARCH_X86_64_SUPPORT 67 - # define MEMCPY_FN(_fn, _name, _desc) {.name = _name, .desc = _desc, .fn.memcpy = _fn}, 68 - # include "mem-memcpy-x86-64-asm-def.h" 69 - # undef MEMCPY_FN 70 - #endif 71 - 72 - { NULL, } 73 - }; 74 - 75 - static const char * const bench_mem_memcpy_usage[] = { 76 - "perf bench mem memcpy <options>", 77 - NULL 78 - }; 79 - 80 61 static struct perf_event_attr cycle_attr = { 81 62 .type = PERF_TYPE_HARDWARE, 82 63 .config = PERF_COUNT_HW_CPU_CYCLES ··· 258 277 259 278 return (double)(((double)size * iterations) / timeval2double(&tv_diff)); 260 279 } 280 + 281 + struct routine memcpy_routines[] = { 282 + { .name = "default", 283 + .desc = "Default memcpy() provided by glibc", 284 + .fn.memcpy = memcpy }, 285 + 286 + #ifdef HAVE_ARCH_X86_64_SUPPORT 287 + # define MEMCPY_FN(_fn, _name, _desc) {.name = _name, .desc = _desc, .fn.memcpy = _fn}, 288 + # include "mem-memcpy-x86-64-asm-def.h" 289 + # undef MEMCPY_FN 290 + #endif 291 + 292 + { NULL, } 293 + }; 294 + 295 + static const char * const bench_mem_memcpy_usage[] = { 296 + "perf bench mem memcpy <options>", 297 + NULL 298 + }; 261 299 262 300 int bench_mem_memcpy(int argc, const char **argv, const char *prefix __maybe_unused) 263 301 {