#include "debug.h"
#include "../perf.h"
#include "../util/util.h"
#include <subcmd/parse-options.h>
#include "../util/header.h"
#include "../util/cloexec.h"
#include "../util/string2.h"
#include "bench.h"
#include "mem-memcpy-arch.h"
#include "mem-memset-arch.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/time.h>
#include <errno.h>
#include <linux/time64.h>
Go to the source code of this file.
|
typedef void *(* | memcpy_t) (void *, const void *, size_t) |
|
typedef void *(* | memset_t) (void *, int, size_t) |
|
|
static int | init_cycles (void) |
|
static u64 | get_cycles (void) |
|
static double | timeval2double (struct timeval *ts) |
|
static void | __bench_mem_function (struct bench_mem_info *info, int r_idx, size_t size, double size_total) |
|
static int | bench_mem_common (int argc, const char **argv, struct bench_mem_info *info) |
|
static u64 | do_memcpy_cycles (const struct function *r, size_t size, void *src, void *dst) |
|
static double | do_memcpy_gettimeofday (const struct function *r, size_t size, void *src, void *dst) |
|
int | bench_mem_memcpy (int argc, const char **argv) |
|
static u64 | do_memset_cycles (const struct function *r, size_t size, void *src __maybe_unused, void *dst) |
|
static double | do_memset_gettimeofday (const struct function *r, size_t size, void *src __maybe_unused, void *dst) |
|
int | bench_mem_memset (int argc, const char **argv) |
|
◆ print_bps
Value:do { \
printf(" %14lf bytes/sec\n", x); \
printf(" %14lfd KB/sec\n", x / K); \
else if (x < K * K * K) \
printf(" %14lf MB/sec\n", x / K / K); \
else \
printf(" %14lf GB/sec\n", x / K / K / K); \
} while (0)
Definition at line 98 of file mem-functions.c.
◆ memcpy_t
typedef void*(* memcpy_t) (void *, const void *, size_t) |
◆ memset_t
typedef void*(* memset_t) (void *, int, size_t) |
◆ __bench_mem_function()
static void __bench_mem_function |
( |
struct bench_mem_info * |
info, |
|
|
int |
r_idx, |
|
|
size_t |
size, |
|
|
double |
size_total |
|
) |
| |
|
static |
◆ bench_mem_common()
static int bench_mem_common |
( |
int |
argc, |
|
|
const char ** |
argv, |
|
|
struct bench_mem_info * |
info |
|
) |
| |
|
static |
◆ bench_mem_memcpy()
int bench_mem_memcpy |
( |
int |
argc, |
|
|
const char ** |
argv |
|
) |
| |
◆ bench_mem_memset()
int bench_mem_memset |
( |
int |
argc, |
|
|
const char ** |
argv |
|
) |
| |
◆ do_memcpy_cycles()
static u64 do_memcpy_cycles |
( |
const struct function * |
r, |
|
|
size_t |
size, |
|
|
void * |
src, |
|
|
void * |
dst |
|
) |
| |
|
static |
◆ do_memcpy_gettimeofday()
static double do_memcpy_gettimeofday |
( |
const struct function * |
r, |
|
|
size_t |
size, |
|
|
void * |
src, |
|
|
void * |
dst |
|
) |
| |
|
static |
◆ do_memset_cycles()
static u64 do_memset_cycles |
( |
const struct function * |
r, |
|
|
size_t |
size, |
|
|
void *src |
__maybe_unused, |
|
|
void * |
dst |
|
) |
| |
|
static |
◆ do_memset_gettimeofday()
static double do_memset_gettimeofday |
( |
const struct function * |
r, |
|
|
size_t |
size, |
|
|
void *src |
__maybe_unused, |
|
|
void * |
dst |
|
) |
| |
|
static |
◆ get_cycles()
static u64 get_cycles |
( |
void |
| ) |
|
|
static |
◆ init_cycles()
static int init_cycles |
( |
void |
| ) |
|
|
static |
◆ timeval2double()
static double timeval2double |
( |
struct timeval * |
ts | ) |
|
|
static |
◆ bench_mem_memcpy_usage
const char* const bench_mem_memcpy_usage[] |
|
static |
Initial value:= {
"perf bench mem memcpy <options>",
NULL
}
Definition at line 284 of file mem-functions.c.
◆ bench_mem_memset_usage
const char* const bench_mem_memset_usage[] |
|
static |
Initial value:= {
"perf bench mem memset <options>",
NULL
}
Definition at line 344 of file mem-functions.c.
◆ cycle_attr
struct perf_event_attr cycle_attr |
|
static |
Initial value:= {
.type = PERF_TYPE_HARDWARE,
.config = PERF_COUNT_HW_CPU_CYCLES
}
Definition at line 65 of file mem-functions.c.
◆ cycles_fd
◆ function_str
const char* function_str = "all" |
|
static |
◆ memcpy_functions
Initial value:= {
{ .name = "default",
.desc = "Default memcpy() provided by glibc",
{ .name = NULL, }
}
x86 movsq based memcpy() in arch/x86/lib/memcpy_64.S") MEMCPY_FN(memcpy_erms
Definition at line 270 of file mem-functions.c.
◆ memset_functions
const struct function memset_functions[] |
|
static |
Initial value:= {
{ .name = "default",
.desc = "Default memset() provided by glibc",
{ .name = NULL, }
}
x86 movsq based memset() in arch/x86/lib/memset_64.S") MEMSET_FN(memset_erms
Definition at line 349 of file mem-functions.c.
◆ nr_loops
◆ options
Initial value:= {
OPT_STRING(
's',
"size", &
size_str,
"1MB",
"Specify the size of the memory buffers. "
"Available units: B, KB, MB, GB and TB (case insensitive)"),
"Specify the function to run, \"all\" runs all available functions, \"help\" lists them"),
"Specify the number of loops to run. (default: 1)"),
"Use a cycles event instead of gettimeofday() to measure performance"),
}
static const char * size_str
static const char * function_str
Definition at line 36 of file mem-functions.c.
◆ size_str
const char* size_str = "1MB" |
|
static |
◆ use_cycles