Matter SDK Coverage Report
Current view: top level - tracing/esp32_diagnostics - Counter.cpp (source / functions) Coverage Total Hit
Test: SHA:db08debc068562b264a2df3a7f3a8cc1d0b3aba1 Lines: 0.0 % 13 0
Test Date: 2025-10-02 07:10:30 Functions: 0.0 % 3 0

            Line data    Source code
       1              : /*
       2              :  *
       3              :  *    Copyright (c) 2025 Project CHIP Authors
       4              :  *    All rights reserved.
       5              :  *
       6              :  *    Licensed under the Apache License, Version 2.0 (the "License");
       7              :  *    you may not use this file except in compliance with the License.
       8              :  *    You may obtain a copy of the License at
       9              :  *
      10              :  *        http://www.apache.org/licenses/LICENSE-2.0
      11              :  *
      12              :  *    Unless required by applicable law or agreed to in writing, software
      13              :  *    distributed under the License is distributed on an "AS IS" BASIS,
      14              :  *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      15              :  *    See the License for the specific language governing permissions and
      16              :  *    limitations under the License.
      17              :  */
      18              : 
      19              : #include <lib/support/CHIPMemString.h>
      20              : #include <system/SystemClock.h>
      21              : #include <tracing/esp32_diagnostics/Counter.h>
      22              : 
      23              : namespace chip {
      24              : namespace Tracing {
      25              : namespace Diagnostics {
      26              : 
      27              : std::map<const char *, uint32_t, ESPDiagnosticCounter::StringCompare> ESPDiagnosticCounter::mCounterList;
      28              : 
      29            0 : void ESPDiagnosticCounter::IncreaseCount(const char * label)
      30              : {
      31            0 :     mCounterList[label]++;
      32            0 : }
      33              : 
      34            0 : uint32_t ESPDiagnosticCounter::GetInstanceCount(const char * label) const
      35              : {
      36            0 :     auto it = mCounterList.find(label);
      37            0 :     return (it != mCounterList.end()) ? it->second : 0;
      38              : }
      39              : 
      40            0 : CHIP_ERROR ESPDiagnosticCounter::ReportMetrics(const char * label, CircularDiagnosticBuffer * storageInstance)
      41              : {
      42            0 :     VerifyOrReturnError(storageInstance != nullptr, CHIP_ERROR_INCORRECT_STATE,
      43              :                         ChipLogError(DeviceLayer, "Diagnostic Storage Instance cannot be NULL"));
      44              :     DiagnosticEntry entry;
      45            0 :     Platform::CopyString(entry.label, label);
      46            0 :     entry.uintValue                = GetInstanceCount(label);
      47            0 :     entry.type                     = Diagnostics::ValueType::kUnsignedInteger;
      48            0 :     entry.timestamps_ms_since_boot = static_cast<uint32_t>(chip::System::SystemClock().GetMonotonicMilliseconds64().count());
      49              : 
      50            0 :     return storageInstance->Store(entry);
      51              : }
      52              : 
      53              : } // namespace Diagnostics
      54              : } // namespace Tracing
      55              : } // namespace chip
        

Generated by: LCOV version 2.0-1