* @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. */
| 38 | * scan buffer resident so a page fault can't stall the hotpath at rate. |
| 39 | */ |
| 40 | IO::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. |
nothing calls this directly
no test coverage detected