11#include <promeki/config.h>
12#if PROMEKI_ENABLE_PROAV
22PROMEKI_NAMESPACE_BEGIN
47class MediaIOStats :
public VariantDatabase<"MediaIOStats"> {
49 using Base = VariantDatabase<
"MediaIOStats">;
56 PROMEKI_DECLARE_ID(ExecuteDuration,
58 .setType(DataTypeDuration)
59 .setDefault(Duration::zero())
60 .setDescription(
"Wall time spent executing the command."));
62 PROMEKI_DECLARE_ID(QueueWaitDuration,
64 .setType(DataTypeDuration)
65 .setDefault(Duration::zero())
66 .setDescription(
"Wall time spent in the strand queue."));
68 PROMEKI_DECLARE_ID(BytesProcessed,
70 .setType(DataTypeInt64)
71 .setDefault(int64_t(0))
73 .setDescription(
"Payload bytes produced or consumed."));
79 PROMEKI_DECLARE_ID(FramesDropped, VariantSpec()
80 .setType(DataTypeFrameCount)
81 .setDefault(FrameCount(0))
82 .setDescription(
"Total frames dropped since open."));
84 PROMEKI_DECLARE_ID(FramesRepeated, VariantSpec()
85 .setType(DataTypeFrameCount)
86 .setDefault(FrameCount(0))
87 .setDescription(
"Total frames repeated due to underrun."));
89 PROMEKI_DECLARE_ID(FramesLate, VariantSpec()
90 .setType(DataTypeFrameCount)
91 .setDefault(FrameCount(0))
92 .setDescription(
"Total frames that arrived late."));
94 PROMEKI_DECLARE_ID(QueueDepth, VariantSpec()
95 .setType(DataTypeInt64)
96 .setDefault(int64_t(0))
98 .setDescription(
"Current depth of internal buffer."));
100 PROMEKI_DECLARE_ID(QueueCapacity, VariantSpec()
101 .setType(DataTypeInt64)
102 .setDefault(int64_t(0))
104 .setDescription(
"Capacity of internal buffer."));
106 PROMEKI_DECLARE_ID(BytesPerSecond, VariantSpec()
107 .setType(DataTypeDouble)
110 .setDescription(
"Current data rate in bytes per second."));
112 PROMEKI_DECLARE_ID(FramesPerSecond,
114 .setType(DataTypeDouble)
117 .setDescription(
"Current frame rate in frames per second."));
119 PROMEKI_DECLARE_ID(AverageLatencyMs, VariantSpec()
120 .setType(DataTypeDouble)
123 .setDescription(
"Average end-to-end latency in ms."));
125 PROMEKI_DECLARE_ID(PeakLatencyMs, VariantSpec()
126 .setType(DataTypeDouble)
129 .setDescription(
"Peak observed latency in ms."));
131 PROMEKI_DECLARE_ID(AverageProcessingMs,
133 .setType(DataTypeDouble)
136 .setDescription(
"Average per-frame processing time in ms."));
138 PROMEKI_DECLARE_ID(PeakProcessingMs, VariantSpec()
139 .setType(DataTypeDouble)
142 .setDescription(
"Peak per-frame processing time in ms."));
144 PROMEKI_DECLARE_ID(LastErrorMessage, VariantSpec()
145 .setType(DataTypeString)
146 .setDefault(String())
147 .setDescription(
"Most recent error description."));
149 PROMEKI_DECLARE_ID(PendingOperations,
151 .setType(DataTypeInt64)
152 .setDefault(int64_t(0))
154 .setDescription(
"Commands queued on the strand but not yet running."));
171 Error setFromJson(ID
id,
const Variant &val) {
172 if (val.type() == DataTypeString) {
173 const String s = val.get<String>();
174 if (s.startsWith(
"cap=")) {
175 auto r = WindowedStat::fromString(s);
176 if (error(r).isOk()) {
178 set(
id, Variant(value(r)), &err);
183 return Base::setFromJson(
id, val);
200 String toString()
const;