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

Function printPerformanceReport

samples/common/sampleReporting.cpp:286–311  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

284}
285
286void printPerformanceReport(std::vector<InferenceTrace> const& trace, ReportingOptions const& reportingOpts,
287 InferenceOptions const& infOpts, std::ostream& osInfo, std::ostream& osWarning, std::ostream& osVerbose)
288{
289 int32_t batchSize = infOpts.batch;
290 float const warmupMs = infOpts.warmup;
291 auto const isNotWarmup = [&warmupMs](const InferenceTrace& a) { return a.computeStart >= warmupMs; };
292 auto const noWarmup = std::find_if(trace.begin(), trace.end(), isNotWarmup);
293 int32_t const warmups = noWarmup - trace.begin();
294 float const benchTime = trace.back().d2hEnd - noWarmup->h2dStart;
295 // when implicit batch used, batchSize = options.inference.batch, which is parsed through --batch
296 // when explicit batch used, batchSize = options.inference.batch = 0
297 // treat inference with explicit batch as a single query and report the throughput
298 batchSize = batchSize ? batchSize : 1;
299 printProlog(warmups * batchSize, (trace.size() - warmups) * batchSize, warmupMs, benchTime, osInfo);
300
301 std::vector<InferenceTime> timings(trace.size() - warmups);
302 std::transform(noWarmup, trace.end(), timings.begin(), traceToTiming);
303 printTiming(timings, reportingOpts.avgs, osInfo);
304 printEpilog(
305 timings, benchTime, reportingOpts.percentiles, batchSize, infOpts.infStreams, osInfo, osWarning, osVerbose);
306
307 if (!reportingOpts.exportTimes.empty())
308 {
309 exportJSONTrace(trace, reportingOpts.exportTimes, warmups);
310 }
311}
312
313//! Printed format:
314//! [ value, ...]

Callers 1

mainFunction · 0.85

Calls 6

printPrologFunction · 0.85
printTimingFunction · 0.85
printEpilogFunction · 0.85
exportJSONTraceFunction · 0.85
sizeMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected