MCPcopy Create free account
hub / github.com/PaddlePaddle/Paddle / Init

Method Init

paddle/fluid/framework/new_executor/executor_statistics.cc:126–167  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

124}
125
126int StatisticsEngine::Init(const platform::NodeTrees& trees) {
127 if (inited_) {
128 LOG(WARNING) << "Duplicate initialization for StatisticsEngine";
129 return -1;
130 }
131 if (phi::GetCurrentThreadName() != "MainThread") {
132 LOG(WARNING) << "StatisticsEngin must run on the main thread";
133 return -1;
134 }
135 inited_ = true;
136 InitStdEvents();
137 InitInnerthreadPriorityForStdEvents();
138 InitInterthreadPriorityForStdEvents();
139 // determine executor type
140 uint64_t main_tid = phi::GetCurrentThreadId().sys_tid;
141 for (const auto& kv : trees.GetNodeTrees()) {
142 if (kv.first != main_tid) {
143 continue;
144 }
145 std::queue<const platform::HostTraceEventNode*> q;
146 q.push(kv.second);
147 while (!q.empty()) {
148 auto cur_node = q.front();
149 q.pop();
150 const auto& name = cur_node->Name();
151 if (name.find("Executor::") == 0) {
152 VLOG(10) << "type: Executor";
153 executor_type_ = ExecutorType::EXECUTOR;
154 return InitFiltersForExecutor();
155 } else if (name.find("StandaloneExecutor::") == 0) {
156 VLOG(10) << "type: InterpreterCore";
157 executor_type_ = ExecutorType::INTERPRETER_CORE;
158 return InitFiltersForInterpreterCore();
159 }
160 for (const auto& child : cur_node->GetChildren()) {
161 q.push(child);
162 }
163 }
164 }
165 LOG(WARNING) << "Unsupported Executor";
166 return -1;
167}
168
169void StatisticsEngine::InitStdEvents() {
170 name2idx_["Total"] = names_.size();

Callers

nothing calls this directly

Calls 9

GetCurrentThreadNameFunction · 0.85
GetCurrentThreadIdFunction · 0.85
GetNodeTreesMethod · 0.80
pushMethod · 0.45
emptyMethod · 0.45
frontMethod · 0.45
popMethod · 0.45
NameMethod · 0.45
findMethod · 0.45

Tested by

no test coverage detected