| 312 | } |
| 313 | |
| 314 | Status LogAndCount(const Status& status, |
| 315 | const uint64 start_microseconds, |
| 316 | const StringPiece export_dir) { |
| 317 | const uint64 load_latency_microsecs = [&]() -> uint64 { |
| 318 | const uint64 end_microseconds = Env::Default()->NowMicros(); |
| 319 | // Avoid clock skew. |
| 320 | if (end_microseconds < start_microseconds) return 0; |
| 321 | return end_microseconds - start_microseconds; |
| 322 | }(); |
| 323 | auto log_and_count = [&](const string& status_str) { |
| 324 | LOG(INFO) << "Loading SessionBundle: " << status_str << ". Took " |
| 325 | << load_latency_microsecs << " microseconds."; |
| 326 | load_attempt_count->GetCell(string(export_dir), status_str)->IncrementBy(1); |
| 327 | }; |
| 328 | if (status.ok()) { |
| 329 | log_and_count(kLoadAttemptSuccess); |
| 330 | } else { |
| 331 | log_and_count(kLoadAttemptFail); |
| 332 | } |
| 333 | load_latency->GetCell(string(export_dir)) |
| 334 | ->IncrementBy(load_latency_microsecs); |
| 335 | return status; |
| 336 | } |
| 337 | |
| 338 | } // namespace |
| 339 |
no test coverage detected