| 250 | void AddBytes(int64_t n) { bytes_ += n; } |
| 251 | |
| 252 | void Report(const Slice& name) { |
| 253 | // Pretend at least one op was done in case we are running a benchmark |
| 254 | // that does not call FinishedSingleOp(). |
| 255 | if (done_ < 1) done_ = 1; |
| 256 | |
| 257 | std::string extra; |
| 258 | if (bytes_ > 0) { |
| 259 | // Rate is computed on actual elapsed time, not the sum of per-thread |
| 260 | // elapsed times. |
| 261 | double elapsed = (finish_ - start_) * 1e-6; |
| 262 | char rate[100]; |
| 263 | snprintf(rate, sizeof(rate), "%6.1f MB/s", |
| 264 | (bytes_ / 1048576.0) / elapsed); |
| 265 | extra = rate; |
| 266 | } |
| 267 | AppendWithSpace(&extra, message_); |
| 268 | |
| 269 | fprintf(stdout, "%-12s : %11.3f micros/op;%s%s\n", name.ToString().c_str(), |
| 270 | seconds_ * 1e6 / done_, (extra.empty() ? "" : " "), extra.c_str()); |
| 271 | if (FLAGS_histogram) { |
| 272 | fprintf(stdout, "Microseconds per op:\n%s\n", hist_.ToString().c_str()); |
| 273 | } |
| 274 | fflush(stdout); |
| 275 | } |
| 276 | }; |
| 277 | |
| 278 | // State shared by all concurrent executions of the same benchmark. |
no test coverage detected