From 82990e4c46854c2edba9a57f9ca96722e082b11a Mon Sep 17 00:00:00 2001 From: shripad621git Date: Fri, 9 Feb 2024 15:07:50 +0530 Subject: [PATCH] Added a config option to set the permit list size for esp32 traces - Fixes https://github.com/project-chip/connectedhomeip/issues/31536 --- config/esp32/components/chip/Kconfig | 6 ++++++ src/tracing/esp32_trace/counter.h | 5 ++--- src/tracing/esp32_trace/esp32_tracing.cpp | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/config/esp32/components/chip/Kconfig b/config/esp32/components/chip/Kconfig index 0dce48b5f720be..ba23c89b0cc3dc 100644 --- a/config/esp32/components/chip/Kconfig +++ b/config/esp32/components/chip/Kconfig @@ -912,6 +912,12 @@ menu "CHIP Device Layer" default n help This option enables the system statistics to be sent to the insights cloud. + + config INSIGHTS_TRACE_PERMIT_LIST_SIZE + int "Config option to set permitlist size" + range 5 30 + depends on ESP_INSIGHTS_ENABLED + default 20 endmenu diff --git a/src/tracing/esp32_trace/counter.h b/src/tracing/esp32_trace/counter.h index bfa6205c341a13..e155dc4f5b2e24 100644 --- a/src/tracing/esp32_trace/counter.h +++ b/src/tracing/esp32_trace/counter.h @@ -24,8 +24,7 @@ namespace Insights { -/* - * +/** * This class is used to monotonically increment the counters as per the label of the counter macro * 'MATTER_TRACE_COUNTER(label)' and report the metrics to esp-insights. * As per the label of the counter macro, it adds the counter in the linked list with the name label if not @@ -37,7 +36,7 @@ class ESPInsightsCounter { private: static ESPInsightsCounter * mHead; // head of the counter list - const char * label; // unique key + const char * label; // unique key ,it is used as a static string. int instanceCount; ESPInsightsCounter * mNext; // pointer to point to the next entry in the list bool registered = false; diff --git a/src/tracing/esp32_trace/esp32_tracing.cpp b/src/tracing/esp32_trace/esp32_tracing.cpp index 7937772606eec0..542bfb7d3e1054 100644 --- a/src/tracing/esp32_trace/esp32_tracing.cpp +++ b/src/tracing/esp32_trace/esp32_tracing.cpp @@ -30,7 +30,7 @@ namespace Tracing { namespace Insights { namespace { -constexpr size_t kPermitListMaxSize = 20; +constexpr size_t kPermitListMaxSize = CONFIG_INSIGHTS_TRACE_PERMIT_LIST_SIZE; using HashValue = uint32_t; // Implements a murmurhash with 0 seed.