This is overall computation time, including both cpu and accelerator. Note, cpu and accelerator might or might not run in parallel.
| 505 | // This is overall computation time, including both cpu and accelerator. |
| 506 | // Note, cpu and accelerator might or might not run in parallel. |
| 507 | int64 exec_micros(int64 step) const { |
| 508 | // Empty when no RunMetadata is provided. |
| 509 | if (execs_.empty()) { |
| 510 | return 0; |
| 511 | } |
| 512 | if (step >= 0) { |
| 513 | auto exec = execs_.find(step); |
| 514 | if (exec == execs_.end()) { |
| 515 | return 0; |
| 516 | } |
| 517 | return exec->second.exec_micros(); |
| 518 | } |
| 519 | |
| 520 | int64 total_micros = 0; |
| 521 | for (const auto& exec : execs_) { |
| 522 | total_micros += exec.second.exec_micros(); |
| 523 | } |
| 524 | return total_micros / execs_.size(); |
| 525 | } |
| 526 | |
| 527 | // This is accelerator computation time of a step, or average of |
| 528 | // multiple step, when step < 0. |
no test coverage detected