aboutsummaryrefslogtreecommitdiffstats
path: root/checks/pk_bench.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2006-09-27 03:44:57 +0000
committerlloyd <[email protected]>2006-09-27 03:44:57 +0000
commit15da8dc78bb8fa5e5cabf90295a55e7421a1f1dc (patch)
treeea33908012bdda6139f67e0b5b6d33da6bd4966b /checks/pk_bench.cpp
parentb81d5af9768c47b7eb9de8032b4603af30e623f5 (diff)
Add (very basic) HTML output for public key benchmarking.
Diffstat (limited to 'checks/pk_bench.cpp')
-rw-r--r--checks/pk_bench.cpp37
1 files changed, 26 insertions, 11 deletions
diff --git a/checks/pk_bench.cpp b/checks/pk_bench.cpp
index e2b6877eb..875485944 100644
--- a/checks/pk_bench.cpp
+++ b/checks/pk_bench.cpp
@@ -252,24 +252,39 @@ void bench_pk(const std::string& algo, bool html, double seconds)
}
-void print_result(bool, u32bit runs, u64bit clocks_used,
+void print_result(bool html, u32bit runs, u64bit clocks_used,
const std::string& algo_name, const std::string& op)
{
- std::cout << algo_name << ": ";
-
double seconds = (double)clocks_used / get_ticks();
- std::cout.setf(std::ios::fixed, std::ios::floatfield);
- std::cout.precision(2);
+ double mseconds_per_run = 1000 * (seconds / runs);
+ double runs_per_sec = runs / seconds;
+
+
+ if(html)
+ {
+ std::cout << " <TR><TH>" << algo_name << " (" << op << ") <TH>";
#if PRINT_MS_PER_OP
- // print milliseconds / op
- double mseconds_per_run = 1000 * (seconds / runs);
- std::cout << mseconds_per_run << " ms / " << op << std::endl;
+ std::cout << mseconds_per_run;
#else
- // print ops / second
- double runs_per_sec = runs / seconds;
- std::cout << runs_per_sec << " ops / second (" << op << ")" << std::endl;
+ std::cout << runs_per_sec;
#endif
+
+ std::cout << std::endl;
+ }
+ else
+ {
+ std::cout << algo_name << ": ";
+
+ std::cout.setf(std::ios::fixed, std::ios::floatfield);
+ std::cout.precision(2);
+
+#if PRINT_MS_PER_OP
+ std::cout << mseconds_per_run << " ms / " << op << std::endl;
+#else
+ std::cout << runs_per_sec << " ops / second (" << op << ")" << std::endl;
+#endif
+ }
}
void bench_enc(PK_Encryptor* enc, const std::string& algo_name,