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

Method StopAndLog

tensorflow/compiler/xla/util.cc:63–86  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

61}
62
63void ScopedLoggingTimer::StopAndLog() {
64 if (enabled_) {
65 uint64 end_micros = tensorflow::Env::Default()->NowMicros();
66 double secs = (end_micros - start_micros_) / 1000000.0;
67
68 TimerStats& stats = *timer_stats_;
69 tensorflow::mutex_lock lock(stats.stats_mutex);
70 stats.cumulative_secs += secs;
71 if (secs > stats.max_secs) {
72 stats.max_secs = secs;
73 }
74 stats.times_called++;
75
76 LOG(INFO).AtLocation(file_, line_)
77 << label_
78 << " time: " << tensorflow::strings::HumanReadableElapsedTime(secs)
79 << " (cumulative: "
80 << tensorflow::strings::HumanReadableElapsedTime(stats.cumulative_secs)
81 << ", max: "
82 << tensorflow::strings::HumanReadableElapsedTime(stats.max_secs)
83 << ", #called: " << stats.times_called << ")";
84 enabled_ = false;
85 }
86}
87
88ScopedLoggingTimer::~ScopedLoggingTimer() { StopAndLog(); }
89

Callers

nothing calls this directly

Calls 3

DefaultFunction · 0.85
HumanReadableElapsedTimeFunction · 0.85
NowMicrosMethod · 0.45

Tested by

no test coverage detected