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

Streamline ObjectPool in System::Timer #12628

Merged

Conversation

kpschoedel
Copy link
Contributor

Problem

After the unification of the former system/SystemObject.h
with support/Pool.h, there is an opportunity to simplify
System::Timer.

Change overview

  • Clean up use of ObjectPool, with a TimerPool wrapper.
  • Fix some #includes formerly indirectly included by SystemTimer.h

Testing

CI; no changes to external functionality.

#### Problem

After the unification of the former `system/SystemObject.h`
with `support/Pool.h`, there is an opportunity to simplify
`System::Timer`.

#### Change overview

- Clean up use of `ObjectPool`, with a `TimerPool` wrapper.
- Fix some #includes formerly indirectly included by `SystemTimer.h`

#### Testing

CI; no changes to external functionality.
@github-actions
Copy link

github-actions bot commented Dec 6, 2021

PR #12628: Size comparison from f350919 to 6178b4b

Increases (9 builds for mbed, p6, qpg)
platform target config section f350919 6178b4b change % change
mbed all-clusters-app CY8CPROTO_062_4343W+release .heap 851856 852024 168 0.0
lighting-app CY8CPROTO_062_4343W+release .heap 857648 857816 168 0.0
lock-app CY8CPROTO_062_4343W+release .heap 858608 858776 168 0.0
shell CY8CPROTO_062_4343W+release .heap 874840 875016 176 0.0
p6 all-clusters-app default .heap 923280 923504 224 0.0
light-app default .heap 932472 932696 224 0.0
lock-app default .heap 933632 933848 216 0.0
qpg lighting-app qpg6100+debug (read/write) 122332 122336 4 0.0
persistent-storage-app qpg6100+debug (read/write) 122332 122336 4 0.0
Decreases (37 builds for efr32, esp32, k32w, linux, mbed, nrfconnect, p6, qpg, telink)
platform target config section f350919 6178b4b change % change
efr32 lighting-app BRD4161A (read only) 798568 798128 -440 -0.1
(read/write) 120648 120424 -224 -0.2
.bss 118816 118600 -216 -0.2
.data 1828 1824 -4 -0.2
.text 798560 798120 -440 -0.1
BRD4161A+rpc (read only) 826536 826080 -456 -0.1
(read/write) 138952 138736 -216 -0.2
.bss 137016 136800 -216 -0.2
.data 1936 1932 -4 -0.2
.text 826528 826072 -456 -0.1
lock-app BRD4161A (read only) 773636 773180 -456 -0.1
(read/write) 118580 118360 -220 -0.2
.bss 116792 116576 -216 -0.2
.data 1788 1784 -4 -0.2
.text 773628 773172 -456 -0.1
window-app BRD4161A (read only) 775892 775436 -456 -0.1
(read/write) 118784 118564 -220 -0.2
.bss 116992 116776 -216 -0.2
.data 1792 1788 -4 -0.2
.text 775884 775428 -456 -0.1
esp32 all-clusters-app c3devkit (read only) 852314 852000 -314 -0.0
(read/write) 1290914 1290538 -376 -0.0
.dram0.bss 56352 56008 -344 -0.6
.flash.rodata 169520 169480 -40 -0.0
.flash.text 852314 852000 -314 -0.0
.iram0.text 61394 61346 -48 -0.1
m5stack (read only) 922223 921995 -228 -0.0
(read/write) 424356 423956 -400 -0.1
.dram0.bss 61736 61384 -352 -0.6
.flash.rodata 197324 197276 -48 -0.0
.flash.text 916839 916611 -228 -0.0
k32w lighting-app k32w061+se05x+release (read/write) 731812 731320 -492 -0.1
.bss 79312 79184 -128 -0.2
.data 1860 1856 -4 -0.2
.text 644840 644480 -360 -0.1
lock-app k32w061+debug (read/write) 621980 621488 -492 -0.1
.bss 69976 69848 -128 -0.2
.data 1828 1824 -4 -0.2
.text 544376 544016 -360 -0.1
shell k32w061+debug (read/write) 687872 687360 -512 -0.1
.bss 81624 81492 -132 -0.2
.data 1800 1796 -4 -0.2
.text 598648 598272 -376 -0.1
linux all-clusters-app debug (read only) 1872649 1871969 -680 -0.0
(read/write) 124336 124264 -72 -0.1
.bss 50672 50608 -64 -0.1
.init_array 696 688 -8 -1.1
.rodata 152245 152181 -64 -0.0
.text 1577298 1576706 -592 -0.0
bridge-app debug+rpc (read only) 1444117 1443397 -720 -0.0
(read/write) 74648 74576 -72 -0.1
.bss 36272 36208 -64 -0.2
.init_array 480 472 -8 -1.7
.rodata 121628 121540 -88 -0.1
.text 1217589 1216981 -608 -0.0
chip-tool debug (read only) 6638421 6637725 -696 -0.0
(read/write) 199752 199680 -72 -0.0
.bss 34536 34472 -64 -0.2
.init_array 568 560 -8 -1.4
.rodata 311544 311464 -80 -0.0
.text 5922149 5921557 -592 -0.0
lighting-app debug+rpc (read only) 1729265 1728553 -712 -0.0
(read/write) 107680 107608 -72 -0.1
.bss 41968 41904 -64 -0.2
.init_array 616 608 -8 -1.3
.rodata 142289 142193 -96 -0.1
.text 1444306 1443714 -592 -0.0
ota-provider-app debug (read only) 1400777 1400097 -680 -0.0
(read/write) 72848 72776 -72 -0.1
.bss 38848 38784 -64 -0.2
.init_array 520 512 -8 -1.5
.rodata 122984 122920 -64 -0.1
.text 1173106 1172514 -592 -0.1
ota-requestor-app debug (read only) 1510033 1509353 -680 -0.0
(read/write) 77896 77824 -72 -0.1
.bss 42016 41952 -64 -0.2
.init_array 544 536 -8 -1.5
.rodata 135728 135664 -64 -0.0
.text 1265666 1265074 -592 -0.0
shell debug (read only) 823449 822657 -792 -0.1
(read/write) 60616 60544 -72 -0.1
.bss 16936 16872 -64 -0.4
.init_array 344 336 -8 -2.3
.rodata 84658 84594 -64 -0.1
.text 631954 631250 -704 -0.1
tv-app debug (read only) 2046297 2045577 -720 -0.0
(read/write) 320032 319960 -72 -0.0
.bss 247288 247224 -64 -0.0
.init_array 736 728 -8 -1.1
.rodata 174480 174392 -88 -0.1
.text 1717074 1716466 -608 -0.0
mbed all-clusters-app CY8CPROTO_062_4343W+release (read/write) 2313024 2312664 -360 -0.0
.bss 179404 179236 -168 -0.1
.text 1275600 1275240 -360 -0.0
lighting-app CY8CPROTO_062_4343W+release (read/write) 2298968 2298608 -360 -0.0
.bss 173304 173136 -168 -0.1
.text 1261568 1261208 -360 -0.0
lock-app CY8CPROTO_062_4343W+release (read/write) 2272960 2272600 -360 -0.0
.bss 172344 172176 -168 -0.1
.text 1235560 1235200 -360 -0.0
shell CY8CPROTO_062_4343W+release (read/write) 2047472 2047112 -360 -0.0
.bss 156732 156564 -168 -0.1
.data 4872 4864 -8 -0.2
.text 1010072 1009712 -360 -0.0
nrfconnect lighting-app nrf52840dk_nrf52840 (read/write) 894783 894307 -476 -0.1
bss 113756 113608 -148 -0.1
rodata 99680 99636 -44 -0.0
text 605796 605504 -292 -0.0
nrf52840dk_nrf52840+rpc (read/write) 858159 857683 -476 -0.1
bss 110104 109956 -148 -0.1
rodata 91040 90996 -44 -0.0
text 580792 580500 -292 -0.1
nrf5340dk_nrf5340_cpuapp (read/write) 820678 820238 -440 -0.1
bss 115128 114984 -144 -0.1
rodata 94936 94896 -40 -0.0
text 536128 535852 -276 -0.1
lock-app nrf52840dk_nrf52840 (read/write) 866803 866315 -488 -0.1
bss 111016 110872 -144 -0.1
rodata 95796 95756 -40 -0.0
text 584604 584316 -288 -0.0
nrf5340dk_nrf5340_cpuapp (read/write) 792938 792466 -472 -0.1
bss 112428 112280 -148 -0.1
rodata 91084 91044 -40 -0.0
text 515028 514752 -276 -0.1
pump-app nrf52840dk_nrf52840 (read/write) 871587 871099 -488 -0.1
bss 110928 110784 -144 -0.1
rodata 97148 97108 -40 -0.0
text 588052 587764 -288 -0.0
pump-controller-app nrf52840dk_nrf52840 (read/write) 864831 864371 -460 -0.1
bss 110808 110660 -148 -0.1
rodata 95288 95244 -44 -0.0
text 583284 582996 -288 -0.0
shell nrf52840dk_nrf52840 (read/write) 779939 779463 -476 -0.1
bss 109696 109552 -144 -0.1
rodata 73792 73748 -44 -0.1
text 521948 521656 -292 -0.1
nrf5340dk_nrf5340_cpuapp (read/write) 694966 694510 -456 -0.1
bss 110680 110532 -148 -0.1
rodata 68432 68392 -40 -0.1
text 442548 442272 -276 -0.1
p6 all-clusters-app default (read/write) 2349264 2348896 -368 -0.0
.bss 107596 107380 -216 -0.2
.data 2464 2456 -8 -0.3
.text 1307528 1307160 -368 -0.0
light-app default (read/write) 2283888 2283528 -360 -0.0
.bss 98536 98320 -216 -0.2
.data 2336 2328 -8 -0.3
.text 1242152 1241792 -360 -0.0
lock-app default (read/write) 2260424 2260056 -368 -0.0
.bss 97416 97200 -216 -0.2
.text 1218688 1218320 -368 -0.0
qpg lighting-app qpg6100+debug (read only) 513612 513132 -480 -0.1
.bss 80272 80056 -216 -0.3
.data 964 960 -4 -0.4
.text 508292 507812 -480 -0.1
lock-app qpg6100+debug (read only) 487352 486872 -480 -0.1
(read/write) 122336 122332 -4 -0.0
.bss 79408 79192 -216 -0.3
.data 920 916 -4 -0.4
.text 482032 481552 -480 -0.1
persistent-storage-app qpg6100+debug (read only) 108224 108104 -120 -0.1
.bss 36696 36152 -544 -1.5
.data 292 288 -4 -1.4
.text 102904 102784 -120 -0.1
telink lighting-app tlsr9518adk80d (read/write) 798158 797602 -556 -0.1
bss 80332 80188 -144 -0.2
text 557858 557498 -360 -0.1
Full report (39 builds for efr32, esp32, k32w, linux, mbed, nrfconnect, p6, qpg, telink)
platform target config section f350919 6178b4b change % change
efr32 lighting-app BRD4161A (read only) 798568 798128 -440 -0.1
(read/write) 120648 120424 -224 -0.2
.bss 118816 118600 -216 -0.2
.data 1828 1824 -4 -0.2
.text 798560 798120 -440 -0.1
BRD4161A+rpc (read only) 826536 826080 -456 -0.1
(read/write) 138952 138736 -216 -0.2
.bss 137016 136800 -216 -0.2
.data 1936 1932 -4 -0.2
.text 826528 826072 -456 -0.1
lock-app BRD4161A (read only) 773636 773180 -456 -0.1
(read/write) 118580 118360 -220 -0.2
.bss 116792 116576 -216 -0.2
.data 1788 1784 -4 -0.2
.text 773628 773172 -456 -0.1
window-app BRD4161A (read only) 775892 775436 -456 -0.1
(read/write) 118784 118564 -220 -0.2
.bss 116992 116776 -216 -0.2
.data 1792 1788 -4 -0.2
.text 775884 775428 -456 -0.1
esp32 all-clusters-app c3devkit (read only) 852314 852000 -314 -0.0
(read/write) 1290914 1290538 -376 -0.0
.dram0.bss 56352 56008 -344 -0.6
.dram0.data 14052 14052 0 0.0
.flash.rodata 169520 169480 -40 -0.0
.flash.text 852314 852000 -314 -0.0
.iram0.text 61394 61346 -48 -0.1
m5stack (read only) 922223 921995 -228 -0.0
(read/write) 424356 423956 -400 -0.1
.dram0.bss 61736 61384 -352 -0.6
.dram0.data 34016 34016 0 0.0
.flash.rodata 197324 197276 -48 -0.0
.flash.text 916839 916611 -228 -0.0
.iram0.text 122943 122943 0 0.0
k32w lighting-app k32w061+se05x+release (read/write) 731812 731320 -492 -0.1
.bss 79312 79184 -128 -0.2
.data 1860 1856 -4 -0.2
.text 644840 644480 -360 -0.1
lock-app k32w061+debug (read/write) 621980 621488 -492 -0.1
.bss 69976 69848 -128 -0.2
.data 1828 1824 -4 -0.2
.text 544376 544016 -360 -0.1
shell k32w061+debug (read/write) 687872 687360 -512 -0.1
.bss 81624 81492 -132 -0.2
.data 1800 1796 -4 -0.2
.text 598648 598272 -376 -0.1
linux all-clusters-app debug (read only) 1872649 1871969 -680 -0.0
(read/write) 124336 124264 -72 -0.1
.bss 50672 50608 -64 -0.1
.data 1120 1120 0 0.0
.data.rel.ro 67104 67104 0 0.0
.dynamic 592 592 0 0.0
.got 4120 4120 0 0.0
.init 27 27 0 0.0
.init_array 696 688 -8 -1.1
.rodata 152245 152181 -64 -0.0
.text 1577298 1576706 -592 -0.0
bridge-app debug+rpc (read only) 1444117 1443397 -720 -0.0
(read/write) 74648 74576 -72 -0.1
.bss 36272 36208 -64 -0.2
.data 1728 1728 0 0.0
.data.rel.ro 31560 31560 0 0.0
.dynamic 592 592 0 0.0
.got 3992 3992 0 0.0
.init 27 27 0 0.0
.init_array 480 472 -8 -1.7
.rodata 121628 121540 -88 -0.1
.text 1217589 1216981 -608 -0.0
chip-tool debug (read only) 6638421 6637725 -696 -0.0
(read/write) 199752 199680 -72 -0.0
.bss 34536 34472 -64 -0.2
.data 1024 1024 0 0.0
.data.rel.ro 158520 158520 0 0.0
.dynamic 592 592 0 0.0
.got 4496 4496 0 0.0
.init 27 27 0 0.0
.init_array 568 560 -8 -1.4
.rodata 311544 311464 -80 -0.0
.text 5922149 5921557 -592 -0.0
lighting-app debug+rpc (read only) 1729265 1728553 -712 -0.0
(read/write) 107680 107608 -72 -0.1
.bss 41968 41904 -64 -0.2
.data 1280 1280 0 0.0
.data.rel.ro 59056 59056 0 0.0
.dynamic 608 608 0 0.0
.got 4144 4144 0 0.0
.init 27 27 0 0.0
.init_array 616 608 -8 -1.3
.rodata 142289 142193 -96 -0.1
.text 1444306 1443714 -592 -0.0
ota-provider-app debug (read only) 1400777 1400097 -680 -0.0
(read/write) 72848 72776 -72 -0.1
.bss 38848 38784 -64 -0.2
.data 928 928 0 0.0
.data.rel.ro 27880 27880 0 0.0
.dynamic 592 592 0 0.0
.got 4056 4056 0 0.0
.init 27 27 0 0.0
.init_array 520 512 -8 -1.5
.rodata 122984 122920 -64 -0.1
.text 1173106 1172514 -592 -0.1
ota-requestor-app debug (read only) 1510033 1509353 -680 -0.0
(read/write) 77896 77824 -72 -0.1
.bss 42016 41952 -64 -0.2
.data 992 992 0 0.0
.data.rel.ro 29656 29656 0 0.0
.dynamic 592 592 0 0.0
.got 4064 4064 0 0.0
.init 27 27 0 0.0
.init_array 544 536 -8 -1.5
.rodata 135728 135664 -64 -0.0
.text 1265666 1265074 -592 -0.0
shell debug (read only) 823449 822657 -792 -0.1
(read/write) 60616 60544 -72 -0.1
.bss 16936 16872 -64 -0.4
.data 256 256 0 0.0
.data.rel.ro 38936 38936 0 0.0
.dynamic 592 592 0 0.0
.got 3520 3520 0 0.0
.init 27 27 0 0.0
.init_array 344 336 -8 -2.3
.rodata 84658 84594 -64 -0.1
.text 631954 631250 -704 -0.1
tv-app debug (read only) 2046297 2045577 -720 -0.0
(read/write) 320032 319960 -72 -0.0
.bss 247288 247224 -64 -0.0
.data 2768 2768 0 0.0
.data.rel.ro 64168 64168 0 0.0
.dynamic 592 592 0 0.0
.got 4456 4456 0 0.0
.init 27 27 0 0.0
.init_array 736 728 -8 -1.1
.rodata 174480 174392 -88 -0.1
.text 1717074 1716466 -608 -0.0
mbed all-clusters-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2313024 2312664 -360 -0.0
.bss 179404 179236 -168 -0.1
.data 5184 5184 0 0.0
.heap 851856 852024 168 0.0
.text 1275600 1275240 -360 -0.0
lighting-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2298968 2298608 -360 -0.0
.bss 173304 173136 -168 -0.1
.data 5496 5496 0 0.0
.heap 857648 857816 168 0.0
.text 1261568 1261208 -360 -0.0
lock-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2272960 2272600 -360 -0.0
.bss 172344 172176 -168 -0.1
.data 5496 5496 0 0.0
.heap 858608 858776 168 0.0
.text 1235560 1235200 -360 -0.0
pigweed-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 1140008 1140008 0 0.0
.bss 11756 11756 0 0.0
.data 4376 4376 0 0.0
.heap 1020312 1020312 0 0.0
.text 103392 103392 0 0.0
shell CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2047472 2047112 -360 -0.0
.bss 156732 156564 -168 -0.1
.data 4872 4864 -8 -0.2
.heap 874840 875016 176 0.0
.text 1010072 1009712 -360 -0.0
nrfconnect lighting-app nrf52840dk_nrf52840 (read/write) 894783 894307 -476 -0.1
bss 113756 113608 -148 -0.1
rodata 99680 99636 -44 -0.0
text 605796 605504 -292 -0.0
nrf52840dk_nrf52840+rpc (read/write) 858159 857683 -476 -0.1
bss 110104 109956 -148 -0.1
rodata 91040 90996 -44 -0.0
text 580792 580500 -292 -0.1
nrf5340dk_nrf5340_cpuapp (read/write) 820678 820238 -440 -0.1
bss 115128 114984 -144 -0.1
rodata 94936 94896 -40 -0.0
text 536128 535852 -276 -0.1
lock-app nrf52840dk_nrf52840 (read/write) 866803 866315 -488 -0.1
bss 111016 110872 -144 -0.1
rodata 95796 95756 -40 -0.0
text 584604 584316 -288 -0.0
nrf5340dk_nrf5340_cpuapp (read/write) 792938 792466 -472 -0.1
bss 112428 112280 -148 -0.1
rodata 91084 91044 -40 -0.0
text 515028 514752 -276 -0.1
pigweed-app nrf52840dk_nrf52840 (read/write) 497463 497463 0 0.0
bss 51820 51820 0 0.0
rodata 45852 45852 0 0.0
text 339492 339492 0 0.0
pump-app nrf52840dk_nrf52840 (read/write) 871587 871099 -488 -0.1
bss 110928 110784 -144 -0.1
rodata 97148 97108 -40 -0.0
text 588052 587764 -288 -0.0
pump-controller-app nrf52840dk_nrf52840 (read/write) 864831 864371 -460 -0.1
bss 110808 110660 -148 -0.1
rodata 95288 95244 -44 -0.0
text 583284 582996 -288 -0.0
shell nrf52840dk_nrf52840 (read/write) 779939 779463 -476 -0.1
bss 109696 109552 -144 -0.1
rodata 73792 73748 -44 -0.1
text 521948 521656 -292 -0.1
nrf5340dk_nrf5340_cpuapp (read/write) 694966 694510 -456 -0.1
bss 110680 110532 -148 -0.1
rodata 68432 68392 -40 -0.1
text 442548 442272 -276 -0.1
p6 all-clusters-app default (read/write) 2349264 2348896 -368 -0.0
.bss 107596 107380 -216 -0.2
.data 2464 2456 -8 -0.3
.heap 923280 923504 224 0.0
.text 1307528 1307160 -368 -0.0
light-app default (read/write) 2283888 2283528 -360 -0.0
.bss 98536 98320 -216 -0.2
.data 2336 2328 -8 -0.3
.heap 932472 932696 224 0.0
.text 1242152 1241792 -360 -0.0
lock-app default (read/write) 2260424 2260056 -368 -0.0
.bss 97416 97200 -216 -0.2
.data 2296 2296 0 0.0
.heap 933632 933848 216 0.0
.text 1218688 1218320 -368 -0.0
qpg lighting-app qpg6100+debug (read only) 513612 513132 -480 -0.1
(read/write) 122332 122336 4 0.0
.bss 80272 80056 -216 -0.3
.data 964 960 -4 -0.4
.text 508292 507812 -480 -0.1
lock-app qpg6100+debug (read only) 487352 486872 -480 -0.1
(read/write) 122336 122332 -4 -0.0
.bss 79408 79192 -216 -0.3
.data 920 916 -4 -0.4
.text 482032 481552 -480 -0.1
persistent-storage-app qpg6100+debug (read only) 108224 108104 -120 -0.1
(read/write) 122332 122336 4 0.0
.bss 36696 36152 -544 -1.5
.data 292 288 -4 -1.4
.text 102904 102784 -120 -0.1
telink lighting-app tlsr9518adk80d (read/write) 798158 797602 -556 -0.1
bss 80332 80188 -144 -0.2
noinit 37160 37160 0 0.0
text 557858 557498 -360 -0.1

