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

Method AllocateTimeNodes

tensorflow/core/profiler/internal/tfprof_timeline.cc:174–203  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

172}
173
174void Timeline::AllocateTimeNodes(GraphNode* gnode) {
175 if (gnode->Trackable(step_)) {
176 TrackNode(gnode);
177 const TFGraphNode* node = gnode->node;
178 for (const auto& kernel_execs : node->op_execs(step_)) {
179 const string& device = kernel_execs.first;
180
181 if (process_.find(device) == process_.end()) {
182 int64 pid = AllocatePID();
183 process_[device].reset(new Process(device, pid));
184 chrome_formatter_.EmitPID(GetTimeDevName(device), pid);
185 }
186 Process* p = process_[device].get();
187
188 for (const auto& exec : kernel_execs.second) {
189 int64 start_micros = exec.first;
190 int64 exec_micros = exec.second;
191 // TODO(xpan): There might be start time duplication here.
192 if (tnodes_[device].find(start_micros) == tnodes_[device].end()) {
193 // TODO(xpan): Give each kernel call a unique_name.
194 tnodes_[device][start_micros].reset(
195 new TimeNode(p, gnode, start_micros, exec_micros));
196 }
197 }
198 }
199 }
200 for (GraphNode* n : gnode->show_children) {
201 AllocateTimeNodes(n);
202 }
203}
204
205void Timeline::GenerateGraphTimeline(const std::vector<GraphNode*>& gnodes) {
206 for (GraphNode* gnode : gnodes) {

Callers

nothing calls this directly

Calls 7

GetTimeDevNameFunction · 0.85
TrackableMethod · 0.80
EmitPIDMethod · 0.80
findMethod · 0.45
endMethod · 0.45
resetMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected