From 3829c7fd51aaf2c663f0eea0a41afc2544f66ce7 Mon Sep 17 00:00:00 2001 From: Jeffrey Walton Date: Sat, 13 Jun 2015 21:11:22 -0400 Subject: [PATCH] Added OMP thread count to test program. Discussion at https://groups.google.com/d/msg/cryptopp-users/M4vy6PFy40s/9n869TXAqoYJ --- test.cpp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/test.cpp b/test.cpp index 402cd523..a3250a87 100644 --- a/test.cpp +++ b/test.cpp @@ -42,6 +42,10 @@ #include #endif +#ifdef _OPENMP +# include +#endif + #ifdef __BORLANDC__ #pragma comment(lib, "cryptlib_bds.lib") #pragma comment(lib, "ws2_32.lib") @@ -769,9 +773,21 @@ bool Validate(int alg, bool thorough, const char *seedInput) std::string seed = seedInput ? std::string(seedInput) : IntToString(time(NULL)); seed.resize(16); - cout << "Using seed: " << seed << endl << endl; + cout << "Using seed: " << seed << endl; s_globalRNG.SetKeyWithIV((byte *)seed.data(), 16, (byte *)seed.data()); +#ifdef _OPENMP + int tc = 0; + #pragma omp parallel + { + tc = omp_get_num_threads(); + } + + cout << "Using " << tc << " OMP " << (tc == 1 ? "thread" : "threads") << endl; +#endif + + cout << endl; + switch (alg) { case 0: result = ValidateAll(thorough); break;