From 68de3a3a0bf0a7509b94fa98be1d8067dd0b322c Mon Sep 17 00:00:00 2001 From: shripad621git Date: Fri, 9 Feb 2024 15:07:50 +0530 Subject: [PATCH 1/2] 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 589f33b1c70830..8605c41d2ae378 100644 --- a/config/esp32/components/chip/Kconfig +++ b/config/esp32/components/chip/Kconfig @@ -966,6 +966,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 7b338466378945..090a2ccea0d5e2 100644 --- a/src/tracing/esp32_trace/esp32_tracing.cpp +++ b/src/tracing/esp32_trace/esp32_tracing.cpp @@ -32,7 +32,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. From b514f893bc01c889bd89d15762d1ceccd638a6dd Mon Sep 17 00:00:00 2001 From: shripad621git Date: Wed, 14 Feb 2024 11:34:15 +0530 Subject: [PATCH 2/2] Addressed review comments --- config/esp32/components/chip/Kconfig | 8 ++++++-- src/tracing/esp32_trace/esp32_tracing.cpp | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/config/esp32/components/chip/Kconfig b/config/esp32/components/chip/Kconfig index 8605c41d2ae378..1c0b5afe2bcb61 100644 --- a/config/esp32/components/chip/Kconfig +++ b/config/esp32/components/chip/Kconfig @@ -967,11 +967,15 @@ menu "CHIP Device Layer" 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" + config MAX_PERMIT_LIST_SIZE + int "Set permit list size for Insights traces" range 5 30 depends on ESP_INSIGHTS_ENABLED default 20 + help + Maximum number of group entries that can be included in the permit list for reporting + the traces to insights. + endmenu diff --git a/src/tracing/esp32_trace/esp32_tracing.cpp b/src/tracing/esp32_trace/esp32_tracing.cpp index 090a2ccea0d5e2..e3d9ba559acfde 100644 --- a/src/tracing/esp32_trace/esp32_tracing.cpp +++ b/src/tracing/esp32_trace/esp32_tracing.cpp @@ -32,7 +32,7 @@ namespace Tracing { namespace Insights { namespace { -constexpr size_t kPermitListMaxSize = CONFIG_INSIGHTS_TRACE_PERMIT_LIST_SIZE; +constexpr size_t kPermitListMaxSize = CONFIG_MAX_PERMIT_LIST_SIZE; using HashValue = uint32_t; // Implements a murmurhash with 0 seed.