Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add epoch timestamp in IM Event #12185

Merged

Conversation

yunhanw-google
Copy link
Contributor

@yunhanw-google yunhanw-google commented Nov 23, 2021

Problem

--For IM Events, it needs support either system timestamp or utc timestamp by spec, platform would pick up either one kind timestamp for IM event logging. which means some platfrom would not have utc event logging. Before this PR, CHIP_CONFIG_EVENT_LOGGING_UTC_TIMESTAMPS flag is useless. utc im timestamp is disabled by all example application currently, CHIP_CONFIG_EVENT_LOGGING_UTC_TIMESTAMPS = 0 is at default configuration
this PR pick up freertos platform to enable this utc timestamp feature for IM event for reference where it has #if CHIP_CONFIG_EVENT_LOGGING_UTC_TIMESTAMPS & CHIP_SYSTEM_CONFIG_PLATFORM_PROVIDES_TIME set, for other platform, if they wanna use utc timestamp for IM event, they can refer the freertos implementation
--Remove systemTimestamp's system prefix to suite for both usage for epoch and system.
--Create abstract API GetClock_RealTime, GetClock_RealTimeMS, SetClock_RealTime IN system/Clock.h, implemented it in freertos platform

Change overview

See above

Testing

Compilation and presubmit tests.

Copy link
Contributor

@woody-apple woody-apple left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yunhanw-google It looks like we're disabling UTC_TIMESTAMPS for every platform (unless I read these diffs wrong) Should we remove that code too?

Fast tracking, given there's been enough time for review.

@yunhanw-google
Copy link
Contributor Author

yunhanw-google commented Nov 30, 2021

@yunhanw-google It looks like we're disabling UTC_TIMESTAMPS for every platform (unless I read these diffs wrong) Should we remove that code too?
@woody-apple thanks for questioning.
Currently no code is using CHIP_CONFIG_EVENT_LOGGING_UTC_TIMESTAMPS if you search code, it is basically empty flag for nothing, in other words, there is no utc/epoch timestamp support in Matter code. This PR is not disabling every platform for utc, and the freertos platform still have it, this PR firstly adds the UTC/Epoch timestamp and abstract API for utc timestamp in system/clock, for example, I added the minimal support for freertos platform, then for better cleanup, I disable this flag in other platforms explicitly since those don't have any utc code support, in case these platform needs it in the future and they can enable it. In IM eventManagement, it would use utc time when CHIP_CONFIG_EVENT_LOGGING_UTC_TIMESTAMPS and CHIP_SYSTEM_CONFIG_PLATFORM_PROVIDES_TIME are set.

@woody-apple
Copy link
Contributor

woody-apple commented Nov 30, 2021

@yunhanw-google It looks like we're disabling UTC_TIMESTAMPS for every platform (unless I read these diffs wrong) Should we remove that code too?
@woody-apple thanks for questioning.
Currently no code is using CHIP_CONFIG_EVENT_LOGGING_UTC_TIMESTAMPS if you search code, it is basically empty flag for nothing, in other words, there is no utc/epoch timestamp support in Matter code. This PR is not disabling every platform for utc, and the freertos platform still have it, this PR firstly adds the UTC/Epoch timestamp and abstract API for utc timestamp in system/clock, for example, I added the minimal support for freertos platform, then for better cleanup, I disable this flag in other platforms explicitly since those don't have any utc code support, in case these platform needs it in the future and they can enable it. In IM eventManagement, it would use utc time when CHIP_CONFIG_EVENT_LOGGING_UTC_TIMESTAMPS and CHIP_SYSTEM_CONFIG_PLATFORM_PROVIDES_TIME are set.

Thanks! My main concern here is that this PR claims it's adding timestamp (epoch) support, but also removes other UTC timestamp support.

• If we don't need UTC timestamp support, let's remove it entirely. If some platforms require it, how do we make this more abstract?
• If nobody needs it, let's remove it entirely.

If we're doing cleanup like this (which is great!) let's do this cleanup completely.

