MCPcopy Create free account
hub / github.com/Tencent/embedx / DumpProfile

Method DumpProfile

src/tools/trainer_context.cc:213–230  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

211}
212
213void TrainerContext::DumpProfile() const noexcept {
214 std::ostringstream os;
215 auto dump_member = [&os](const std::string& name, double avg_duration) {
216 char buf[256];
217 double avg_in_us = avg_duration / 1000; // 1000: ns -> us
218 std::snprintf(buf, sizeof(buf), "%s=%.4fus ", name.c_str(), avg_in_us);
219 os << buf;
220 };
221 double processed_inst = profile_.processed_inst;
222 dump_member("GetBatch", profile_.get_batch / processed_inst);
223 dump_member("InitOpContext", profile_.init_op_context / processed_inst);
224 dump_member("Forward", profile_.forward / processed_inst);
225 dump_member("Backward", profile_.backward / processed_inst);
226 dump_member("Pull", profile_.pull / processed_inst);
227 dump_member("Push", profile_.push / processed_inst);
228
229 DXINFO("%s", os.str().c_str());
230}
231
232/************************************************************************/
233/* TrainerContextNonShard */

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected