Skip to content

Commit

Permalink
Removed reference to the watermark array to prevent unused arg errors…
Browse files Browse the repository at this point in the history
… when logs are disable
  • Loading branch information
lpbeliveau-silabs committed Nov 27, 2024
1 parent 83d9db2 commit 2cdfa61
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/platform/silabs/tracing/SilabsTracing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,21 +179,21 @@ CHIP_ERROR SilabsTracer::StartWatermarksStorage(PersistentStorageDelegate * stor
CHIP_ERROR SilabsTracer::TimeTraceBegin(TimeTraceOperation aOperation)
{
// Log the start time of the operation
auto & tracker = mLatestTimeTrackers[static_cast<size_t>(aOperation)];
auto & tracker = mLatestTimeTrackers[to_underlying(aOperation)];
tracker.mStartTime = System::SystemClock().GetMonotonicTimestamp();
tracker.mOperation = aOperation;
tracker.mType = OperationType::kBegin;
tracker.mError = CHIP_NO_ERROR;

auto & watermark = mWatermarks[static_cast<size_t>(aOperation)];
auto & watermark = mWatermarks[to_underlying(aOperation)];
watermark.mTotalCount++;

return OutputTrace(tracker);
}

CHIP_ERROR SilabsTracer::TimeTraceEnd(TimeTraceOperation aOperation, CHIP_ERROR error)
{
auto & tracker = mLatestTimeTrackers[static_cast<size_t>(aOperation)];
auto & tracker = mLatestTimeTrackers[to_underlying(aOperation)];
tracker.mEndTime = System::SystemClock().GetMonotonicTimestamp();
tracker.mType = OperationType::kEnd;
tracker.mError = error;
Expand All @@ -203,7 +203,7 @@ CHIP_ERROR SilabsTracer::TimeTraceEnd(TimeTraceOperation aOperation, CHIP_ERROR
// Calculate the duration and update the time tracker
auto duration = tracker.mEndTime - tracker.mStartTime;

auto & watermark = mWatermarks[static_cast<size_t>(aOperation)];
auto & watermark = mWatermarks[to_underlying(aOperation)];
watermark.mSuccessfullCount++;
watermark.mMovingAverage = System::Clock::Milliseconds32(
(watermark.mMovingAverage.count() * (watermark.mSuccessfullCount - 1) + duration.count()) /
Expand Down Expand Up @@ -287,15 +287,15 @@ CHIP_ERROR SilabsTracer::OutputWaterMark(TimeTraceOperation aOperation)
{
VerifyOrReturnError(to_underlying(aOperation) < kNumTraces, CHIP_ERROR_INVALID_ARGUMENT,
ChipLogError(DeviceLayer, "Invalid TimeTraceOperation"));
size_t index = to_underlying(aOperation);
auto & watermark = mWatermarks[index];
size_t index = to_underlying(aOperation);

VerifyOrReturnError(isLogInitialized(), CHIP_ERROR_UNINITIALIZED);
ChipLogProgress(DeviceLayer,
"| Operation: %-25s| MaxTime:%-5" PRIu32 "| MinTime:%-5" PRIu32 "| AvgTime:%-5" PRIu32 "| TotalCount:%-8" PRIu32
", SuccessFullCount:%-8" PRIu32 "| CountAboveAvg:%-8" PRIu32 "|",
TimeTraceOperationToString(aOperation), watermark.mMaxTimeMs.count(), watermark.mMinTimeMs.count(),
watermark.mMovingAverage.count(), watermark.mTotalCount, watermark.mSuccessfullCount, watermark.mCountAboveAvg);
TimeTraceOperationToString(aOperation), mWatermarks[index].mMaxTimeMs.count(),
mWatermarks[index].mMinTimeMs.count(), mWatermarks[index].mMovingAverage.count(),
mWatermarks[index].mTotalCount, mWatermarks[index].mSuccessfullCount, mWatermarks[index].mCountAboveAvg);

return CHIP_NO_ERROR;
}
Expand Down

0 comments on commit 2cdfa61

Please sign in to comment.