summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorsam <sam@FreeBSD.org>2003-02-24 06:10:50 +0000
committersam <sam@FreeBSD.org>2003-02-24 06:10:50 +0000
commitddc15adbc476a5543c7e22d3ce646e001dd525a9 (patch)
treea5a021a26b07532ad844017ec9a9b7ac9a2cb21a /tools
parent9f8c317a7d390e9118085cb953d36619ec8ed770 (diff)
downloadFreeBSD-src-ddc15adbc476a5543c7e22d3ce646e001dd525a9.zip
FreeBSD-src-ddc15adbc476a5543c7e22d3ce646e001dd525a9.tar.gz
o add -b option to enable batching
o add #ifdef __FreeBSD__'s around the profiling so the code compiles on openbsd o update a comment about expected performance for Broadcom hardware
Diffstat (limited to 'tools')
-rw-r--r--tools/tools/crypto/cryptotest.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/tools/tools/crypto/cryptotest.c b/tools/tools/crypto/cryptotest.c
index c4b1df5..7f1f951 100644
--- a/tools/tools/crypto/cryptotest.c
+++ b/tools/tools/crypto/cryptotest.c
@@ -22,8 +22,8 @@
* symmetric operations. To get meaningful numbers you must run on an idle
* machine.
*
- * Expect ~400 Mb/s for a Broadcom 582x for 16K buffers on a reasonable CPU.
- * Hifn 7811 parts top out at ~110 Mb/s.
+ * Expect ~400 Mb/s for a Broadcom 582x for 8K buffers on a reasonable CPU
+ * (64-bit PCI helps). Hifn 7811 parts top out at ~110 Mb/s.
*
* This code originally came from openbsd; give them all the credit.
*/
@@ -53,6 +53,7 @@ struct session_op session;
struct crypt_op cryptop;
char iv[8] = "00000000";
int verbose = 0;
+int opflags = 0;
struct alg {
const char* name;
@@ -158,7 +159,7 @@ runtest(struct alg *alg, int count, int size, int cmd, struct timeval *tv)
gettimeofday(&start, NULL);
for (i = 0; i < count; i++) {
cryptop.op = COP_ENCRYPT;
- cryptop.flags = 0;
+ cryptop.flags = opflags;
cryptop.len = size;
cryptop.src = cleartext;
cryptop.dst = ciphertext;
@@ -170,7 +171,7 @@ runtest(struct alg *alg, int count, int size, int cmd, struct timeval *tv)
memset(cleartext, 'x', MIN(size, CHUNK));
cryptop.op = COP_DECRYPT;
- cryptop.flags = 0;
+ cryptop.flags = opflags;
cryptop.len = size;
cryptop.src = ciphertext;
cryptop.dst = cleartext;
@@ -197,6 +198,7 @@ runtest(struct alg *alg, int count, int size, int cmd, struct timeval *tv)
close(fd);
}
+#ifdef __FreeBSD__
static void
resetstats()
{
@@ -233,6 +235,7 @@ printt(const char* tag, struct cryptotstat *ts)
printf("%16.16s: avg %6llu ns : min %6llu ns : max %7llu ns [%u samps]\n",
tag, avg, min, max, ts->count);
}
+#endif
static void
runtests(struct alg *alg, int count, int size, int cmd, int threads, int profile)
@@ -259,6 +262,7 @@ runtests(struct alg *alg, int count, int size, int cmd, int threads, int profile
return;
}
tvp = (struct timeval *) region;
+#ifdef __FreeBSD__
if (profile) {
size_t tlen = sizeof (otiming);
int timing = 1;
@@ -268,6 +272,7 @@ runtests(struct alg *alg, int count, int size, int cmd, int threads, int profile
&timing, sizeof (timing)) < 0)
perror("debug.crypto_timing");
}
+#endif
if (threads > 1) {
for (i = 0; i < threads; i++)
@@ -288,6 +293,7 @@ runtests(struct alg *alg, int count, int size, int cmd, int threads, int profile
t/threads, 2*count*threads, alg->name, size, (double)2*count*size*threads / t,
(double)2*count*size*threads / t * 8 / 1024 / 1024);
}
+#ifdef __FreeBSD__
if (profile) {
struct cryptostats stats;
size_t slen = sizeof (stats);
@@ -304,6 +310,7 @@ runtests(struct alg *alg, int count, int size, int cmd, int threads, int profile
printt("cb->finis", &stats.cs_finis);
}
}
+#endif
fflush(stdout);
}
@@ -319,7 +326,7 @@ main(int argc, char **argv)
int profile = 0;
int i, ch;
- while ((ch = getopt(argc, argv, "pzsva:t:")) != -1) {
+ while ((ch = getopt(argc, argv, "pzsva:bt:")) != -1) {
switch (ch) {
#ifdef CIOCGSSESSION
case 's':
@@ -347,6 +354,9 @@ main(int argc, char **argv)
case 'p':
profile = 1;
break;
+ case 'b':
+ opflags |= COP_F_BATCH;
+ break;
default:
usage(argv[0]);
}
OpenPOWER on IntegriCloud