From 3388781de1336e1c10c4649a0152d658b8a50b4c Mon Sep 17 00:00:00 2001 From: milanr-q <114670456+milanr-q@users.noreply.github.com> Date: Tue, 4 Apr 2023 00:57:52 +0200 Subject: [PATCH] EventManagement reenabled with buffers trimmed (#25944) --- .../qpg/include/CHIPProjectConfig.h | 7 ---- .../lock-app/qpg/include/CHIPProjectConfig.h | 7 ---- .../qpg/include/CHIPProjectConfig.h | 7 ---- .../shell/qpg/include/CHIPProjectConfig.h | 7 ---- src/platform/qpg/SystemPlatformConfig.h | 42 ++++++++++++++++++- 5 files changed, 41 insertions(+), 29 deletions(-) diff --git a/examples/lighting-app/qpg/include/CHIPProjectConfig.h b/examples/lighting-app/qpg/include/CHIPProjectConfig.h index 72363831f495e3..f5f8d12be7797f 100644 --- a/examples/lighting-app/qpg/include/CHIPProjectConfig.h +++ b/examples/lighting-app/qpg/include/CHIPProjectConfig.h @@ -62,13 +62,6 @@ */ #define CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE 1 -/** - * CHIP_DEVICE_CONFIG_EVENT_LOGGING_DEBUG_BUFFER_SIZE - * - * A size, in bytes, of the individual debug event logging buffer. - */ -#define CHIP_DEVICE_CONFIG_EVENT_LOGGING_DEBUG_BUFFER_SIZE (512) - /** * @name Interaction Model object pool configuration. * diff --git a/examples/lock-app/qpg/include/CHIPProjectConfig.h b/examples/lock-app/qpg/include/CHIPProjectConfig.h index 6986e1eea9e0a3..802aa5b2a1f2f3 100644 --- a/examples/lock-app/qpg/include/CHIPProjectConfig.h +++ b/examples/lock-app/qpg/include/CHIPProjectConfig.h @@ -62,13 +62,6 @@ */ #define CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE 1 -/** - * CHIP_DEVICE_CONFIG_EVENT_LOGGING_DEBUG_BUFFER_SIZE - * - * A size, in bytes, of the individual debug event logging buffer. - */ -#define CHIP_DEVICE_CONFIG_EVENT_LOGGING_DEBUG_BUFFER_SIZE (512) - /** * @name Interaction Model object pool configuration. * diff --git a/examples/persistent-storage/qpg/include/CHIPProjectConfig.h b/examples/persistent-storage/qpg/include/CHIPProjectConfig.h index 5daea2fa09101a..d22f40a8dc1e81 100644 --- a/examples/persistent-storage/qpg/include/CHIPProjectConfig.h +++ b/examples/persistent-storage/qpg/include/CHIPProjectConfig.h @@ -93,13 +93,6 @@ */ #define CHIP_DEVICE_CONFIG_TEST_SERIAL_NUMBER "TEST_SN" -/** - * CHIP_DEVICE_CONFIG_EVENT_LOGGING_DEBUG_BUFFER_SIZE - * - * A size, in bytes, of the individual debug event logging buffer. - */ -#define CHIP_DEVICE_CONFIG_EVENT_LOGGING_DEBUG_BUFFER_SIZE (512) - /** * CHIP_DEVICE_CONFIG_THREAD_ENABLE_CLI * diff --git a/examples/shell/qpg/include/CHIPProjectConfig.h b/examples/shell/qpg/include/CHIPProjectConfig.h index c99b06a9562d27..26e931316e2058 100644 --- a/examples/shell/qpg/include/CHIPProjectConfig.h +++ b/examples/shell/qpg/include/CHIPProjectConfig.h @@ -99,13 +99,6 @@ */ #define CHIP_DEVICE_CONFIG_TEST_SERIAL_NUMBER "TEST_SN" -/** - * CHIP_DEVICE_CONFIG_EVENT_LOGGING_DEBUG_BUFFER_SIZE - * - * A size, in bytes, of the individual debug event logging buffer. - */ -#define CHIP_DEVICE_CONFIG_EVENT_LOGGING_DEBUG_BUFFER_SIZE (512) - /** * CHIP_DEVICE_CONFIG_THREAD_ENABLE_CLI * diff --git a/src/platform/qpg/SystemPlatformConfig.h b/src/platform/qpg/SystemPlatformConfig.h index 44ec1f75120e01..d1477df3cbb842 100644 --- a/src/platform/qpg/SystemPlatformConfig.h +++ b/src/platform/qpg/SystemPlatformConfig.h @@ -37,4 +37,44 @@ struct ChipDeviceEvent; #define CHIP_SYSTEM_CONFIG_EVENT_OBJECT_TYPE const struct ::chip::DeviceLayer::ChipDeviceEvent * #define CHIP_SYSTEM_CONFIG_PACKETBUFFER_POOL_SIZE 8 // ========== Platform-specific Configuration Overrides ========= -#define CHIP_CONFIG_ENABLE_SERVER_IM_EVENT 0 +/** + * @def CHIP_DEVICE_CONFIG_EVENT_LOGGING_CRIT_BUFFER_SIZE + * + * @brief + * A size, in bytes, of the buffer reserved for storing CRITICAL events and no + * other events. CRITICAL events will never be evicted until this buffer is + * full, so its size and the sizes of events determine how many of the last N + * CRITICAL events are guaranteed to be available. + * + * Note: this number must be nonzero. + */ +#define CHIP_DEVICE_CONFIG_EVENT_LOGGING_CRIT_BUFFER_SIZE (512) + +/** + * @def CHIP_DEVICE_CONFIG_EVENT_LOGGING_INFO_BUFFER_SIZE + * + * @brief + * A size, in bytes, of the buffer reserved for storing events at INFO + * priority and higher. INFO-priority events will not be evicted until this + * buffer is full (with INFO and CRITICAL events in it) and the oldest event + * in the buffer is an INFO-priority event (which cannot be evicted into the + * CRITICAL event buffer). + * + * Note: set to 0 to treat INFO events as effectively equivalent to DEBUG events. + */ +#define CHIP_DEVICE_CONFIG_EVENT_LOGGING_INFO_BUFFER_SIZE (384) + +/** + * @def CHIP_DEVICE_CONFIG_EVENT_LOGGING_DEBUG_BUFFER_SIZE + * + * @brief + * A size, in bytes, of the buffer used for storing newly generated events, + * and the only buffer in which DEBUG-priority events are allowed. + * DEBUG-priority events will start getting evicted when this buffer is full + * (with DEBUG, INFO, and CRITICAL events in it) and the oldest event in the + * buffer is a DEBUG-priority event, which cannot be evicted into the INFO + * event buffer. + * + * Note: set to 0 to disable storing DEBUG events. + */ +#define CHIP_DEVICE_CONFIG_EVENT_LOGGING_DEBUG_BUFFER_SIZE (256)