@yunhanw-google yunhanw-google force-pushed the feature/add_im_event_epoch branch from b9875c1 to 9ec5bd3 Compare November 30, 2021 18:30
@yunhanw-google
Copy link
Contributor Author

yunhanw-google commented Nov 30, 2021

@yunhanw-google It looks like we're disabling UTC_TIMESTAMPS for every platform (unless I read these diffs wrong) Should we remove that code too?
@woody-apple thanks for questioning.
Currently no code is using CHIP_CONFIG_EVENT_LOGGING_UTC_TIMESTAMPS if you search code, it is basically empty flag for nothing, in other words, there is no utc/epoch timestamp support in Matter code. This PR is not disabling every platform for utc, and the freertos platform still have it, this PR firstly adds the UTC/Epoch timestamp and abstract API for utc timestamp in system/clock, for example, I added the minimal support for freertos platform, then for better cleanup, I disable this flag in other platforms explicitly since those don't have any utc code support, in case these platform needs it in the future and they can enable it. In IM eventManagement, it would use utc time when CHIP_CONFIG_EVENT_LOGGING_UTC_TIMESTAMPS and CHIP_SYSTEM_CONFIG_PLATFORM_PROVIDES_TIME are set.

Thanks! My main concern here is that this PR claims it's adding timestamp (epoch) support, but also removes other UTC timestamp support.

• If we don't need UTC timestamp support, let's remove it entirely. If some platforms require it, how do we make this more abstract? • If nobody needs it, let's remove it entirely.

If we're doing cleanup like this (which is great!) let's do this cleanup completely.

Thanks! Just remove those CHIP_CONFIG_EVENT_LOGGING_UTC_TIMESTAMPS for platform which currently don't use it. Also update the PR description, "Before this PR there is no epoch timestamp support for all platform, CHIP_CONFIG_EVENT_LOGGING_UTC_TIMESTAMPS has not yet been used. This PR add Epoch timestamp in IM event for freertos platform, and create abstract API in system/Clock.h"

@github-actions
Copy link

github-actions bot commented Nov 30, 2021

PR #12185: Size comparison from 46fbb06 to 9ec5bd3

