59 lines
2.6 KiB
C++
59 lines
2.6 KiB
C++
#pragma once
|
|
|
|
#include "CadenceTelemetry.h"
|
|
#include "../json/JsonWriter.h"
|
|
|
|
#include <cstdint>
|
|
#include <string>
|
|
|
|
namespace RenderCadenceCompositor
|
|
{
|
|
inline void WriteCadenceTelemetryJson(JsonWriter& writer, const CadenceTelemetrySnapshot& snapshot)
|
|
{
|
|
writer.BeginObject();
|
|
writer.KeyDouble("sampleSeconds", snapshot.sampleSeconds);
|
|
writer.KeyDouble("renderFps", snapshot.renderFps);
|
|
writer.KeyDouble("scheduleFps", snapshot.scheduleFps);
|
|
writer.KeyUInt("free", static_cast<uint64_t>(snapshot.freeFrames));
|
|
writer.KeyUInt("completed", static_cast<uint64_t>(snapshot.completedFrames));
|
|
writer.KeyUInt("scheduled", static_cast<uint64_t>(snapshot.scheduledFrames));
|
|
writer.KeyUInt("renderedTotal", snapshot.renderedTotal);
|
|
writer.KeyUInt("scheduledTotal", snapshot.scheduledTotal);
|
|
writer.KeyUInt("completedPollMisses", snapshot.completedPollMisses);
|
|
writer.KeyUInt("scheduleFailures", snapshot.scheduleFailures);
|
|
writer.KeyUInt("completions", snapshot.completions);
|
|
writer.KeyUInt("late", snapshot.displayedLate);
|
|
writer.KeyUInt("dropped", snapshot.dropped);
|
|
writer.KeyUInt("shaderCommitted", snapshot.shaderBuildsCommitted);
|
|
writer.KeyUInt("shaderFailures", snapshot.shaderBuildFailures);
|
|
writer.KeyUInt("inputFramesReceived", snapshot.inputFramesReceived);
|
|
writer.KeyUInt("inputFramesDropped", snapshot.inputFramesDropped);
|
|
writer.KeyDouble("inputLatestAgeMs", snapshot.inputLatestAgeMilliseconds);
|
|
writer.KeyDouble("inputUploadMs", snapshot.inputUploadMilliseconds);
|
|
writer.KeyBool("inputFormatSupported", snapshot.inputFormatSupported);
|
|
writer.KeyBool("inputSignalPresent", snapshot.inputSignalPresent);
|
|
writer.KeyDouble("inputCaptureFps", snapshot.inputCaptureFps);
|
|
writer.KeyDouble("inputConvertMs", snapshot.inputConvertMilliseconds);
|
|
writer.KeyDouble("inputSubmitMs", snapshot.inputSubmitMilliseconds);
|
|
writer.KeyUInt("inputNoSignalFrames", snapshot.inputNoSignalFrames);
|
|
writer.KeyUInt("inputUnsupportedFrames", snapshot.inputUnsupportedFrames);
|
|
writer.KeyUInt("inputSubmitMisses", snapshot.inputSubmitMisses);
|
|
writer.KeyString("inputCaptureFormat", snapshot.inputCaptureFormat);
|
|
writer.KeyBool("deckLinkBufferedAvailable", snapshot.deckLinkBufferedAvailable);
|
|
writer.Key("deckLinkBuffered");
|
|
if (snapshot.deckLinkBufferedAvailable)
|
|
writer.UInt(snapshot.deckLinkBuffered);
|
|
else
|
|
writer.Null();
|
|
writer.KeyDouble("scheduleCallMs", snapshot.deckLinkScheduleCallMilliseconds);
|
|
writer.EndObject();
|
|
}
|
|
|
|
inline std::string CadenceTelemetryToJson(const CadenceTelemetrySnapshot& snapshot)
|
|
{
|
|
JsonWriter writer;
|
|
WriteCadenceTelemetryJson(writer, snapshot);
|
|
return writer.StringValue();
|
|
}
|
|
}
|