MCPcopy Create free account
hub / github.com/ARM-software/armnn / Print

Method Print

src/armnn/Profiling.cpp:395–489  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

393}
394
395void ProfilerImpl::Print(std::ostream& outStream) const
396{
397 // Makes sure timestamps are output with 6 decimals, and save old settings.
398 std::streamsize oldPrecision = outStream.precision();
399 outStream.precision(6);
400 std::ios_base::fmtflags oldFlags = outStream.flags();
401 outStream.setf(std::ios::fixed);
402 JsonPrinter printer(outStream);
403
404 // First find all the parent Events and print out duration measurements.
405 int baseLevel = -1;
406
407 std::vector<const Event*> optimizations;
408 PopulateParent(optimizations, baseLevel, "Optimizer");
409
410 std::vector<const Event*> loadedNetworks;
411 PopulateParent(loadedNetworks, baseLevel, "LoadedNetwork");
412
413 std::vector<const Event*> inferences;
414 PopulateParent(inferences, baseLevel, "EnqueueWorkload");
415
416 // Second map out descendants hierarchy
417 std::map<const Event*, std::vector<const Event*>> descendantsMap;
418 PopulateDescendants(descendantsMap);
419
420 // Extract json objects for each parent event type
421 JsonChildObject optimizeObject{ "optimize_measurements" };
422
423 for (unsigned int optimizeIndex = 0; optimizeIndex < optimizations.size(); ++optimizeIndex)
424 {
425 auto optimization = optimizations[optimizeIndex];
426 ExtractJsonObjects(optimizeIndex, optimization, optimizeObject, descendantsMap);
427 }
428
429 JsonChildObject loadedNetworkObject{ "loaded_network_measurements" };
430
431 for (unsigned int loadedNetworkIndex = 0; loadedNetworkIndex < loadedNetworks.size(); ++loadedNetworkIndex)
432 {
433 auto loadedNetwork = loadedNetworks[loadedNetworkIndex];
434 ExtractJsonObjects(loadedNetworkIndex, loadedNetwork, loadedNetworkObject, descendantsMap);
435 }
436
437 JsonChildObject inferenceObject{ "inference_measurements" };
438
439 for (unsigned int inferenceIndex = 0; inferenceIndex < inferences.size(); ++inferenceIndex)
440 {
441 auto inference = inferences[inferenceIndex];
442 ExtractJsonObjects(inferenceIndex, inference, inferenceObject, descendantsMap);
443 }
444
445 printer.PrintHeader();
446 printer.PrintArmNNHeader();
447
448 if (m_ProfilingDetails.get()->DetailsExist() &&
449 (m_DetailsToStdOutMethod == ProfilingDetailsMethod::DetailsOnly
450 || m_DetailsToStdOutMethod == ProfilingDetailsMethod::DetailsWithEvents))
451 {
452 JsonChildObject detailsObject{ "layer_details" };

Callers

nothing calls this directly

Calls 14

ExtractJsonObjectsFunction · 0.85
PrintHeaderMethod · 0.80
PrintArmNNHeaderMethod · 0.80
DetailsExistMethod · 0.80
EnableDetailsOnlyMethod · 0.80
SetAndParseDetailsMethod · 0.80
GetProfilingDetailsMethod · 0.80
PrintJsonChildObjectMethod · 0.80
PrintSeparatorMethod · 0.80
PrintNewLineMethod · 0.80
PrintFooterMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected