File tree 6 files changed +29
-33
lines changed
app/clusters/software-diagnostics-server
6 files changed +29
-33
lines changed Original file line number Diff line number Diff line change @@ -156,14 +156,13 @@ bool emberAfSoftwareDiagnosticsClusterResetWatermarksCallback(app::CommandHandle
156
156
{
157
157
EmberAfStatus status = EMBER_ZCL_STATUS_SUCCESS;
158
158
159
- uint64_t currentHeapUsed;
160
- CHIP_ERROR err = DeviceLayer::GetDiagnosticDataProvider (). GetCurrentHeapUsed (currentHeapUsed);
161
- VerifyOrExit (err == CHIP_NO_ERROR, status = EMBER_ZCL_STATUS_FAILURE);
162
-
163
- err = DeviceLayer::GetDiagnosticDataProvider (). SetCurrentHeapHighWatermark (currentHeapUsed) ;
164
- VerifyOrExit (err == CHIP_NO_ERROR, status = EMBER_ZCL_STATUS_FAILURE);
159
+ // If implemented, the server SHALL set the value of the CurrentHeapHighWatermark attribute to the
160
+ // value of the CurrentHeapUsed.
161
+ if ( DeviceLayer::GetDiagnosticDataProvider (). ResetWatermarks () != CHIP_NO_ERROR)
162
+ {
163
+ status = EMBER_ZCL_STATUS_FAILURE ;
164
+ }
165
165
166
- exit :
167
166
emberAfSendImmediateDefaultResponse (status);
168
167
169
168
return true ;
Original file line number Diff line number Diff line change @@ -180,6 +180,7 @@ class DiagnosticDataProvider
180
180
virtual CHIP_ERROR GetCurrentHeapUsed (uint64_t & currentHeapUsed);
181
181
virtual CHIP_ERROR GetCurrentHeapHighWatermark (uint64_t & currentHeapHighWatermark);
182
182
virtual CHIP_ERROR SetCurrentHeapHighWatermark (uint64_t heapHighWatermark);
183
+ virtual CHIP_ERROR ResetWatermarks ();
183
184
184
185
/*
185
186
* Get the linked list of thread metrics of the current plaform. After usage, each caller of GetThreadMetrics
@@ -272,6 +273,11 @@ inline CHIP_ERROR DiagnosticDataProvider::SetCurrentHeapHighWatermark(uint64_t h
272
273
return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE;
273
274
}
274
275
276
+ inline CHIP_ERROR DiagnosticDataProvider::ResetWatermarks ()
277
+ {
278
+ return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE;
279
+ }
280
+
275
281
inline CHIP_ERROR DiagnosticDataProvider::GetThreadMetrics (ThreadMetrics ** threadMetricsOut)
276
282
{
277
283
return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE;
Original file line number Diff line number Diff line change @@ -68,30 +68,12 @@ CHIP_ERROR DiagnosticDataProviderImpl::GetTotalOperationalHours(uint32_t & total
68
68
return CHIP_ERROR_INVALID_TIME;
69
69
}
70
70
71
- CHIP_ERROR DiagnosticDataProviderImpl::GetCurrentHeapFree ( uint64_t & currentHeapFree )
71
+ CHIP_ERROR DiagnosticDataProviderImpl::ResetWatermarks ( )
72
72
{
73
- // Overide with dummy value to pass CI
74
- currentHeapFree = 0 ;
75
- return CHIP_NO_ERROR;
76
- }
77
-
78
- CHIP_ERROR DiagnosticDataProviderImpl::GetCurrentHeapUsed (uint64_t & currentHeapUsed)
79
- {
80
- // Overide with dummy value to pass CI
81
- currentHeapUsed = 0 ;
82
- return CHIP_NO_ERROR;
83
- }
73
+ // If implemented, the server SHALL set the value of the CurrentHeapHighWatermark attribute to the
74
+ // value of the CurrentHeapUsed.
75
+ // On Darwin, overide with non-op to pass CI.
84
76
85
- CHIP_ERROR DiagnosticDataProviderImpl::GetCurrentHeapHighWatermark (uint64_t & currentHeapHighWatermark)
86
- {
87
- // Overide with dummy value to pass CI
88
- currentHeapHighWatermark = 0 ;
89
- return CHIP_NO_ERROR;
90
- }
91
-
92
- CHIP_ERROR DiagnosticDataProviderImpl::SetCurrentHeapHighWatermark (uint64_t heapHighWatermark)
93
- {
94
- // Overide to pass CI
95
77
return CHIP_NO_ERROR;
96
78
}
97
79
Original file line number Diff line number Diff line change @@ -40,10 +40,7 @@ class DiagnosticDataProviderImpl : public DiagnosticDataProvider
40
40
CHIP_ERROR GetTotalOperationalHours (uint32_t & totalOperationalHours) override ;
41
41
42
42
// ===== Methods that implement the DiagnosticDataProvider abstract interface.
43
- CHIP_ERROR GetCurrentHeapFree (uint64_t & currentHeapFree) override ;
44
- CHIP_ERROR GetCurrentHeapUsed (uint64_t & currentHeapUsed) override ;
45
- CHIP_ERROR GetCurrentHeapHighWatermark (uint64_t & currentHeapHighWatermark) override ;
46
- CHIP_ERROR SetCurrentHeapHighWatermark (uint64_t heapHighWatermark) override ;
43
+ CHIP_ERROR ResetWatermarks () override ;
47
44
};
48
45
49
46
} // namespace DeviceLayer
Original file line number Diff line number Diff line change @@ -274,6 +274,17 @@ CHIP_ERROR DiagnosticDataProviderImpl::SetCurrentHeapHighWatermark(uint64_t heap
274
274
return CHIP_NO_ERROR;
275
275
}
276
276
277
+ CHIP_ERROR DiagnosticDataProviderImpl::ResetWatermarks ()
278
+ {
279
+ // If implemented, the server SHALL set the value of the CurrentHeapHighWatermark attribute to the
280
+ // value of the CurrentHeapUsed.
281
+
282
+ // On Linux, the write operation is non-op since we always rely on the mallinfo system
283
+ // function to get the current heap memory.
284
+
285
+ return CHIP_NO_ERROR;
286
+ }
287
+
277
288
CHIP_ERROR DiagnosticDataProviderImpl::GetThreadMetrics (ThreadMetrics ** threadMetricsOut)
278
289
{
279
290
CHIP_ERROR err = CHIP_ERROR_READ_FAILED;
Original file line number Diff line number Diff line change @@ -44,6 +44,7 @@ class DiagnosticDataProviderImpl : public DiagnosticDataProvider
44
44
CHIP_ERROR GetCurrentHeapHighWatermark (uint64_t & currentHeapHighWatermark) override ;
45
45
CHIP_ERROR GetThreadMetrics (ThreadMetrics ** threadMetricsOut) override ;
46
46
CHIP_ERROR SetCurrentHeapHighWatermark (uint64_t heapHighWatermark) override ;
47
+ CHIP_ERROR ResetWatermarks () override ;
47
48
void ReleaseThreadMetrics (ThreadMetrics * threadMetrics) override ;
48
49
49
50
CHIP_ERROR GetRebootCount (uint16_t & rebootCount) override ;
You can’t perform that action at this time.
0 commit comments