| 135 | |
| 136 | |
| 137 | std::string Timer::getResult(char *unit, int nbTry, double t0, double t1) { |
| 138 | |
| 139 | char tmp[256]; |
| 140 | int pIdx = 0; |
| 141 | double nbCallPerSec = (double)nbTry / (t1 - t0); |
| 142 | while (nbCallPerSec > 1000.0 && pIdx < 5) { |
| 143 | pIdx++; |
| 144 | nbCallPerSec = nbCallPerSec / 1000.0; |
| 145 | } |
| 146 | sprintf(tmp, "%.3f %s%s/sec", nbCallPerSec, prefix[pIdx], unit); |
| 147 | return std::string(tmp); |
| 148 | |
| 149 | } |
| 150 | |
| 151 | void Timer::printResult(char *unit, int nbTry, double t0, double t1) { |
| 152 |
nothing calls this directly
no outgoing calls
no test coverage detected