[PATCH 1/3] bench-slope: add unaligned buffer mode
Jussi Kivilinna
jussi.kivilinna at iki.fi
Sun Jul 3 17:42:07 CEST 2016
* tests/bench-slope.c (unaligned_mode): New.
(do_slope_benchmark): Unalign buffer if in unaligned mode enabled.
(print_help, main): Add '--unaligned' parameter.
--
Patch adds --unaligned parameter to allow measurement of unaligned
buffer overhead.
Signed-off-by: Jussi Kivilinna <jussi.kivilinna at iki.fi>
---
0 files changed
diff --git a/tests/bench-slope.c b/tests/bench-slope.c
index d97494c..cdd0fa6 100644
--- a/tests/bench-slope.c
+++ b/tests/bench-slope.c
@@ -42,6 +42,7 @@
static int verbose;
static int csv_mode;
+static int unaligned_mode;
static int num_measurement_repetitions;
/* CPU Ghz value provided by user, allows constructing cycles/byte and other
@@ -411,12 +412,14 @@ do_slope_benchmark (struct bench_obj *obj)
obj->max_bufsize < 1 || obj->min_bufsize > obj->max_bufsize)
goto err_free;
- real_buffer = malloc (obj->max_bufsize + 128);
+ real_buffer = malloc (obj->max_bufsize + 128 + unaligned_mode);
if (!real_buffer)
goto err_free;
/* Get aligned buffer */
buffer = real_buffer;
buffer += 128 - ((real_buffer - (unsigned char *) 0) & (128 - 1));
+ if (unaligned_mode)
+ buffer += unaligned_mode; /* Make buffer unaligned */
for (i = 0; i < obj->max_bufsize; i++)
buffer[i] = 0x55 ^ (-i);
@@ -1748,6 +1751,7 @@ print_help (void)
" for benchmarking.",
" --repetitions <n> Use N repetitions (default "
STR2(NUM_MEASUREMENT_REPETITIONS) ")",
+ " --unaligned Use unaligned input buffers.",
" --csv Use CSV output format",
NULL
};
@@ -1832,6 +1836,12 @@ main (int argc, char **argv)
argc--;
argv++;
}
+ else if (!strcmp (*argv, "--unaligned"))
+ {
+ unaligned_mode = 1;
+ argc--;
+ argv++;
+ }
else if (!strcmp (*argv, "--disable-hwf"))
{
argc--;
More information about the Gcrypt-devel
mailing list