summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortanjent@gmail.com <tanjent@gmail.com@77a7d1d3-4c08-bdc2-d393-d5859734b01a>2011-03-20 03:18:20 +0000
committertanjent@gmail.com <tanjent@gmail.com@77a7d1d3-4c08-bdc2-d393-d5859734b01a>2011-03-20 03:18:20 +0000
commitb379f34cd4dc54e1beb6f74a7ef054b76600d781 (patch)
tree51149c2dbb77c2ed73baac932af2a9c37fcd3a1b
parent6ffe01004546290235d45b2d8c436180947395a7 (diff)
downloadsrc-b379f34cd4dc54e1beb6f74a7ef054b76600d781.tar.gz
Fix rdtsc errors from core hopping causing bad timing results
git-svn-id: http://smhasher.googlecode.com/svn/trunk@91 77a7d1d3-4c08-bdc2-d393-d5859734b01a
-rw-r--r--SpeedTest.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/SpeedTest.cpp b/SpeedTest.cpp
index a4ed8a7..16e183d 100644
--- a/SpeedTest.cpp
+++ b/SpeedTest.cpp
@@ -37,8 +37,11 @@ void BulkSpeedTest ( pfHash hash )
blackhole(temp[0]);
double cycles = double(end-begin);
- double bpc = double(blocksize) / cycles;
- if(bpc > bestbpc) bestbpc = bpc;
+ if(cycles > 0)
+ {
+ double bpc = double(blocksize) / cycles;
+ if(bpc > bestbpc) bestbpc = bpc;
+ }
}
double bestbps = (bestbpc * 3000000000.0 / 1048576.0);
@@ -94,7 +97,7 @@ void TinySpeedTest ( pfHash hash, int hashsize, int keysize, bool verbose, doubl
//blackhole(*(uint32_t*)(&h));
double cycles = double(end-begin) / 64;
- if(cycles < bestcycles) bestcycles = cycles;
+ if((cycles > 0) && (cycles < bestcycles)) bestcycles = cycles;
}
double bestbpc = double(keysize) / bestcycles;