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

Method FrameReader

app/src/IO/FrameReader.cpp:40–59  ·  view source on GitHub ↗

* @brief Constructs a FrameReader with a 1 MiB scan buffer. Pre-allocates the frame-slot * pool so steady-state extraction never touches the heap, and best-effort pins the * scan buffer resident so a page fault can't stall the hotpath at rate. */

Source from the content-addressed store, hash-verified

38 * scan buffer resident so a page fault can't stall the hotpath at rate.
39 */
40IO::FrameReader::FrameReader(QObject* parent)
41 : QObject(parent)
42 , m_checksumLength(0)
43 , m_operationMode(SerialStudio::QuickPlot)
44 , m_frameDetectionMode(SerialStudio::EndDelimiterOnly)
45 , m_circularBuffer(1024 * 1024)
46 , m_queue(65536)
47 , m_capturedPoolHint(0)
48 , m_bufferPinned(false)
49 , m_droppedFrames(0)
50 , m_lastDropNotify()
51 , m_lastOverflowLog()
52{
53 m_capturedPool.reserve(kCapturedPoolSize);
54 for (int i = 0; i < kCapturedPoolSize; ++i)
55 m_capturedPool.emplace_back(std::make_shared<CapturedData>());
56
57 m_bufferPinned = Platform::AppPlatform::lockMemoryResident(
58 m_circularBuffer.storage(), static_cast<size_t>(m_circularBuffer.capacity()));
59}
60
61/**
62 * @brief Releases the scan-buffer pin so the lock quota returns before the buffer is freed.

Callers

nothing calls this directly

Calls 3

lockMemoryResidentFunction · 0.85
storageMethod · 0.80
capacityMethod · 0.45

Tested by

no test coverage detected