MCPcopy Create free account
hub / github.com/NVIDIA/TensorRT / exportJSONTrace

Function exportJSONTrace

samples/common/sampleReporting.cpp:319–341  ·  view source on GitHub ↗

Printed format: [ value, ...] value ::= { "start enq : time, "end enq" : time, "start h2d" : time, "end h2d" : time, "start compute" : time, "end compute" : time, "start d2h" : time, "end d2h" : time, "h2d" : time, "compute" : time, "d2h" : time, "latency" : time }

Source from the content-addressed store, hash-verified

317//! "d2h" : time, "latency" : time }
318//!
319void exportJSONTrace(std::vector<InferenceTrace> const& trace, std::string const& fileName, int32_t const nbWarmups)
320{
321 std::ofstream os(fileName, std::ofstream::trunc);
322 os << "[" << std::endl;
323 char const* sep = " ";
324 for (auto iter = trace.begin() + nbWarmups; iter < trace.end(); ++iter)
325 {
326 auto const& t = *iter;
327 InferenceTime const it(traceToTiming(t));
328 os << sep << "{ ";
329 sep = ", ";
330 // clang-format off
331 os << "\"startEnqMs\" : " << t.enqStart << sep << "\"endEnqMs\" : " << t.enqEnd << sep
332 << "\"startH2dMs\" : " << t.h2dStart << sep << "\"endH2dMs\" : " << t.h2dEnd << sep
333 << "\"startComputeMs\" : " << t.computeStart << sep << "\"endComputeMs\" : " << t.computeEnd << sep
334 << "\"startD2hMs\" : " << t.d2hStart << sep << "\"endD2hMs\" : " << t.d2hEnd << sep
335 << "\"h2dMs\" : " << it.h2d << sep << "\"computeMs\" : " << it.compute << sep
336 << "\"d2hMs\" : " << it.d2h << sep << "\"latencyMs\" : " << it.latency() << " }"
337 << std::endl;
338 // clang-format on
339 }
340 os << "]" << std::endl;
341}
342
343void Profiler::reportLayerTime(char const* layerName, float timeMs) noexcept
344{

Callers 1

printPerformanceReportFunction · 0.85

Calls 2

traceToTimingFunction · 0.85
latencyMethod · 0.80

Tested by

no test coverage detected