Compared with 83be436:
- move private backend, DMA, delivery, startup, and frame timing diagnostics into a dedicated InternalDiagnostics module
- keep the capture controller independent from gvfg_debug.h and private backend baseline structures
- compile the diagnostics module and diagnostic signal path only for Debug builds
- keep Release builds free of diagnostic collection and aligned with the customer-facing capture flow
Validation: git diff --check passed. MSVC Release and Debug clean builds completed successfully, and the updated Sample behavior was tested on hardware.
61 lines
1.9 KiB
C++
61 lines
1.9 KiB
C++
#pragma once
|
|
|
|
#include <gvfg_capture.h>
|
|
|
|
#include <QStringList>
|
|
|
|
#include <array>
|
|
#include <atomic>
|
|
#include <chrono>
|
|
#include <cstdint>
|
|
|
|
class InternalDiagnostics final
|
|
{
|
|
public:
|
|
void beginStart(int channel);
|
|
void finishStartCall(int channel);
|
|
void resetChannel(gvfg_handle handle, int channel);
|
|
void recordVideoRead(int channel, double elapsedMs);
|
|
QString takeStartupLatencyLine(int channel,
|
|
double firstReadMs,
|
|
double firstRenderMs,
|
|
uint64_t frameId);
|
|
void appendAudioStatusLine(QStringList &lines,
|
|
gvfg_handle handle,
|
|
int channel,
|
|
uint64_t audioReceived) const;
|
|
void appendVideoStatusLines(QStringList &lines,
|
|
gvfg_handle handle,
|
|
int channel,
|
|
bool zeroCopy) const;
|
|
|
|
private:
|
|
struct BackendBaseline
|
|
{
|
|
uint64_t videoDmaEventWakes = 0;
|
|
uint64_t extraVideoEventWakes = 0;
|
|
uint64_t videoFramesFromLibrary = 0;
|
|
uint64_t audioDmaEventWakes = 0;
|
|
uint64_t extraAudioEventWakes = 0;
|
|
uint64_t audioFramesFromLibrary = 0;
|
|
};
|
|
|
|
struct ChannelMetrics
|
|
{
|
|
std::chrono::steady_clock::time_point startTime{};
|
|
double startCallMs = 0.0;
|
|
uint64_t successfulFrames = 0;
|
|
uint64_t windowSamples = 0;
|
|
double windowMaximumMs = 0.0;
|
|
bool startupLatencyReported = false;
|
|
std::atomic<uint64_t> videoReceived{0};
|
|
std::atomic<uint64_t> readSamples{0};
|
|
std::atomic<double> readAverageMs{0.0};
|
|
std::atomic<double> readMaximumMs{0.0};
|
|
std::atomic<double> readWindowMaximumMs{0.0};
|
|
};
|
|
|
|
std::array<BackendBaseline, 2> baselines_{};
|
|
std::array<ChannelMetrics, 2> metrics_{};
|
|
};
|