tensorflow/core/profiler/internal/tfprof_node.cc
// Notes about start and end time from the NodeExecStats proto:
// For GPU, there is no difference between op_end_rel_micros and
// all_end_rel_micros. All are kernel times.
// For CPU, op_end_rel is the kernel time, while all_end_rel_micros includes
// some post-processing. Besides, currently, there is no way to measure
// the execution time of async ops accurately.
//
// Notes about device:
// For ops on gpu:
// It will appear in three different devices in RunMetadata: 1) gpu:x,
// 2) gpu:x:stream:all and 3) gpu:x:stream:id. 2) is used a combined view
// of all different 3). 1) is the op scheduling, pre-processing and
// post processing time. 3) is the execution time of GPU kernels on a stream.
// For ops on cpu:
// It will only appear as cpu:0.
Notes about start and end time from the NodeExecStats proto:
For GPU, there is no difference between op_end_rel_micros and
all_end_rel_micros. All are kernel times.
For CPU, op_end_rel is the kernel time, while all_end_rel_micros includes
some post-processing. Besides, currently, there is no way to measure
the execution time of async ops accurately.


Notes about start and end time from the NodeExecStats proto : For GPU there is no difference between op_end_rel_micros and all_end_rel_micros . All are kernel times . For CPU op_end_rel is the kernel time while all_end_rel_micros includes some post - processing . Besides currently there is no way to measure the execution time of async ops accurately .
void ExecStep::AddTimeStats(const string& dev, const NodeExecStats& step_stat) {
  devices_.insert(dev);
  if (step_stat.all_start_micros() > 0) {
    if (exec_.all_start_micros() > 0) {
      exec_.set_all_start_micros(
          std::min(static_cast<int64_t>(exec_.all_start_micros()),
                   static_cast<int64_t>(step_stat.all_start_micros())));
    } else {
      exec_.set_all_start_micros(step_stat.all_start_micros());
    }
    int64_t op_end_rel_micros = step_stat.op_end_rel_micros();
    if (op_end_rel_micros == 0) {
      ++op_end_rel_micros;
    }
    exec_.set_latest_end_micros(
        std::max(static_cast<int64_t>(exec_.latest_end_micros()),
                 step_stat.all_start_micros() + op_end_rel_micros));
    const std::pair<int64_t, int64_t> pair =
        std::make_pair(step_stat.all_start_micros(), op_end_rel_micros);
    if (CountAsAcceleratorTime(dev)) {
      accelerator_execs_[dev].push_back(pair);
      op_execs_[dev].push_back(pair);
    } else if (CountAsCPUTime(dev)) {
      cpu_execs_[dev].push_back(pair);
      op_execs_[dev].push_back(pair);
      exec_.set_run_count(exec_.run_count() + 1);
    }
  }
}
void ExecStep :: AddTimeStats ( const string & dev , const NodeExecStats & step_stat ) { devices_ . insert ( dev ) ; if ( step_stat . all_start_micros ( ) > 0 ) { if ( exec_ . all_start_micros ( ) > 0 ) { exec_ . set_all_start_micros ( std :: min ( static_cast < int64_t > ( exec_ . all_start_micros ( ) ) , static_cast < int64_t > ( step_stat . all_start_micros ( ) ) ) ) ; } else { exec_ . set_all_start_micros ( step_stat . all_start_micros ( ) ) ; } int64_t op_end_rel_micros = step_stat . op_end_rel_micros ( ) ; if ( op_end_rel_micros == 0 ) { ++ op_end_rel_micros ; } exec_ . set_latest_end_micros ( std :: max ( static_cast < int64_t > ( exec_ . latest_end_micros ( ) ) , step_stat . all_start_micros ( ) + op_end_rel_micros ) ) ; const std :: pair < int64_t , int64_t > pair = std :: make_pair ( step_stat . all_start_micros ( ) , op_end_rel_micros ) ; if ( CountAsAcceleratorTime ( dev ) ) { accelerator_execs_ [ dev ] . push_back ( pair ) ; op_execs_ [ dev ] . push_back ( pair ) ; } else if ( CountAsCPUTime ( dev ) ) { cpu_execs_ [ dev ] . push_back ( pair ) ; op_execs_ [ dev ] . push_back ( pair ) ; exec_ . set_run_count ( exec_ . run_count ( ) + 1 ) ; } } }
Notes about start and end time from the NodeExecStats proto:
For GPU, there is no difference between op_end_rel_micros and
all_end_rel_micros.
Notes about start and end time from the NodeExecStats proto : For GPU there is no difference between op_end_rel_micros and all_end_rel_micros .
// Round quick execution to 1 micro to be semantically robust. // In while-loop, a graph node is executed multiple times under // the same name.