Lines Matching +full:range +full:- +full:double

1 // SPDX-License-Identifier: GPL-2.0
3 * mem-memcpy.c
11 #include "../perf-sys.h"
12 #include <subcmd/parse-options.h>
17 #include "mem-memcpy-arch.h"
18 #include "mem-memset-arch.h"
73 cycles_fd = sys_perf_event_open(&cycle_attr, getpid(), -1, -1, perf_event_open_cloexec_flag()); in init_cycles()
77 return -1; in init_cycles()
94 static double timeval2double(struct timeval *ts) in timeval2double()
96 return (double)ts->tv_sec + (double)ts->tv_usec / (double)USEC_PER_SEC; in timeval2double()
113 double (*do_gettimeofday)(const struct function *r, size_t size, void *src, void *dst);
118 static void __bench_mem_function(struct bench_mem_info *info, int r_idx, size_t size, double size_t… in __bench_mem_function()
120 const struct function *r = &info->functions[r_idx]; in __bench_mem_function()
121 double result_bps = 0.0; in __bench_mem_function()
125 printf("# function '%s' (%s)\n", r->name, r->desc); in __bench_mem_function()
130 if (info->alloc_src) { in __bench_mem_function()
140 result_cycles = info->do_cycles(r, size, src, dst); in __bench_mem_function()
142 result_bps = info->do_gettimeofday(r, size, src, dst); in __bench_mem_function()
148 printf(" %14lf cycles/byte\n", (double)result_cycles/size_total); in __bench_mem_function()
156 printf("%lf\n", (double)result_cycles/size_total); in __bench_mem_function()
172 printf("# Memory allocation failed - maybe size (%s) is too large?\n", size_str); in __bench_mem_function()
180 double size_total; in bench_mem_common()
182 argc = parse_options(argc, argv, options, info->usage, 0); in bench_mem_common()
193 size_total = (double)size * nr_loops; in bench_mem_common()
201 for (i = 0; info->functions[i].name; i++) in bench_mem_common()
206 for (i = 0; info->functions[i].name; i++) { in bench_mem_common()
207 if (!strcmp(info->functions[i].name, function_str)) in bench_mem_common()
210 if (!info->functions[i].name) { in bench_mem_common()
214 for (i = 0; info->functions[i].name; i++) { in bench_mem_common()
216 info->functions[i].name, info->functions[i].desc); in bench_mem_common()
232 * We prefault the freshly allocated memory range here, in memcpy_prefault()
241 memcpy_t fn = r->fn.memcpy; in do_memcpy_cycles()
251 return cycle_end - cycle_start; in do_memcpy_cycles()
254 static double do_memcpy_gettimeofday(const struct function *r, size_t size, void *src, void *dst) in do_memcpy_gettimeofday()
257 memcpy_t fn = r->fn.memcpy; in do_memcpy_gettimeofday()
269 return (double)(((double)size * nr_loops) / timeval2double(&tv_diff)); in do_memcpy_gettimeofday()
279 # include "mem-memcpy-x86-64-asm-def.h"
307 memset_t fn = r->fn.memset; in do_memset_cycles()
311 * We prefault the freshly allocated memory range here, in do_memset_cycles()
314 fn(dst, -1, size); in do_memset_cycles()
321 return cycle_end - cycle_start; in do_memset_cycles()
324 static double do_memset_gettimeofday(const struct function *r, size_t size, void *src __maybe_unuse… in do_memset_gettimeofday()
327 memset_t fn = r->fn.memset; in do_memset_gettimeofday()
331 * We prefault the freshly allocated memory range here, in do_memset_gettimeofday()
334 fn(dst, -1, size); in do_memset_gettimeofday()
343 return (double)(((double)size * nr_loops) / timeval2double(&tv_diff)); in do_memset_gettimeofday()
358 # include "mem-memset-x86-64-asm-def.h"