MCPcopy Create free account
hub / github.com/Smorodov/Multitarget-tracker / print

Method print

src/Detector/tensorrt_yolo/common/sampleReporting.cpp:393–435  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

391}
392
393void Profiler::print(std::ostream& os) const noexcept
394{
395 std::string const nameHdr(" Layer");
396 std::string const timeHdr(" Time(ms)");
397 std::string const avgHdr(" Avg.(ms)");
398 std::string const medHdr(" Median(ms)");
399 std::string const percentageHdr(" Time(%)");
400
401 float const totalTimeMs = getTotalTime();
402
403 auto const timeLength = timeHdr.size();
404 auto const avgLength = avgHdr.size();
405 auto const medLength = medHdr.size();
406 auto const percentageLength = percentageHdr.size();
407
408 os << std::endl
409 << "=== Profile (" << mUpdatesCount << " iterations ) ===" << std::endl
410 << timeHdr << avgHdr << medHdr << percentageHdr << nameHdr << std::endl;
411
412 for (auto const& p : mLayers)
413 {
414 if (p.timeMs.empty() || getTotalTime(p) == 0.F)
415 {
416 // there is no point to print profiling for layer that didn't run at all
417 continue;
418 }
419 // clang-format off
420 os << std::setw(timeLength) << std::fixed << std::setprecision(2) << getTotalTime(p)
421 << std::setw(avgLength) << std::fixed << std::setprecision(4) << getAvgTime(p)
422 << std::setw(medLength) << std::fixed << std::setprecision(4) << getMedianTime(p)
423 << std::setw(percentageLength) << std::fixed << std::setprecision(1) << getTotalTime(p) / totalTimeMs * 100
424 << " " << p.name << std::endl;
425 }
426 {
427 os << std::setw(timeLength) << std::fixed << std::setprecision(2)
428 << totalTimeMs << std::setw(avgLength) << std::fixed << std::setprecision(4) << totalTimeMs / mUpdatesCount
429 << std::setw(medLength) << std::fixed << std::setprecision(4) << getMedianTime()
430 << std::setw(percentageLength) << std::fixed << std::setprecision(1) << 100.0
431 << " Total" << std::endl;
432 // clang-format on
433 }
434 os << std::endl;
435}
436
437void Profiler::exportJSONProfile(std::string const& fileName) const noexcept
438{

Callers 1

printPerformanceProfileFunction · 0.45

Calls 2

sizeMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected