Skip to content

Commit aee267d

Browse files
authored
[Darwin] Followup PR for missed code review comments (#32447)
* [Darwin] Followup PR for missed code review comments - Fixes following issues: #32438, #32443, #32439 * Resytler fixes * Address review comment
1 parent 6b026af commit aee267d

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

src/darwin/Framework/CHIP/MTRMetrics.h

+5-4
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,17 @@ MTR_NEWLY_AVAILABLE
3232
@property (nonatomic, nullable, readonly, copy) NSNumber * value;
3333

3434
/**
35-
* Error code for the metric data. This value when valid, holds the error code value
36-
* of the operation associated with the event.
35+
* Error code for the metric data. This value, when not nil, holds the error code value
36+
* of the operation associated with the event. Interpretation of the error code value
37+
* dependents on the metric being emitted.
3738
*/
3839
@property (nonatomic, nullable, readonly, copy) NSNumber * errorCode;
3940

4041
/**
4142
* Duration of event associated with the metric. This value may be nil depending on
42-
* the event emitted.
43+
* the event emitted. When not nil, the value of duration is of type NSTimeInterval.
4344
*/
44-
@property (nonatomic, nullable, readonly, copy) NSNumber * durationMicroseconds;
45+
@property (nonatomic, nullable, readonly, copy) NSNumber * duration;
4546

4647
@end
4748

src/darwin/Framework/CHIP/MTRMetricsCollector.mm

+3-3
Original file line numberDiff line numberDiff line change
@@ -80,16 +80,16 @@ - (instancetype)initWithMetricEvent:(const MetricEvent &)event
8080
- (void)setDurationFromMetricDataAndClearCounters:(MTRMetricData *)fromData
8181
{
8282
auto duration = _timePoint - fromData->_timePoint;
83-
_durationMicroseconds = [NSNumber numberWithUnsignedLongLong:duration.count()];
83+
_duration = [NSNumber numberWithDouble:double(duration.count()) / USEC_PER_SEC];
8484

8585
// Clear timepoints to minimize history
8686
_timePoint = fromData->_timePoint = chip::System::Clock::Microseconds64(0);
8787
}
8888

8989
- (NSString *)description
9090
{
91-
return [NSString stringWithFormat:@"<MTRMetricData>: Type %d, Value = %@, Error Code = %@, Duration = %@ us",
92-
static_cast<int>(_type), self.value, self.errorCode, self.durationMicroseconds];
91+
return [NSString stringWithFormat:@"<MTRMetricData: Type %d, Value = %@, Error Code = %@, Duration = %@ us>",
92+
static_cast<int>(_type), self.value, self.errorCode, self.duration];
9393
}
9494

9595
@end

0 commit comments

Comments
 (0)