Increases (37 builds for efr32, esp32, k32w, linux, mbed, nrfconnect, p6, qpg, telink)
platform target config section 46fbb06 9ec5bd38 change % change
efr32 lighting-app BRD4161A (read only) 763016 763336 320 0.0
(read/write) 120300 120316 16 0.0
.bss 118476 118492 16 0.0
.text 763008 763328 320 0.0
BRD4161A+rpc (read only) 791512 791840 328 0.0
(read/write) 138596 138612 16 0.0
.bss 136676 136692 16 0.0
.text 791504 791832 328 0.0
lock-app BRD4161A (read only) 736896 737208 312 0.0
(read/write) 118004 118020 16 0.0
.bss 116228 116244 16 0.0
.text 736888 737200 312 0.0
window-app BRD4161A (read only) 739984 740312 328 0.0
(read/write) 118436 118452 16 0.0
.bss 116652 116668 16 0.0
.text 739976 740304 328 0.0
esp32 all-clusters-app c3devkit (read only) 836580 836850 270 0.0
(read/write) 1225258 1225290 32 0.0
.dram0.bss 59608 59616 8 0.0
.flash.rodata 166400 166432 32 0.0
.flash.text 836580 836850 270 0.0
m5stack (read only) 908587 908823 236 0.0
(read/write) 424484 424524 40 0.0
.dram0.bss 65000 65008 8 0.0
.flash.rodata 194244 194276 32 0.0
.flash.text 903203 903439 236 0.0
k32w lighting-app k32w061+se05x+release (read/write) 724356 724556 200 0.0
.bss 78756 78764 8 0.0
.text 637956 638148 192 0.0
lock-app k32w061+debug (read/write) 613348 613564 216 0.0
.bss 69204 69212 8 0.0
.text 536536 536744 208 0.0
shell k32w061+debug (read/write) 679128 679352 224 0.0
.bss 80780 80796 16 0.0
.text 590768 590976 208 0.0
linux all-clusters-app debug (read only) 1779889 1780337 448 0.0
(read/write) 131960 132024 64 0.0
.data.rel.ro 64928 64976 48 0.1
.rodata 139957 140085 128 0.1
.text 1500914 1501090 176 0.0
bridge-app debug+rpc (read only) 1353061 1353493 432 0.0
(read/write) 78400 78432 32 0.0
.data.rel.ro 29384 29432 48 0.2
.rodata 113820 113948 128 0.1
.text 1139125 1139285 160 0.0
chip-tool debug (read only) 6136757 6137205 448 0.0
(read/write) 199576 199640 64 0.0
.data.rel.ro 152336 152384 48 0.0
.rodata 294344 294472 128 0.0
.text 5452261 5452437 176 0.0
lighting-app debug+rpc (read only) 1633129 1633577 448 0.0
(read/write) 111520 111584 64 0.1
.data.rel.ro 56976 57024 48 0.1
.rodata 132305 132433 128 0.1
.text 1363010 1363186 176 0.0
ota-provider-app debug (read only) 1313409 1313857 448 0.0
(read/write) 76856 76920 64 0.1
.data.rel.ro 25944 25992 48 0.2
.rodata 114960 115088 128 0.1
.text 1098098 1098274 176 0.0
ota-requestor-app debug (read only) 1413425 1413873 448 0.0
(read/write) 80752 80784 32 0.0
.data.rel.ro 27640 27688 48 0.2
.rodata 126816 126944 128 0.1
.text 1182818 1182994 176 0.0
shell debug (read only) 821761 822193 432 0.1
(read/write) 67288 67352 64 0.1
.data.rel.ro 38560 38608 48 0.1
.rodata 79218 79314 96 0.1
.text 635858 636050 192 0.0
tv-app debug (read only) 1927729 1928193 464 0.0
(read/write) 321152 321216 64 0.0
.data.rel.ro 61608 61656 48 0.1
.rodata 161448 161608 160 0.1
.text 1617842 1618002 160 0.0
mbed all-clusters-app CY8CPROTO_062_4343W+release (read/write) 2296160 2296192 32 0.0
.text 1258760 1258792 32 0.0
lighting-app CY8CPROTO_062_4343W+release (read/write) 2281096 2281128 32 0.0
.text 1243696 1243728 32 0.0
lock-app CY8CPROTO_062_4343W+release (read/write) 2254192 2254224 32 0.0
.text 1216792 1216824 32 0.0
pigweed-app CY8CPROTO_062_4343W+release (read/write) 1139744 1139760 16 0.0
.text 103128 103144 16 0.0
shell CY8CPROTO_062_4343W+release (read/write) 2051232 2051248 16 0.0
.text 1013832 1013848 16 0.0
nrfconnect lighting-app nrf52840dk_nrf52840 (read/write) 876639 876671 32 0.0
rodata 97344 97376 32 0.0
nrf52840dk_nrf52840+rpc (read/write) 839087 839119 32 0.0
rodata 88608 88640 32 0.0
nrf5340dk_nrf5340_cpuapp (read/write) 801674 801706 32 0.0
rodata 92604 92636 32 0.0
lock-app nrf52840dk_nrf52840 (read/write) 847467 847499 32 0.0
rodata 93084 93116 32 0.0
nrf5340dk_nrf5340_cpuapp (read/write) 772738 772770 32 0.0
rodata 88372 88404 32 0.0
pump-app nrf52840dk_nrf52840 (read/write) 853479 853511 32 0.0
rodata 94816 94848 32 0.0
pump-controller-app nrf52840dk_nrf52840 (read/write) 846559 846575 16 0.0
rodata 92952 92984 32 0.0
shell nrf52840dk_nrf52840 (read/write) 779043 779055 12 0.0
rodata 73192 73204 12 0.0
text 521724 521732 8 0.0
nrf5340dk_nrf5340_cpuapp (read/write) 694058 694070 12 0.0
rodata 67836 67848 12 0.0
text 442332 442340 8 0.0
p6 all-clusters-app default (read/write) 2317928 2318024 96 0.0
.text 1276192 1276288 96 0.0
lock-app default (read/write) 2229400 2229496 96 0.0
.text 1187664 1187760 96 0.0
qpg lighting-app qpg6100+debug (read only) 496712 496912 200 0.0
.bss 79640 79656 16 0.0
.text 491392 491592 200 0.0
lock-app qpg6100+debug (read only) 469316 469508 192 0.0
.bss 78552 78568 16 0.0
.text 463996 464188 192 0.0
persistent-storage-app qpg6100+debug (read only) 108076 108264 188 0.2
.bss 36864 36872 8 0.0
.text 102756 102944 188 0.2
telink lighting-app tlsr9518adk80d (read/write) 778454 778494 40 0.0
text 541270 541276 6 0.0
Decreases (4 builds for nrfconnect)
platform target config section 46fbb06 9ec5bd38 change % change
nrfconnect lighting-app nrf5340dk_nrf5340_cpuapp text 520076 520072 -4 -0.0
lock-app nrf5340dk_nrf5340_cpuapp text 498420 498416 -4 -0.0
pump-app nrf52840dk_nrf52840 text 572940 572936 -4 -0.0
pump-controller-app nrf52840dk_nrf52840 text 568000 567996 -4 -0.0
Full report (38 builds for efr32, esp32, k32w, linux, mbed, nrfconnect, p6, qpg, telink)
platform target config section 46fbb06 9ec5bd38 change % change
efr32 lighting-app BRD4161A (read only) 763016 763336 320 0.0
(read/write) 120300 120316 16 0.0
.bss 118476 118492 16 0.0
.data 1820 1820 0 0.0
.text 763008 763328 320 0.0
BRD4161A+rpc (read only) 791512 791840 328 0.0
(read/write) 138596 138612 16 0.0
.bss 136676 136692 16 0.0
.data 1920 1920 0 0.0
.text 791504 791832 328 0.0
lock-app BRD4161A (read only) 736896 737208 312 0.0
(read/write) 118004 118020 16 0.0
.bss 116228 116244 16 0.0
.data 1776 1776 0 0.0
.text 736888 737200 312 0.0
window-app BRD4161A (read only) 739984 740312 328 0.0
(read/write) 118436 118452 16 0.0
.bss 116652 116668 16 0.0
.data 1784 1784 0 0.0
.text 739976 740304 328 0.0
esp32 all-clusters-app c3devkit (read only) 836580 836850 270 0.0
(read/write) 1225258 1225290 32 0.0
.dram0.bss 59608 59616 8 0.0
.dram0.data 13988 13988 0 0.0
.flash.rodata 166400 166432 32 0.0
.flash.text 836580 836850 270 0.0
.iram0.text 61390 61390 0 0.0
m5stack (read only) 908587 908823 236 0.0
(read/write) 424484 424524 40 0.0
.dram0.bss 65000 65008 8 0.0
.dram0.data 33960 33960 0 0.0
.flash.rodata 194244 194276 32 0.0
.flash.text 903203 903439 236 0.0
.iram0.text 122943 122943 0 0.0
k32w lighting-app k32w061+se05x+release (read/write) 724356 724556 200 0.0
.bss 78756 78764 8 0.0
.data 1844 1844 0 0.0
.text 637956 638148 192 0.0
lock-app k32w061+debug (read/write) 613348 613564 216 0.0
.bss 69204 69212 8 0.0
.data 1808 1808 0 0.0
.text 536536 536744 208 0.0
shell k32w061+debug (read/write) 679128 679352 224 0.0
.bss 80780 80796 16 0.0
.data 1780 1780 0 0.0
.text 590768 590976 208 0.0
linux all-clusters-app debug (read only) 1779889 1780337 448 0.0
(read/write) 131960 132024 64 0.0
.bss 60688 60688 0 0.0
.data 1040 1040 0 0.0
.data.rel.ro 64928 64976 48 0.1
.dynamic 592 592 0 0.0
.got 4112 4112 0 0.0
.init 27 27 0 0.0
.init_array 576 576 0 0.0
.rodata 139957 140085 128 0.1
.text 1500914 1501090 176 0.0
bridge-app debug+rpc (read only) 1353061 1353493 432 0.0
(read/write) 78400 78432 32 0.0
.bss 42288 42288 0 0.0
.data 1680 1680 0 0.0
.data.rel.ro 29384 29432 48 0.2
.dynamic 592 592 0 0.0
.got 3984 3984 0 0.0
.init 27 27 0 0.0
.init_array 424 424 0 0.0
.rodata 113820 113948 128 0.1
.text 1139125 1139285 160 0.0
chip-tool debug (read only) 6136757 6137205 448 0.0
(read/write) 199576 199640 64 0.0
.bss 40640 40640 0 0.0
.data 1008 1008 0 0.0
.data.rel.ro 152336 152384 48 0.0
.dynamic 592 592 0 0.0
.got 4472 4472 0 0.0
.init 27 27 0 0.0
.init_array 496 496 0 0.0
.rodata 294344 294472 128 0.0
.text 5452261 5452437 176 0.0
lighting-app debug+rpc (read only) 1633129 1633577 448 0.0
(read/write) 111520 111584 64 0.1
.bss 47984 47984 0 0.0
.data 1232 1232 0 0.0
.data.rel.ro 56976 57024 48 0.1
.dynamic 608 608 0 0.0
.got 4136 4136 0 0.0
.init 27 27 0 0.0
.init_array 552 552 0 0.0
.rodata 132305 132433 128 0.1
.text 1363010 1363186 176 0.0
ota-provider-app debug (read only) 1313409 1313857 448 0.0
(read/write) 76856 76920 64 0.1
.bss 44864 44864 0 0.0
.data 912 912 0 0.0
.data.rel.ro 25944 25992 48 0.2
.dynamic 592 592 0 0.0
.got 4048 4048 0 0.0
.init 27 27 0 0.0
.init_array 464 464 0 0.0
.rodata 114960 115088 128 0.1
.text 1098098 1098274 176 0.0
ota-requestor-app debug (read only) 1413425 1413873 448 0.0
(read/write) 80752 80784 32 0.0
.bss 46976 46976 0 0.0
.data 976 976 0 0.0
.data.rel.ro 27640 27688 48 0.2
.dynamic 592 592 0 0.0
.got 4032 4032 0 0.0
.init 27 27 0 0.0
.init_array 488 488 0 0.0
.rodata 126816 126944 128 0.1
.text 1182818 1182994 176 0.0
shell debug (read only) 821761 822193 432 0.1
(read/write) 67288 67352 64 0.1
.bss 23976 23976 0 0.0
.data 224 224 0 0.0
.data.rel.ro 38560 38608 48 0.1
.dynamic 592 592 0 0.0
.got 3560 3560 0 0.0
.init 27 27 0 0.0
.init_array 360 360 0 0.0
.rodata 79218 79314 96 0.1
.text 635858 636050 192 0.0
tv-app debug (read only) 1927729 1928193 464 0.0
(read/write) 321152 321216 64 0.0
.bss 252376 252376 0 0.0
.data 1504 1504 0 0.0
.data.rel.ro 61608 61656 48 0.1
.dynamic 592 592 0 0.0
.got 4424 4424 0 0.0
.init 27 27 0 0.0
.init_array 640 640 0 0.0
.rodata 161448 161608 160 0.1
.text 1617842 1618002 160 0.0
mbed all-clusters-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2296160 2296192 32 0.0
.bss 182348 182348 0 0.0
.data 5128 5128 0 0.0
.heap 848968 848968 0 0.0
.text 1258760 1258792 32 0.0
lighting-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2281096 2281128 32 0.0
.bss 172956 172956 0 0.0
.data 5488 5488 0 0.0
.heap 858000 858000 0 0.0
.text 1243696 1243728 32 0.0
lock-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2254192 2254224 32 0.0
.bss 171772 171772 0 0.0
.data 5472 5472 0 0.0
.heap 859200 859200 0 0.0
.text 1216792 1216824 32 0.0
pigweed-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 1139744 1139760 16 0.0
.bss 11752 11752 0 0.0
.data 4368 4368 0 0.0
.heap 1020328 1020328 0 0.0
.text 103128 103144 16 0.0
shell CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2051232 2051248 16 0.0
.bss 156920 156920 0 0.0
.data 4872 4872 0 0.0
.heap 874656 874656 0 0.0
.text 1013832 1013848 16 0.0
nrfconnect lighting-app nrf52840dk_nrf52840 (read/write) 876639 876671 32 0.0
bss 113124 113124 0 0.0
rodata 97344 97376 32 0.0
text 590620 590620 0 0.0
nrf52840dk_nrf52840+rpc (read/write) 839087 839119 32 0.0
bss 109476 109476 0 0.0
rodata 88608 88640 32 0.0
text 564788 564788 0 0.0
nrf5340dk_nrf5340_cpuapp (read/write) 801674 801706 32 0.0
bss 114500 114500 0 0.0
rodata 92604 92636 32 0.0
text 520076 520072 -4 -0.0
lock-app nrf52840dk_nrf52840 (read/write) 847467 847499 32 0.0
bss 110164 110164 0 0.0
rodata 93084 93116 32 0.0
text 568872 568872 0 0.0
nrf5340dk_nrf5340_cpuapp (read/write) 772738 772770 32 0.0
bss 111572 111572 0 0.0
rodata 88372 88404 32 0.0
text 498420 498416 -4 -0.0
pigweed-app nrf52840dk_nrf52840 (read/write) 497327 497327 0 0.0
bss 51824 51824 0 0.0
rodata 45780 45780 0 0.0
text 339436 339436 0 0.0
pump-app nrf52840dk_nrf52840 (read/write) 853479 853511 32 0.0
bss 110300 110300 0 0.0
rodata 94816 94848 32 0.0
text 572940 572936 -4 -0.0
pump-controller-app nrf52840dk_nrf52840 (read/write) 846559 846575 16 0.0
bss 110176 110176 0 0.0
rodata 92952 92984 32 0.0
text 568000 567996 -4 -0.0
shell nrf52840dk_nrf52840 (read/write) 779043 779055 12 0.0
bss 109604 109604 0 0.0
rodata 73192 73204 12 0.0
text 521724 521732 8 0.0
nrf5340dk_nrf5340_cpuapp (read/write) 694058 694070 12 0.0
bss 110588 110588 0 0.0
rodata 67836 67848 12 0.0
text 442332 442340 8 0.0
p6 all-clusters-app default (read/write) 2317928 2318024 96 0.0
.bss 115256 115256 0 0.0
.data 2424 2424 0 0.0
.heap 915664 915664 0 0.0
.text 1276192 1276288 96 0.0
lock-app default (read/write) 2229400 2229496 96 0.0
.bss 101552 101552 0 0.0
.data 2288 2288 0 0.0
.heap 929504 929504 0 0.0
.text 1187664 1187760 96 0.0
qpg lighting-app qpg6100+debug (read only) 496712 496912 200 0.0
(read/write) 114144 114144 0 0.0
.bss 79640 79656 16 0.0
.data 944 944 0 0.0
.text 491392 491592 200 0.0
lock-app qpg6100+debug (read only) 469316 469508 192 0.0
(read/write) 114144 114144 0 0.0
.bss 78552 78568 16 0.0
.data 896 896 0 0.0
.text 463996 464188 192 0.0
persistent-storage-app qpg6100+debug (read only) 108076 108264 188 0.2
(read/write) 114144 114144 0 0.0
.bss 36864 36872 8 0.0
.data 296 296 0 0.0
.text 102756 102944 188 0.2
telink lighting-app tlsr9518adk80d (read/write) 778454 778494 40 0.0
bss 79700 79700 0 0.0
noinit 37160 37160 0 0.0
text 541270 541276 6 0.0

@yunhanw-google
Copy link
Contributor Author

Per discussion with @woody-apple , would file several tickets on epoch timestamp for different platform

This was referenced Dec 1, 2021
@woody-apple woody-apple self-requested a review December 1, 2021 19:07
@woody-apple woody-apple merged commit 7b7374a into project-chip:master Dec 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants