MCPcopy Create free account
hub / github.com/alibaba/MNN / logForRunSession

Method logForRunSession

source/core/Interpreter.cpp:390–411  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

388
389#ifdef MNN_INTERNAL_ENABLED
390void Interpreter::logForRunSession(const Session* session, float timeInMs, const char* api) const {
391 int backendType[MNN_FORWARD_ALL];
392 session->getInfo(MNN::Interpreter::BACKENDS, backendType);
393 float flops = 0.0f;
394 session->getInfo(MNN::Interpreter::FLOPS, &flops);
395 float memory = 0.0f;
396 session->getInfo(MNN::Interpreter::MEMORY, &memory);
397 std::map<std::string, std::string> metrics = logBasicInfo();
398 metrics.emplace("ModelVersion", mNet->version);
399 metrics.emplace("UUID", mNet->uuid);
400 metrics.emplace("Backend", std::to_string(backendType[0])); // "Precision" is not logged here. Don't need it.
401 metrics.emplace("Time", std::to_string(timeInMs));
402 metrics.emplace("API", api);
403 metrics.emplace("Flops", std::to_string(flops));
404 metrics.emplace("Memory", std::to_string(memory));
405 auto iter = mNet->sessionInfo.find(session);
406 if (iter != mNet->sessionInfo.end()) {
407 metrics.emplace("Precision", std::to_string(std::get<0>(iter->second)));
408 metrics.emplace("Mode", std::to_string(std::get<1>(iter->second)));
409 }
410 logAsync(metrics);
411}
412#endif
413static void _runSessionBegin(const Session* session) {
414 auto& rt = session->getRuntime();

Callers

nothing calls this directly

Calls 4

to_stringFunction · 0.50
getInfoMethod · 0.45
findMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected