summaryrefslogtreecommitdiff
path: root/bench.h
diff options
context:
space:
mode:
Diffstat (limited to 'bench.h')
-rw-r--r--bench.h44
1 files changed, 27 insertions, 17 deletions
diff --git a/bench.h b/bench.h
index f393cfde..4924d778 100644
--- a/bench.h
+++ b/bench.h
@@ -6,26 +6,36 @@
#include "cryptlib.h"
+#include <iostream>
+#include <iomanip>
+#include <cmath>
+#include <ctime>
+
NAMESPACE_BEGIN(CryptoPP)
NAMESPACE_BEGIN(Test)
-ANONYMOUS_NAMESPACE_BEGIN
-#ifdef CLOCKS_PER_SEC
-const double CLOCK_TICKS_PER_SECOND = (double)CLOCKS_PER_SEC;
-#elif defined(CLK_TCK)
-const double CLOCK_TICKS_PER_SECOND = (double)CLK_TCK;
-#else
-const double CLOCK_TICKS_PER_SECOND = 1000000.0;
-#endif
-
-static const byte defaultKey[] = "0123456789" // 168 + NULL
- "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
- "00000000000000000000000000000000000000000000000000000"
- "00000000000000000000000000000000000000000000000000000";
-NAMESPACE_END
-
-void BenchmarkAll(double t, double hertz);
-void BenchmarkAll2(double t, double hertz);
+extern const double CLOCK_TICKS_PER_SECOND;
+extern double g_allocatedTime;
+extern double g_hertz;
+extern double g_logTotal;
+extern unsigned int g_logCount;
+extern const byte defaultKey[];
+
+// Test book keeping
+extern time_t g_testBegin;
+extern time_t g_testEnd;
+
+// Top level, prints preamble and postamble
+void Benchmark(int suites, double t, double hertz);
+// Unkeyed systems
+void Benchmark1(double t, double hertz);
+// Shared key systems
+void Benchmark2(double t, double hertz);
+// Public key systems
+void Benchmark3(double t, double hertz);
+
+void OutputResultBytes(const char *name, double length, double timeTaken);
+void OutputResultOperations(const char *name, const char *operation, bool pc, unsigned long iterations, double timeTaken);
NAMESPACE_END // Test
NAMESPACE_END // CryptoPP