| 53 | double totalTimeSecs = 0.0; |
| 54 | |
| 55 | void test_case(int copySize) |
| 56 | { |
| 57 | const int minimumCopyBytes = 1024*1024*64; |
| 58 | |
| 59 | int numTimes = (minimumCopyBytes + copySize-1) / copySize; |
| 60 | if (numTimes < 8) numTimes = 8; |
| 61 | |
| 62 | tick_t bestResult = 1e9; |
| 63 | |
| 64 | #ifndef NUM_TRIALS |
| 65 | #define NUM_TRIALS 5 |
| 66 | #endif |
| 67 | |
| 68 | for(int i = 0; i < NUM_TRIALS; ++i) |
| 69 | { |
| 70 | double t0 = tick(); |
| 71 | test_memset(numTimes, copySize); |
| 72 | double t1 = tick(); |
| 73 | if (t1 - t0 < bestResult) bestResult = t1 - t0; |
| 74 | totalTimeSecs += (double)(t1 - t0) / ticks_per_sec(); |
| 75 | } |
| 76 | unsigned long long totalBytesTransferred = numTimes * copySize; |
| 77 | |
| 78 | copySizes.push_back(copySize); |
| 79 | |
| 80 | tick_t ticksElapsed = bestResult; |
| 81 | if (ticksElapsed > 0) |
| 82 | { |
| 83 | double seconds = (double)ticksElapsed / ticks_per_sec(); |
| 84 | double bytesPerSecond = totalBytesTransferred / seconds; |
| 85 | double mbytesPerSecond = bytesPerSecond / (1024.0*1024.0); |
| 86 | results.push_back(mbytesPerSecond); |
| 87 | } |
| 88 | else |
| 89 | { |
| 90 | results.push_back(0.0); |
| 91 | } |
| 92 | } |
| 93 | |
| 94 | void print_results() |
| 95 | { |
no test coverage detected