MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / run

Method run

app/src/Benchmark/HotpathBenchmark.cpp:563–661  ·  view source on GitHub ↗

* @brief Drives FrameReader -> FrameBuilder -> consumers end-to-end and measures parsed frames/sec. */

Source from the content-addressed store, hash-verified

561 * @brief Drives FrameReader -> FrameBuilder -> consumers end-to-end and measures parsed frames/sec.
562 */
563HotpathBenchmark::Result HotpathBenchmark::run(quint64 targetFrames,
564 double minFps,
565 double minSeconds,
566 int language,
567 bool withExporters,
568 bool withStrings,
569 bool withDashboard,
570 bool dashboardIngest)
571{
572 Q_ASSERT(targetFrames > 0);
573 Q_ASSERT(minFps > 0.0);
574 Q_ASSERT(minSeconds >= 0.0);
575
576 constexpr int kChannels = 8;
577 constexpr int kFramesPerChunk = 1000;
578 const bool activateDashboard = withDashboard && dashboardIngest;
579
580 const int channels = withDashboard ? kDashboardChannels : kChannels;
581 setupProject(language, channels, withStrings, withDashboard);
582 if (withExporters)
583 enableConsumers();
584
585 if (activateDashboard)
586 setActive(true);
587
588 const int stringColumns = withStrings ? kStringChannels : 0;
589 const QByteArray chunk = buildChunk(kFramesPerChunk, channels, stringColumns);
590
591 IO::FrameReader reader;
592 reader.setOperationMode(SerialStudio::QuickPlot);
593 reader.setFinishSequences({QByteArrayLiteral("\n")});
594
595 auto& builder = DataModel::FrameBuilder::instance();
596 builder.setParseBudgetEnabled(false);
597
598 auto& queue = reader.queue();
599 IO::CapturedDataPtr drained;
600
601 if (activateDashboard) {
602 reader.processData(IO::makeCapturedData(chunk));
603
604 // code-verify off
605 while (queue.try_dequeue(drained))
606 builder.hotpathRxFrame(drained);
607 // code-verify on
608
609 activateDashboardWidgets();
610 }
611
612 builder.resetFrameCounters();
613
614 using Clock = std::chrono::steady_clock;
615 const quint64 maxFrames = targetFrames + static_cast<quint64>(minSeconds * 1.0e9);
616 const quint64 maxChunks = maxFrames / kFramesPerChunk + 1;
617
618 quint64 fed = 0;
619 double seconds = 0.0;
620 double spentSpin = 0.0;

Callers

nothing calls this directly

Calls 12

makeCapturedDataFunction · 0.85
spinEventLoopFunction · 0.85
setFinishSequencesMethod · 0.80
setParseBudgetEnabledMethod · 0.80
resetFrameCountersMethod · 0.80
parsedFrameCountMethod · 0.80
skippedFrameCountMethod · 0.80
setOperationModeMethod · 0.45
processDataMethod · 0.45
try_dequeueMethod · 0.45
hotpathRxFrameMethod · 0.45
countMethod · 0.45

Tested by

no test coverage detected