MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / AddTimeStats

Method AddTimeStats

tensorflow/core/profiler/internal/tfprof_node.cc:47–79  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

45// It will only appear as cpu:0.
46
47void ExecStep::AddTimeStats(const string& dev, const NodeExecStats& step_stat) {
48 devices_.insert(dev);
49 if (step_stat.all_start_micros() > 0) {
50 if (exec_.all_start_micros() > 0) {
51 exec_.set_all_start_micros(
52 std::min(static_cast<int64>(exec_.all_start_micros()),
53 static_cast<int64>(step_stat.all_start_micros())));
54 } else {
55 exec_.set_all_start_micros(step_stat.all_start_micros());
56 }
57 int64 op_end_rel_micros = step_stat.op_end_rel_micros();
58 // Round quick execution to 1 micro to be semantically robust.
59 if (op_end_rel_micros == 0) {
60 ++op_end_rel_micros;
61 }
62 exec_.set_latest_end_micros(
63 std::max(static_cast<int64>(exec_.latest_end_micros()),
64 step_stat.all_start_micros() + op_end_rel_micros));
65
66 const std::pair<int64, int64> pair =
67 std::make_pair(step_stat.all_start_micros(), op_end_rel_micros);
68 if (CountAsAcceleratorTime(dev)) {
69 accelerator_execs_[dev].push_back(pair);
70 op_execs_[dev].push_back(pair);
71 } else if (CountAsCPUTime(dev)) {
72 cpu_execs_[dev].push_back(pair);
73 op_execs_[dev].push_back(pair);
74 // In while-loop, a graph node is executed multiple times under
75 // the same name.
76 exec_.set_run_count(exec_.run_count() + 1);
77 }
78 }
79}
80
81void ExecStep::AddMemoryStats(const string& dev,
82 const NodeExecStats& step_stat) {

Callers 1

AddStepStatMethod · 0.80

Calls 9

CountAsAcceleratorTimeFunction · 0.85
CountAsCPUTimeFunction · 0.85
minFunction · 0.50
maxFunction · 0.50
insertMethod · 0.45
all_start_microsMethod · 0.45
latest_end_microsMethod · 0.45
push_backMethod · 0.45
run_countMethod · 0.45

Tested by

no test coverage detected