| 119 | */ |
| 120 | |
| 121 | void BenchMark(const char *name, StreamTransformation &cipher, double timeTotal) |
| 122 | { |
| 123 | const int BUF_SIZE=RoundUpToMultipleOf(2048U, cipher.OptimalBlockSize()); |
| 124 | AlignedSecByteBlock buf(BUF_SIZE); |
| 125 | GlobalRNG().GenerateBlock(buf, BUF_SIZE); |
| 126 | clock_t start = clock(); |
| 127 | |
| 128 | unsigned long i=0, blocks=1; |
| 129 | double timeTaken; |
| 130 | do |
| 131 | { |
| 132 | blocks *= 2; |
| 133 | for (; i<blocks; i++) |
| 134 | cipher.ProcessString(buf, BUF_SIZE); |
| 135 | timeTaken = double(clock() - start) / CLOCK_TICKS_PER_SECOND; |
| 136 | } |
| 137 | while (timeTaken < 2.0/3*timeTotal); |
| 138 | |
| 139 | OutputResultBytes(name, double(blocks) * BUF_SIZE, timeTaken); |
| 140 | } |
| 141 | |
| 142 | void BenchMark(const char *name, AuthenticatedSymmetricCipher &cipher, double timeTotal) |
| 143 | { |
no test coverage detected