Skip to content

Commit

Permalink
restlyed
Browse files Browse the repository at this point in the history
  • Loading branch information
shripad621git committed Feb 29, 2024
1 parent 71f56f4 commit 4720684
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
3 changes: 3 additions & 0 deletions scripts/tools/check_includes_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,9 @@
'src/tracing/json/json_tracing.cpp': {'string', 'sstream'},
'src/tracing/json/json_tracing.h': {'fstream', 'unordered_map'},

# esp32 tracing
'src/tracing/esp32_trace/esp32_tracing.h': {'unordered_map'},

# Not intended for embedded clients
'src/app/PendingResponseTrackerImpl.h': {'unordered_set'},

Expand Down
22 changes: 10 additions & 12 deletions src/tracing/esp32_trace/esp32_tracing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,26 +152,23 @@ void ESP32Backend::TraceCounter(const char * label)
::Insights::ESPInsightsCounter::GetInstance(label)->ReportMetrics();
}

void ESP32Backend::RegisterMetric(const char* key, ValueType type)
void ESP32Backend::RegisterMetric(const char * key, ValueType type)
{
switch (type)
{
case ValueType::kUInt32:
esp_diag_metrics_register("SYS_MTR" /*Tag of metrics */, key /* Unique key 8 */,
key /* label displayed on dashboard */, "insights.mtr" /* hierarchical path */,
ESP_DIAG_DATA_TYPE_UINT /* data_type */);
esp_diag_metrics_register("SYS_MTR" /*Tag of metrics */, key /* Unique key 8 */, key /* label displayed on dashboard */,
"insights.mtr" /* hierarchical path */, ESP_DIAG_DATA_TYPE_UINT /* data_type */);
break;

case ValueType::kInt32:
esp_diag_metrics_register("SYS_MTR" /*Tag of metrics */, key /* Unique key 8 */,
key /* label displayed on dashboard */, "insights.mtr" /* hierarchical path */,
ESP_DIAG_DATA_TYPE_INT /* data_type */);
esp_diag_metrics_register("SYS_MTR" /*Tag of metrics */, key /* Unique key 8 */, key /* label displayed on dashboard */,
"insights.mtr" /* hierarchical path */, ESP_DIAG_DATA_TYPE_INT /* data_type */);
break;

case ValueType::kChipErrorCode:
esp_diag_metrics_register("SYS_MTR" /*Tag of metrics */, key /* Unique key 8 */,
key /* label displayed on dashboard */, "insights.mtr" /* hierarchical path */,
ESP_DIAG_DATA_TYPE_UINT /* data_type */);
esp_diag_metrics_register("SYS_MTR" /*Tag of metrics */, key /* Unique key 8 */, key /* label displayed on dashboard */,
"insights.mtr" /* hierarchical path */, ESP_DIAG_DATA_TYPE_UINT /* data_type */);
break;

case ValueType::kUndefined:
Expand All @@ -184,8 +181,9 @@ void ESP32Backend::RegisterMetric(const char* key, ValueType type)

void ESP32Backend::LogMetricEvent(const MetricEvent & event)
{

if (mRegisteredMetrics.find(event.key()) == mRegisteredMetrics.end()) {

if (mRegisteredMetrics.find(event.key()) == mRegisteredMetrics.end())
{
RegisterMetric(event.key(), event.ValueType());
}

Expand Down
5 changes: 2 additions & 3 deletions src/tracing/esp32_trace/esp32_tracing.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include <lib/core/CHIPError.h>
#include <tracing/backend.h>
#include <unordered_map>
#include <tracing/metric_event.h>
#include <unordered_map>

#include <memory>
namespace chip {
Expand Down Expand Up @@ -43,8 +43,7 @@ class ESP32Backend : public ::chip::Tracing::Backend
private:
using ValueType = MetricEvent::Value::Type;
std::unordered_map<const char *, ValueType> mRegisteredMetrics;
void RegisterMetric(const char *key, ValueType type);

void RegisterMetric(const char * key, ValueType type);
};

} // namespace Insights
Expand Down

0 comments on commit 4720684

Please sign in to comment.