Skip to content

Commit

Permalink
Restore the ability to turn off event UTC timestamps at compile time. (
Browse files Browse the repository at this point in the history
…#25281)

* Adds CHIP_DEVICE_CONFIG_EVENT_LOGGING_UTC_TIMESTAMPS and sets it when
  CHIP_CONFIG_EVENT_LOGGING_UTC_TIMESTAMPS used to be set.
* Removes src/lib/core/CHIPEventLoggingConfig.h, which only contains unused
  (never read) defines, and places where those defines are set.
* Enables CHIP_DEVICE_CONFIG_EVENT_LOGGING_UTC_TIMESTAMPS on Darwin and Linux.
  • Loading branch information
bzbarsky-apple authored and pull[bot] committed Feb 15, 2024
1 parent 0cdb386 commit 1042284
Show file tree
Hide file tree
Showing 34 changed files with 182 additions and 85 deletions.
2 changes: 0 additions & 2 deletions config/python/CHIPProjectConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@

#define CHIP_CONFIG_EVENT_LOGGING_NUM_EXTERNAL_CALLBACKS 2

#define CHIP_CONFIG_EVENT_LOGGING_EXTERNAL_EVENT_SUPPORT 1

// Uncomment this for a large Tunnel MTU.
//#define CHIP_CONFIG_TUNNEL_INTERFACE_MTU (9000)

Expand Down
2 changes: 0 additions & 2 deletions config/standalone/CHIPProjectConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@

#define CHIP_CONFIG_EVENT_LOGGING_NUM_EXTERNAL_CALLBACKS 2

#define CHIP_CONFIG_EVENT_LOGGING_EXTERNAL_EVENT_SUPPORT 1

// Uncomment this for a large Tunnel MTU.
// #define CHIP_CONFIG_TUNNEL_INTERFACE_MTU (9000)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,13 @@
*/
#define CHIP_CONFIG_EVENT_LOGGING_WDM_OFFLOAD 1

/**
* CHIP_DEVICE_CONFIG_EVENT_LOGGING_UTC_TIMESTAMPS
*
* Enable recording UTC timestamps.
*/
#define CHIP_DEVICE_CONFIG_EVENT_LOGGING_UTC_TIMESTAMPS 1

/**
* CHIP_DEVICE_CONFIG_EVENT_LOGGING_DEBUG_BUFFER_SIZE
*
Expand Down
7 changes: 7 additions & 0 deletions examples/chef/efr32/include/CHIPProjectConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,13 @@
*/
#define CHIP_DEVICE_CONFIG_TEST_SERIAL_NUMBER "TEST_SN"

/**
* CHIP_DEVICE_CONFIG_EVENT_LOGGING_UTC_TIMESTAMPS
*
* Enable recording UTC timestamps.
*/
#define CHIP_DEVICE_CONFIG_EVENT_LOGGING_UTC_TIMESTAMPS 1

/**
* CHIP_DEVICE_CONFIG_EVENT_LOGGING_DEBUG_BUFFER_SIZE
*
Expand Down
2 changes: 0 additions & 2 deletions examples/chip-tool/include/CHIPProjectAppConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@

#define CHIP_CONFIG_EVENT_LOGGING_NUM_EXTERNAL_CALLBACKS 2

#define CHIP_CONFIG_EVENT_LOGGING_EXTERNAL_EVENT_SUPPORT 1

// Uncomment this for a large Tunnel MTU.
//#define CHIP_CONFIG_TUNNEL_INTERFACE_MTU (9000)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@

#define CHIP_CONFIG_EVENT_LOGGING_NUM_EXTERNAL_CALLBACKS 2

#define CHIP_CONFIG_EVENT_LOGGING_EXTERNAL_EVENT_SUPPORT 1

// Enable support functions for parsing command-line arguments
#define CHIP_CONFIG_ENABLE_ARG_PARSER 1

Expand Down
7 changes: 7 additions & 0 deletions examples/light-switch-app/genio/include/CHIPProjectConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,13 @@
*/
#define CHIP_DEVICE_CONFIG_TEST_SERIAL_NUMBER "TEST_SN"

/**
* CHIP_DEVICE_CONFIG_EVENT_LOGGING_UTC_TIMESTAMPS
*
* Enable recording UTC timestamps.
*/
#define CHIP_DEVICE_CONFIG_EVENT_LOGGING_UTC_TIMESTAMPS 1

/**
* CHIP_DEVICE_CONFIG_EVENT_LOGGING_DEBUG_BUFFER_SIZE
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,13 @@
*/
#define CHIP_DEVICE_CONFIG_TEST_SERIAL_NUMBER "TEST_SN"

/**
* CHIP_DEVICE_CONFIG_EVENT_LOGGING_UTC_TIMESTAMPS
*
* Enable recording UTC timestamps.
*/
#define CHIP_DEVICE_CONFIG_EVENT_LOGGING_UTC_TIMESTAMPS 1

/**
* CHIP_DEVICE_CONFIG_EVENT_LOGGING_DEBUG_BUFFER_SIZE
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,13 @@
*/
#define CHIP_DEVICE_CONFIG_TEST_SERIAL_NUMBER "TEST_SN"

/**
* CHIP_DEVICE_CONFIG_EVENT_LOGGING_UTC_TIMESTAMPS
*
* Enable recording UTC timestamps.
*/
#define CHIP_DEVICE_CONFIG_EVENT_LOGGING_UTC_TIMESTAMPS 1

/**
* CHIP_DEVICE_CONFIG_EVENT_LOGGING_DEBUG_BUFFER_SIZE
*
Expand Down
7 changes: 7 additions & 0 deletions examples/lighting-app/bouffalolab/bl702/CHIPProjectConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,13 @@
*/
#define CHIP_DEVICE_CONFIG_TEST_SERIAL_NUMBER "TEST_SN"

/**
* CHIP_DEVICE_CONFIG_EVENT_LOGGING_UTC_TIMESTAMPS
*
* Enable recording UTC timestamps.
*/
#define CHIP_DEVICE_CONFIG_EVENT_LOGGING_UTC_TIMESTAMPS 1

/**
* CHIP_DEVICE_CONFIG_EVENT_LOGGING_DEBUG_BUFFER_SIZE
*
Expand Down
7 changes: 7 additions & 0 deletions examples/lighting-app/genio/include/CHIPProjectConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,13 @@
*/
#define CHIP_DEVICE_CONFIG_TEST_SERIAL_NUMBER "TEST_SN"

/**
* CHIP_DEVICE_CONFIG_EVENT_LOGGING_UTC_TIMESTAMPS
*
* Enable recording UTC timestamps.
*/
#define CHIP_DEVICE_CONFIG_EVENT_LOGGING_UTC_TIMESTAMPS 1

/**
* CHIP_DEVICE_CONFIG_EVENT_LOGGING_DEBUG_BUFFER_SIZE
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,13 @@
*/
#define CHIP_DEVICE_CONFIG_TEST_SERIAL_NUMBER "TEST_SN"

/**
* CHIP_DEVICE_CONFIG_EVENT_LOGGING_UTC_TIMESTAMPS
*
* Enable recording UTC timestamps.
*/
#define CHIP_DEVICE_CONFIG_EVENT_LOGGING_UTC_TIMESTAMPS 1

/**
* CHIP_DEVICE_CONFIG_EVENT_LOGGING_DEBUG_BUFFER_SIZE
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,13 @@
*/
#define CHIP_DEVICE_CONFIG_TEST_SERIAL_NUMBER "TEST_SN"

/**
* CHIP_DEVICE_CONFIG_EVENT_LOGGING_UTC_TIMESTAMPS
*
* Enable recording UTC timestamps.
*/
#define CHIP_DEVICE_CONFIG_EVENT_LOGGING_UTC_TIMESTAMPS 1

/**
* CHIP_DEVICE_CONFIG_EVENT_LOGGING_DEBUG_BUFFER_SIZE
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,13 @@
*/
#define CHIP_DEVICE_CONFIG_TEST_SERIAL_NUMBER "TEST_SN"

/**
* CHIP_DEVICE_CONFIG_EVENT_LOGGING_UTC_TIMESTAMPS
*
* Enable recording UTC timestamps.
*/
#define CHIP_DEVICE_CONFIG_EVENT_LOGGING_UTC_TIMESTAMPS 1

/**
* CHIP_DEVICE_CONFIG_EVENT_LOGGING_DEBUG_BUFFER_SIZE
*
Expand Down
7 changes: 7 additions & 0 deletions examples/lock-app/cc32xx/main/include/CHIPProjectConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,13 @@
*/
#define CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE 0

/**
* CHIP_DEVICE_CONFIG_EVENT_LOGGING_UTC_TIMESTAMPS
*
* Enable recording UTC timestamps.
*/
#define CHIP_DEVICE_CONFIG_EVENT_LOGGING_UTC_TIMESTAMPS 1

/**
* CHIP_DEVICE_CONFIG_EVENT_LOGGING_DEBUG_BUFFER_SIZE
*
Expand Down
7 changes: 7 additions & 0 deletions examples/lock-app/genio/include/CHIPProjectConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,13 @@
*/
#define CHIP_DEVICE_CONFIG_TEST_SERIAL_NUMBER "TEST_SN"

/**
* CHIP_DEVICE_CONFIG_EVENT_LOGGING_UTC_TIMESTAMPS
*
* Enable recording UTC timestamps.
*/
#define CHIP_DEVICE_CONFIG_EVENT_LOGGING_UTC_TIMESTAMPS 1

/**
* CHIP_DEVICE_CONFIG_EVENT_LOGGING_DEBUG_BUFFER_SIZE
*
Expand Down
7 changes: 7 additions & 0 deletions examples/lock-app/silabs/SiWx917/include/CHIPProjectConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,13 @@
*/
#define CHIP_DEVICE_CONFIG_TEST_SERIAL_NUMBER "TEST_SN"

/**
* CHIP_DEVICE_CONFIG_EVENT_LOGGING_UTC_TIMESTAMPS
*
* Enable recording UTC timestamps.
*/
#define CHIP_DEVICE_CONFIG_EVENT_LOGGING_UTC_TIMESTAMPS 1

/**
* CHIP_DEVICE_CONFIG_EVENT_LOGGING_DEBUG_BUFFER_SIZE
*
Expand Down
7 changes: 7 additions & 0 deletions examples/lock-app/silabs/efr32/include/CHIPProjectConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,13 @@
*/
#define CHIP_DEVICE_CONFIG_TEST_SERIAL_NUMBER "TEST_SN"

/**
* CHIP_DEVICE_CONFIG_EVENT_LOGGING_UTC_TIMESTAMPS
*
* Enable recording UTC timestamps.
*/
#define CHIP_DEVICE_CONFIG_EVENT_LOGGING_UTC_TIMESTAMPS 1

/**
* CHIP_DEVICE_CONFIG_EVENT_LOGGING_DEBUG_BUFFER_SIZE
*
Expand Down
7 changes: 7 additions & 0 deletions examples/ota-requestor-app/genio/include/CHIPProjectConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,13 @@
*/
#define CHIP_DEVICE_CONFIG_TEST_SERIAL_NUMBER "TEST_SN"

/**
* CHIP_DEVICE_CONFIG_EVENT_LOGGING_UTC_TIMESTAMPS
*
* Enable recording UTC timestamps.
*/
#define CHIP_DEVICE_CONFIG_EVENT_LOGGING_UTC_TIMESTAMPS 1

/**
* CHIP_DEVICE_CONFIG_EVENT_LOGGING_DEBUG_BUFFER_SIZE
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,13 @@
*/
#define CHIP_DEVICE_CONFIG_TEST_SERIAL_NUMBER "TEST_SN"

/**
* CHIP_DEVICE_CONFIG_EVENT_LOGGING_UTC_TIMESTAMPS
*
* Enable recording UTC timestamps.
*/
#define CHIP_DEVICE_CONFIG_EVENT_LOGGING_UTC_TIMESTAMPS 1

/**
* CHIP_DEVICE_CONFIG_EVENT_LOGGING_DEBUG_BUFFER_SIZE
*
Expand Down
7 changes: 7 additions & 0 deletions examples/shell/genio/include/CHIPProjectConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,13 @@
*/
#define CHIP_DEVICE_CONFIG_TEST_SERIAL_NUMBER "TEST_SN"

/**
* CHIP_DEVICE_CONFIG_EVENT_LOGGING_UTC_TIMESTAMPS
*
* Enable recording UTC timestamps.
*/
#define CHIP_DEVICE_CONFIG_EVENT_LOGGING_UTC_TIMESTAMPS 1

/**
* CHIP_DEVICE_CONFIG_EVENT_LOGGING_DEBUG_BUFFER_SIZE
*
Expand Down
7 changes: 7 additions & 0 deletions examples/thermostat/genio/include/CHIPProjectConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,13 @@
*/
#define CHIP_DEVICE_CONFIG_TEST_SERIAL_NUMBER "TEST_SN"

/**
* CHIP_DEVICE_CONFIG_EVENT_LOGGING_UTC_TIMESTAMPS
*
* Enable recording UTC timestamps.
*/
#define CHIP_DEVICE_CONFIG_EVENT_LOGGING_UTC_TIMESTAMPS 1

/**
* CHIP_DEVICE_CONFIG_EVENT_LOGGING_DEBUG_BUFFER_SIZE
*
Expand Down
7 changes: 7 additions & 0 deletions examples/thermostat/silabs/efr32/include/CHIPProjectConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,13 @@
*/
#define CHIP_DEVICE_CONFIG_TEST_SERIAL_NUMBER "TEST_SN"

/**
* CHIP_DEVICE_CONFIG_EVENT_LOGGING_UTC_TIMESTAMPS
*
* Enable recording UTC timestamps.
*/
#define CHIP_DEVICE_CONFIG_EVENT_LOGGING_UTC_TIMESTAMPS 1

/**
* CHIP_DEVICE_CONFIG_EVENT_LOGGING_DEBUG_BUFFER_SIZE
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,13 @@
*/
#define CHIP_DEVICE_CONFIG_TEST_SERIAL_NUMBER "TEST_SN"

/**
* CHIP_DEVICE_CONFIG_EVENT_LOGGING_UTC_TIMESTAMPS
*
* Enable recording UTC timestamps.
*/
#define CHIP_DEVICE_CONFIG_EVENT_LOGGING_UTC_TIMESTAMPS 1

/**
* CHIP_DEVICE_CONFIG_EVENT_LOGGING_DEBUG_BUFFER_SIZE
*
Expand Down
7 changes: 7 additions & 0 deletions examples/window-app/silabs/efr32/include/CHIPProjectConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,13 @@
*/
#define CHIP_DEVICE_CONFIG_TEST_SERIAL_NUMBER "TEST_SN"

/**
* CHIP_DEVICE_CONFIG_EVENT_LOGGING_UTC_TIMESTAMPS
*
* Enable recording UTC timestamps.
*/
#define CHIP_DEVICE_CONFIG_EVENT_LOGGING_UTC_TIMESTAMPS 1

/**
* CHIP_DEVICE_CONFIG_EVENT_LOGGING_DEBUG_BUFFER_SIZE
*
Expand Down
4 changes: 3 additions & 1 deletion src/app/EventManagement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
#include <app/RequiredPrivilege.h>
#include <assert.h>
#include <inttypes.h>
#include <lib/core/CHIPEventLoggingConfig.h>
#include <lib/core/TLVUtilities.h>
#include <lib/support/CodeUtils.h>
#include <lib/support/logging/CHIPLogging.h>
Expand Down Expand Up @@ -428,14 +427,17 @@ CHIP_ERROR EventManagement::LogEventPrivate(EventLoggingDelegate * apDelegate, c
CircularTLVWriter checkpoint = writer;
EventLoadOutContext ctxt = EventLoadOutContext(writer, aEventOptions.mPriority, mLastEventNumber);
EventOptions opts;

Timestamp timestamp;
#if CHIP_DEVICE_CONFIG_EVENT_LOGGING_UTC_TIMESTAMPS
System::Clock::Milliseconds64 utc_time;
err = System::SystemClock().GetClock_RealTimeMS(utc_time);
if (err == CHIP_NO_ERROR)
{
timestamp = Timestamp::Epoch(utc_time);
}
else
#endif // CHIP_DEVICE_CONFIG_EVENT_LOGGING_UTC_TIMESTAMPS
{
auto systemTimeMs = System::SystemClock().GetMonotonicMilliseconds64() - mMonotonicStartupTime;
timestamp = Timestamp::System(systemTimeMs);
Expand Down
7 changes: 6 additions & 1 deletion src/app/EventManagement.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#include <lib/core/TLVCircularBuffer.h>
#include <lib/support/CHIPCounter.h>
#include <messaging/ExchangeMgr.h>
#include <platform/CHIPDeviceConfig.h>
#include <system/SystemClock.h>

/**
Expand Down Expand Up @@ -397,7 +398,11 @@ class EventManagement

int mFieldsToRead = 0;
/* PriorityLevel and DeltaTime are there if that is not first event when putting events in report*/
Timestamp mCurrentTime = Timestamp::System(System::Clock::kZero);
#if CHIP_DEVICE_CONFIG_EVENT_LOGGING_UTC_TIMESTAMPS
Timestamp mCurrentTime = Timestamp::System(System::Clock::kZero);
#else // CHIP_DEVICE_CONFIG_EVENT_LOGGING_UTC_TIMESTAMPS
Timestamp mCurrentTime = Timestamp::Epoch(System::Clock::kZero);
#endif // CHIP_DEVICE_CONFIG_EVENT_LOGGING_UTC_TIMESTAMPS
PriorityLevel mPriority = PriorityLevel::First;
ClusterId mClusterId = 0;
EndpointId mEndpointId = 0;
Expand Down
10 changes: 10 additions & 0 deletions src/include/platform/CHIPDeviceConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -1010,6 +1010,16 @@
#define CHIP_DEVICE_CONFIG_EVENT_ID_COUNTER_EPOCH (0x10000)
#endif

/**
* @def CHIP_DEVICE_CONFIG_EVENT_LOGGING_UTC_TIMESTAMPS
*
* @brief
* By default, don't record UTC timestamps.
*/
#ifndef CHIP_DEVICE_CONFIG_EVENT_LOGGING_UTC_TIMESTAMPS
#define CHIP_DEVICE_CONFIG_EVENT_LOGGING_UTC_TIMESTAMPS 0
#endif

// -------------------- Software Update Manager Configuration --------------------

/**
Expand Down
Loading

0 comments on commit 1042284

Please sign in to comment.