@andy31415
Copy link
Contributor

fast track: change by domain owner, sufficient uptime for all timezone review.

@andy31415 andy31415 merged commit 51e5bfb into project-chip:master Dec 7, 2021
@kpschoedel kpschoedel deleted the x7715-pool-cleanup-timers branch December 7, 2021 15:06
kpschoedel added a commit to kpschoedel/connectedhomeip that referenced this pull request Dec 8, 2021
#### Problem

Only the higher-level `System::Layer` timer operations had tests;
the utility classes in `system/SystemTimer.h` had no unit tests,
and a recent refactor (project-chip#12628) introduced a bug that a proper unit
test would have caught.

Fixes project-chip#12729 Add unit tests for SystemTimer.h

#### Change overview

What's in this PR

- Add tests covering `TimerData`, `TimeList`, and `TimerPool`.
- Changed these helpers to take a `Timestamp` rather than a `Timeout`.
- Fixed `TimerList::Remove(Node*)` to allow an empty list or null
  argument (matching its description).

#### Testing

Quis custodiet ipsos custodes?
andy31415 pushed a commit that referenced this pull request Dec 8, 2021
#### Problem

Only the higher-level `System::Layer` timer operations had tests;
the utility classes in `system/SystemTimer.h` had no unit tests,
and a recent refactor (#12628) introduced a bug that a proper unit
test would have caught.

Fixes #12729 Add unit tests for SystemTimer.h

#### Change overview

What's in this PR

- Add tests covering `TimerData`, `TimeList`, and `TimerPool`.
- Changed these helpers to take a `Timestamp` rather than a `Timeout`.
- Fixed `TimerList::Remove(Node*)` to allow an empty list or null
  argument (matching its description).

#### Testing

Quis custodiet ipsos custodes?
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.

3 participants