dispatch event intergration
This commit is contained in:
@@ -111,6 +111,64 @@ bool HealthTelemetry::TryRecordFramePacingStats(double completionIntervalMillise
|
||||
return true;
|
||||
}
|
||||
|
||||
void HealthTelemetry::RecordRuntimeEventQueueMetrics(const std::string& queueName, std::size_t depth, std::size_t capacity,
|
||||
uint64_t droppedCount, double oldestEventAgeMilliseconds)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(mMutex);
|
||||
mRuntimeEvents.queue.queueName = queueName;
|
||||
mRuntimeEvents.queue.depth = depth;
|
||||
mRuntimeEvents.queue.capacity = capacity;
|
||||
mRuntimeEvents.queue.droppedCount = droppedCount;
|
||||
mRuntimeEvents.queue.oldestEventAgeMilliseconds = std::max(oldestEventAgeMilliseconds, 0.0);
|
||||
}
|
||||
|
||||
bool HealthTelemetry::TryRecordRuntimeEventQueueMetrics(const std::string& queueName, std::size_t depth, std::size_t capacity,
|
||||
uint64_t droppedCount, double oldestEventAgeMilliseconds)
|
||||
{
|
||||
std::unique_lock<std::mutex> lock(mMutex, std::try_to_lock);
|
||||
if (!lock.owns_lock())
|
||||
return false;
|
||||
|
||||
mRuntimeEvents.queue.queueName = queueName;
|
||||
mRuntimeEvents.queue.depth = depth;
|
||||
mRuntimeEvents.queue.capacity = capacity;
|
||||
mRuntimeEvents.queue.droppedCount = droppedCount;
|
||||
mRuntimeEvents.queue.oldestEventAgeMilliseconds = std::max(oldestEventAgeMilliseconds, 0.0);
|
||||
return true;
|
||||
}
|
||||
|
||||
void HealthTelemetry::RecordRuntimeEventDispatchStats(std::size_t dispatchedEvents, std::size_t handlerInvocations,
|
||||
std::size_t handlerFailures, double dispatchDurationMilliseconds)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(mMutex);
|
||||
++mRuntimeEvents.dispatch.dispatchCallCount;
|
||||
mRuntimeEvents.dispatch.dispatchedEventCount += static_cast<uint64_t>(dispatchedEvents);
|
||||
mRuntimeEvents.dispatch.handlerInvocationCount += static_cast<uint64_t>(handlerInvocations);
|
||||
mRuntimeEvents.dispatch.handlerFailureCount += static_cast<uint64_t>(handlerFailures);
|
||||
mRuntimeEvents.dispatch.lastDispatchDurationMilliseconds = std::max(dispatchDurationMilliseconds, 0.0);
|
||||
mRuntimeEvents.dispatch.maxDispatchDurationMilliseconds = std::max(
|
||||
mRuntimeEvents.dispatch.maxDispatchDurationMilliseconds,
|
||||
mRuntimeEvents.dispatch.lastDispatchDurationMilliseconds);
|
||||
}
|
||||
|
||||
bool HealthTelemetry::TryRecordRuntimeEventDispatchStats(std::size_t dispatchedEvents, std::size_t handlerInvocations,
|
||||
std::size_t handlerFailures, double dispatchDurationMilliseconds)
|
||||
{
|
||||
std::unique_lock<std::mutex> lock(mMutex, std::try_to_lock);
|
||||
if (!lock.owns_lock())
|
||||
return false;
|
||||
|
||||
++mRuntimeEvents.dispatch.dispatchCallCount;
|
||||
mRuntimeEvents.dispatch.dispatchedEventCount += static_cast<uint64_t>(dispatchedEvents);
|
||||
mRuntimeEvents.dispatch.handlerInvocationCount += static_cast<uint64_t>(handlerInvocations);
|
||||
mRuntimeEvents.dispatch.handlerFailureCount += static_cast<uint64_t>(handlerFailures);
|
||||
mRuntimeEvents.dispatch.lastDispatchDurationMilliseconds = std::max(dispatchDurationMilliseconds, 0.0);
|
||||
mRuntimeEvents.dispatch.maxDispatchDurationMilliseconds = std::max(
|
||||
mRuntimeEvents.dispatch.maxDispatchDurationMilliseconds,
|
||||
mRuntimeEvents.dispatch.lastDispatchDurationMilliseconds);
|
||||
return true;
|
||||
}
|
||||
|
||||
HealthTelemetry::SignalStatusSnapshot HealthTelemetry::GetSignalStatusSnapshot() const
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(mMutex);
|
||||
@@ -129,6 +187,12 @@ HealthTelemetry::PerformanceSnapshot HealthTelemetry::GetPerformanceSnapshot() c
|
||||
return mPerformance;
|
||||
}
|
||||
|
||||
HealthTelemetry::RuntimeEventMetricsSnapshot HealthTelemetry::GetRuntimeEventMetricsSnapshot() const
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(mMutex);
|
||||
return mRuntimeEvents;
|
||||
}
|
||||
|
||||
HealthTelemetry::Snapshot HealthTelemetry::GetSnapshot() const
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(mMutex);
|
||||
@@ -137,5 +201,6 @@ HealthTelemetry::Snapshot HealthTelemetry::GetSnapshot() const
|
||||
snapshot.signal = mSignalStatus;
|
||||
snapshot.videoIO = mVideoIOStatus;
|
||||
snapshot.performance = mPerformance;
|
||||
snapshot.runtimeEvents = mRuntimeEvents;
|
||||
return snapshot;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user