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

[Darwin] Adding more metrics to capture BLE during setup #32793

Merged

Conversation

anush-apple
Copy link
Contributor

  • Added more metrics across BLE phase in Darwin
  • Fixed MetricsCollector to only capture first event of any kind
  • Reset metrics before any API is started
  • Fixed bug where duration was not being calculated correctly

- Added more metrics across BLE phase in Darwin
- Fixed MetricsCollector to only capture first event of any kind
- Reset metrics before any API is started
- Fixed bug where duration was not being calculated correctly
Copy link

github-actions bot commented Mar 29, 2024

PR #32793: Size comparison from 6ed5dd3 to 494a72f

Decreases (1 build for efr32)
platform target config section 6ed5dd3 494a72f change % change
efr32 lock-app BRD4338a (read/write) 958704 958696 -8 -0.0
.text 698948 698940 -8 -0.0
Full report (71 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, k32w, linux, mbed, nrfconnect, psoc6, qpg, stm32, telink)
platform target config section 6ed5dd3 494a72f change % change
bl602 lighting-app bl602 (read/write) 1438442 1438442 0 0.0
.bss 85360 85360 0 0.0
.data 9504 9504 0 0.0
.rodata 158524 158524 0 0.0
.text 1104408 1104408 0 0.0
bl602+mfd (read/write) 1452866 1452866 0 0.0
.bss 85520 85520 0 0.0
.data 9480 9480 0 0.0
.rodata 157484 157484 0 0.0
.text 1119726 1119726 0 0.0
bl602+rpc (read/write) 1486090 1486090 0 0.0
.bss 93392 93392 0 0.0
.data 9880 9880 0 0.0
.rodata 166092 166092 0 0.0
.text 1136054 1136054 0 0.0
bl702 lighting-app bl702 (read only) 3478 3478 0 0.0
(read/write) 1203143 1203143 0 0.0
.bss 11133 11133 0 0.0
.data 3688 3688 0 0.0
.rodata 107876 107876 0 0.0
.text 973570 973570 0 0.0
bl702+mfd (read only) 3478 3478 0 0.0
(read/write) 1214211 1214211 0 0.0
.bss 11309 11309 0 0.0
.data 3664 3664 0 0.0
.rodata 106816 106816 0 0.0
.text 985580 985580 0 0.0
bl702+rpc (read only) 3478 3478 0 0.0
(read/write) 1294891 1294891 0 0.0
.bss 19613 19613 0 0.0
.data 4224 4224 0 0.0
.rodata 123248 123248 0 0.0
.text 1048534 1048534 0 0.0
bl706-eth (read/write) 1020581 1020581 0 0.0
.bss 23708 23708 0 0.0
.data 3264 3264 0 0.0
.rodata 101208 101208 0 0.0
.text 764424 764424 0 0.0
bl706-wifi (read/write) 1255218 1255218 0 0.0
.bss 10577 10577 0 0.0
.data 3696 3696 0 0.0
.rodata 122208 122208 0 0.0
.text 996308 996308 0 0.0
bl702l lighting-app bl702l (read only) 512 512 0 0.0
(read/write) 1172728 1172728 0 0.0
.bss 16328 16328 0 0.0
.data 5048 5048 0 0.0
.rodata 101880 101880 0 0.0
.text 966680 966680 0 0.0
bl702l+mfd (read only) 512 512 0 0.0
(read/write) 1184136 1184136 0 0.0
.bss 16504 16504 0 0.0
.data 5032 5032 0 0.0
.rodata 100820 100820 0 0.0
.text 979002 979002 0 0.0
cc13x4_26x4 lighting-app LP_EM_CC1354P10_6 (read only) 774788 774788 0 0.0
(read/write) 168648 168648 0 0.0
.bss 90636 90636 0 0.0
.data 3568 3568 0 0.0
.rodata 82148 82148 0 0.0
.text 692372 692372 0 0.0
lock-ftd LP_EM_CC1354P10_6 (read only) 791172 791172 0 0.0
(read/write) 178896 178896 0 0.0
.bss 100884 100884 0 0.0
.data 3568 3568 0 0.0
.rodata 76332 76332 0 0.0
.text 714572 714572 0 0.0
lock-mtd LP_EM_CC1354P10_6 (read only) 779852 779852 0 0.0
(read/write) 173336 173336 0 0.0
.bss 95324 95324 0 0.0
.data 3568 3568 0 0.0
.rodata 103084 103084 0 0.0
.text 676500 676500 0 0.0
pump-app LP_EM_CC1354P10_6 (read only) 732044 732044 0 0.0
(read/write) 167616 167616 0 0.0
.bss 89368 89368 0 0.0
.data 3560 3560 0 0.0
.rodata 77812 77812 0 0.0
.text 653964 653964 0 0.0
pump-controller-app LP_EM_CC1354P10_6 (read only) 717644 717644 0 0.0
(read/write) 167824 167824 0 0.0
.bss 89592 89592 0 0.0
.data 3552 3552 0 0.0
.rodata 73588 73588 0 0.0
.text 643788 643788 0 0.0
cc32xx air-purifier CC3235SF_LAUNCHXL (read only) 584322 584322 0 0.0
(read/write) 208000 208000 0 0.0
.bss 201228 201228 0 0.0
.data 1648 1648 0 0.0
.rodata 86938 86938 0 0.0
.text 495260 495260 0 0.0
lock CC3235SF_LAUNCHXL (read only) 629570 629570 0 0.0
(read/write) 208344 208344 0 0.0
.bss 201720 201720 0 0.0
.data 1504 1504 0 0.0
.rodata 107386 107386 0 0.0
.text 520060 520060 0 0.0
cyw30739 light cyw930739m2evb_01 (read/write) 569531 569531 0 0.0
.app_xip_area 459269 459269 0 0.0
.bss 65088 65088 0 0.0
.data 752 752 0 0.0
.rodata 0 0 0 0.0
.text 112 112 0 0.0
lock cyw930739m2evb_01 (read/write) 552171 552171 0 0.0
.app_xip_area 437149 437149 0 0.0
.bss 69840 69840 0 0.0
.data 760 760 0 0.0
.rodata 0 0 0 0.0
.text 112 112 0 0.0
ota-requestor cyw930739m2evb_01 (read/write) 572467 572467 0 0.0
.app_xip_area 463709 463709 0 0.0
.bss 63624 63624 0 0.0
.data 712 712 0 0.0
.rodata 0 0 0 0.0
.text 112 112 0 0.0
switch cyw930739m2evb_01 (read/write) 565243 565243 0 0.0
.app_xip_area 453205 453205 0 0.0
.bss 66824 66824 0 0.0
.data 792 792 0 0.0
.rodata 0 0 0 0.0
.text 112 112 0 0.0
efr32 lighting-app BRD4187C (read/write) 1111800 1111800 0 0.0
.bss 195184 195184 0 0.0
.data 3424 3424 0 0.0
.text 913172 913172 0 0.0
lock-app BRD4338a (read/write) 958704 958696 -8 -0.0
.bss 210196 210196 0 0.0
.data 30192 30192 0 0.0
.text 698948 698940 -8 -0.0
window-app BRD4187C (read/write) 1159128 1159128 0 0.0
.bss 167592 167592 0 0.0
.data 3336 3336 0 0.0
.text 988180 988180 0 0.0
esp32 all-clusters-app c3devkit (read only) 1211958 1211958 0 0.0
(read/write) 1749856 1749856 0 0.0
.dram0.bss 74328 74328 0 0.0
.dram0.data 13628 13628 0 0.0
.flash.rodata 252368 252368 0 0.0
.flash.text 1211958 1211958 0 0.0
.iram0.text 75530 75530 0 0.0
m5stack (read only) 1254051 1254051 0 0.0
(read/write) 536456 536456 0 0.0
.dram0.bss 81264 81264 0 0.0
.dram0.data 35180 35180 0 0.0
.flash.rodata 284092 284092 0 0.0
.flash.text 1247887 1247887 0 0.0
.iram0.text 125403 125403 0 0.0
k32w contact k32w0+release (read only) 605560 605560 0 0.0
(read/write) 79512 79512 0 0.0
.bss 67340 67340 0 0.0
.data 2188 2188 0 0.0
.text 605024 605024 0 0.0
k32w1+release (read only) 1024 1024 0 0.0
(read/write) 700428 700428 0 0.0
.bss 71156 71156 0 0.0
.data 2856 2856 0 0.0
.text 587032 587032 0 0.0
light k32w0+release (read only) 607520 607520 0 0.0
(read/write) 79372 79372 0 0.0
.bss 67196 67196 0 0.0
.data 2192 2192 0 0.0
.text 606984 606984 0 0.0
k32w1+release (read only) 1024 1024 0 0.0
(read/write) 791968 791968 0 0.0
.bss 80636 80636 0 0.0
.data 2056 2056 0 0.0
.text 669912 669912 0 0.0
linux air-purifier-app debug (read only) 2637901 2637901 0 0.0
(read/write) 129272 129272 0 0.0
.bss 46608 46608 0 0.0
.data 2272 2272 0 0.0
.data.rel.ro 74472 74472 0 0.0
.dynamic 608 608 0 0.0
.got 4528 4528 0 0.0
.init 27 27 0 0.0
.init_array 768 768 0 0.0
.rodata 185040 185040 0 0.0
.text 2275077 2275077 0 0.0
all-clusters-app debug (read only) 5943921 5943921 0 0.0
(read/write) 480744 480744 0 0.0
.bss 134912 134912 0 0.0
.data 4560 4560 0 0.0
.data.rel.ro 333864 333864 0 0.0
.dynamic 624 624 0 0.0
.got 5336 5336 0 0.0
.init 27 27 0 0.0
.init_array 1408 1408 0 0.0
.rodata 349776 349776 0 0.0
.text 5160563 5160563 0 0.0
all-clusters-minimal-app debug (read only) 5224785 5224785 0 0.0
(read/write) 236696 236696 0 0.0
.bss 127744 127744 0 0.0
.data 4464 4464 0 0.0
.data.rel.ro 97448 97448 0 0.0
.dynamic 624 624 0 0.0
.got 5256 5256 0 0.0
.init 27 27 0 0.0
.init_array 1136 1136 0 0.0
.rodata 288842 288842 0 0.0
.text 4701027 4701027 0 0.0
bridge-app debug (read only) 4619169 4619169 0 0.0
(read/write) 217576 217576 0 0.0
.bss 118272 118272 0 0.0
.data 6240 6240 0 0.0
.data.rel.ro 86368 86368 0 0.0
.dynamic 624 624 0 0.0
.got 5224 5224 0 0.0
.init 27 27 0 0.0
.init_array 832 832 0 0.0
.rodata 229418 229418 0 0.0
.text 4169251 4169251 0 0.0
chip-tool debug (read only) 12073745 12073745 0 0.0
(read/write) 522240 522240 0 0.0
.bss 94488 94488 0 0.0
.data 5122 5122 0 0.0
.data.rel.ro 415408 415408 0 0.0
.dynamic 624 624 0 0.0
.got 5744 5744 0 0.0
.init 27 27 0 0.0
.init_array 800 800 0 0.0
.rodata 450169 450169 0 0.0
.text 10916419 10916419 0 0.0
chip-tool-ipv6only arm64 (read only) 11393796 11393796 0 0.0
(read/write) 589120 589120 0 0.0
.bss 103608 103608 0 0.0
.data 4512 4512 0 0.0
.data.rel.ro 455320 455320 0 0.0
.dynamic 512 512 0 0.0
.got 17024 17024 0 0.0
.init 24 24 0 0.0
.init_array 264 264 0 0.0
.rodata 355540 355540 0 0.0
.text 10158184 10158184 0 0.0
lighting-app debug+rpc+ui (read only) 5542777 5542777 0 0.0
(read/write) 226336 226336 0 0.0
.bss 119208 119208 0 0.0
.data 4864 4864 0 0.0
.data.rel.ro 94752 94752 0 0.0
.dynamic 672 672 0 0.0
.got 5864 5864 0 0.0
.init 27 27 0 0.0
.init_array 944 944 0 0.0
.rodata 354452 354452 0 0.0
.text 4941443 4941443 0 0.0
lock-app debug (read only) 4686513 4686513 0 0.0
(read/write) 205160 205160 0 0.0
.bss 113696 113696 0 0.0
.data 4160 4160 0 0.0
.data.rel.ro 80616 80616 0 0.0
.dynamic 624 624 0 0.0
.got 5176 5176 0 0.0
.init 27 27 0 0.0
.init_array 864 864 0 0.0
.rodata 255370 255370 0 0.0
.text 4219283 4219283 0 0.0
ota-provider-app debug (read only) 4300689 4300689 0 0.0
(read/write) 193432 193432 0 0.0
.bss 113312 113312 0 0.0
.data 4368 4368 0 0.0
.data.rel.ro 69840 69840 0 0.0
.dynamic 624 624 0 0.0
.got 4536 4536 0 0.0
.init 27 27 0 0.0
.init_array 720 720 0 0.0
.rodata 208426 208426 0 0.0
.text 3899075 3899075 0 0.0
ota-requestor-app debug (read only) 4430161 4430161 0 0.0
(read/write) 197800 197800 0 0.0
.bss 114208 114208 0 0.0
.data 4768 4768 0 0.0
.data.rel.ro 72944 72944 0 0.0
.dynamic 624 624 0 0.0
.got 4472 4472 0 0.0
.init 27 27 0 0.0
.init_array 768 768 0 0.0
.rodata 214570 214570 0 0.0
.text 4017859 4017859 0 0.0
shell debug (read only) 2912273 2912273 0 0.0
(read/write) 156696 156696 0 0.0
.bss 62832 62832 0 0.0
.data 1424 1424 0 0.0
.data.rel.ro 86672 86672 0 0.0
.dynamic 592 592 0 0.0
.got 4064 4064 0 0.0
.init 27 27 0 0.0
.init_array 1088 1088 0 0.0
.rodata 185760 185760 0 0.0
.text 2552722 2552722 0 0.0
thermostat-no-ble arm64 (read only) 4419300 4419300 0 0.0
(read/write) 243632 243632 0 0.0
.bss 121832 121832 0 0.0
.data 3392 3392 0 0.0
.data.rel.ro 103680 103680 0 0.0
.dynamic 512 512 0 0.0
.got 8624 8624 0 0.0
.init 24 24 0 0.0
.init_array 432 432 0 0.0
.rodata 159788 159788 0 0.0
.text 3924648 3924648 0 0.0
tv-app debug (read only) 5756337 5756337 0 0.0
(read/write) 353088 353088 0 0.0
.bss 244496 244496 0 0.0
.data 6560 6560 0 0.0
.data.rel.ro 94744 94744 0 0.0
.dynamic 624 624 0 0.0
.got 5472 5472 0 0.0
.init 27 27 0 0.0
.init_array 1160 1160 0 0.0
.rodata 292650 292650 0 0.0
.text 5221203 5221203 0 0.0
tv-casting-app debug (read only) 9886449 9886449 0 0.0
(read/write) 340672 340672 0 0.0
.bss 156336 156336 0 0.0
.data 3008 3008 0 0.0
.data.rel.ro 174432 174432 0 0.0
.dynamic 624 624 0 0.0
.got 5048 5048 0 0.0
.init 27 27 0 0.0
.init_array 1192 1192 0 0.0
.rodata 383032 383032 0 0.0
.text 9037475 9037475 0 0.0
mbed lock-app-release cy8cproto_062_4343w (read only) 6224 6224 0 0.0
(read/write) 2533168 2533168 0 0.0
.bss 220480 220480 0 0.0
.data 5216 5216 0 0.0
.text 1495852 1495852 0 0.0
nrfconnect all-clusters-app nrf52840dk_nrf52840 (read only) 4 4 0 0.0
(read/write) 1062952 1062952 0 0.0
bss 133119 133119 0 0.0
rodata 102680 102680 0 0.0
text 779952 779952 0 0.0
nrf7002dk_nrf5340_cpuapp (read only) 4 4 0 0.0
(read/write) 1224252 1224252 0 0.0
bss 127155 127155 0 0.0
rodata 151200 151200 0 0.0
text 795872 795872 0 0.0
all-clusters-minimal-app nrf52840dk_nrf52840 (read only) 4 4 0 0.0
(read/write) 1010528 1010528 0 0.0
bss 131977 131977 0 0.0
rodata 89944 89944 0 0.0
text 741288 741288 0 0.0
psoc6 all-clusters cy8ckit_062s2_43012 (read only) 834416 834416 0 0.0
(read/write) 1797756 1797756 0 0.0
.bss 196244 196244 0 0.0
.data 2680 2680 0 0.0
.text 1590444 1590444 0 0.0
all-clusters-minimal cy8ckit_062s2_43012 (read only) 837568 837568 0 0.0
(read/write) 1719812 1719812 0 0.0
.bss 193124 193124 0 0.0
.data 2648 2648 0 0.0
.text 1515652 1515652 0 0.0
light cy8ckit_062s2_43012 (read only) 844296 844296 0 0.0
(read/write) 1638932 1638932 0 0.0
.bss 186588 186588 0 0.0
.data 2456 2456 0 0.0
.text 1441500 1441500 0 0.0
lock cy8ckit_062s2_43012 (read only) 817136 817136 0 0.0
(read/write) 1668540 1668540 0 0.0
.bss 213748 213748 0 0.0
.data 2456 2456 0 0.0
.text 1443948 1443948 0 0.0
qpg lighting-app qpg6105+debug (read/write) 1130496 1130496 0 0.0
.bss 102488 102488 0 0.0
.data 836 836 0 0.0
.text 642880 642880 0 0.0
lock-app qpg6105+debug (read/write) 1090464 1090464 0 0.0
.bss 97232 97232 0 0.0
.data 856 856 0 0.0
.text 602844 602844 0 0.0
stm32 light STM32WB5MM-DK (read/write) 601709 601709 0 0.0
.bss 128352 128352 0 0.0
.data 676 676 0 0.0
.rodata 79796 79796 0 0.0
.text 383152 383152 0 0.0
telink air-quality-sensor-app tlsr9528a_retention (read only) 51774 51774 0 0.0
(read/write) 824506 824506 0 0.0
bss 49692 49692 0 0.0
text 617186 617186 0 0.0
all-clusters-app tlsr9518adk80d (read only) 29042 29042 0 0.0
(read/write) 1093360 1093360 0 0.0
bss 101812 101812 0 0.0
text 794308 794308 0 0.0
all-clusters-minimal-app tlsr9528a (read only) 47960 47960 0 0.0
(read/write) 1050824 1050824 0 0.0
bss 110116 110116 0 0.0
text 765622 765622 0 0.0
bridge-app tlsr9518adk80d (read only) 29042 29042 0 0.0
(read/write) 911544 911544 0 0.0
bss 93148 93148 0 0.0
text 653106 653106 0 0.0
contact-sensor-app tlsr9528a_retention (read only) 51774 51774 0 0.0
(read/write) 826130 826130 0 0.0
bss 49740 49740 0 0.0
text 618876 618876 0 0.0
light-switch-app-ota-shell-factory-data tlsr9528a (read only) 51584 51584 0 0.0
(read/write) 931848 931848 0 0.0
bss 77740 77740 0 0.0
text 699026 699026 0 0.0
lighting-app-ota-rpc-factory-data-4mb tlsr9518adk80d (read only) 29122 29122 0 0.0
(read/write) 1074724 1074724 0 0.0
bss 100228 100228 0 0.0
text 778490 778490 0 0.0
lock-app-dfu tlsr9528a (read only) 51584 51584 0 0.0
(read/write) 904232 904232 0 0.0
bss 69204 69204 0 0.0
text 654280 654280 0 0.0
ota-requestor-app tlsr9518adk80d (read only) 29042 29042 0 0.0
(read/write) 930516 930516 0 0.0
bss 92728 92728 0 0.0
text 672184 672184 0 0.0
pump-app tlsr9258a_retention (read only) 51774 51774 0 0.0
(read/write) 828862 828862 0 0.0
bss 49848 49848 0 0.0
text 621938 621938 0 0.0
pump-controller-app tlsr9518adk80d (read only) 31872 31872 0 0.0
(read/write) 792436 792436 0 0.0
bss 56048 56048 0 0.0
text 592616 592616 0 0.0
shell tlsr9518adk80d (read only) 29042 29042 0 0.0
(read/write) 677388 677388 0 0.0
bss 73672 73672 0 0.0
text 462616 462616 0 0.0
smoke_co_alarm-app tlsr9528a_retention (read only) 51774 51774 0 0.0
(read/write) 833666 833666 0 0.0
bss 51372 51372 0 0.0
text 625246 625246 0 0.0
temperature-measurement-app-mars-ota tlsr9518adk80d (read only) 32220 32220 0 0.0
(read/write) 852397 852397 0 0.0
bss 59524 59524 0 0.0
text 637326 637326 0 0.0
thermostat tlsr9518adk80d (read only) 31872 31872 0 0.0
(read/write) 818084 818084 0 0.0
bss 56336 56336 0 0.0
text 612300 612300 0 0.0
window-covering tlsr9258a (read only) 51584 51584 0 0.0
(read/write) 836184 836184 0 0.0
bss 68112 68112 0 0.0
text 627558 627558 0 0.0

@woody-apple woody-apple merged commit d09b5ac into project-chip:master Mar 29, 2024
67 checks passed
// Since OnPairingComplete(failure_code) might not be invoked in all cases, use this opportunity to inform of failed commissioning
// and default the error to timeout since that is best guess in this layer.
if (status == chip::Controller::DevicePairingDelegate::Status::SecurePairingFailed && [strongDelegate respondsToSelector:@selector(controller:commissioningComplete:nodeID:metrics:)]) {
OnCommissioningComplete(mDeviceNodeId, CHIP_ERROR_TIMEOUT);
Copy link
Contributor

Choose a reason for hiding this comment

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

This needs to be documented clearly in the APIs. Given what the documentation says right now, API consumers will absolutely not expect a commissioningComplete callback here.

// Since OnPairingComplete(failure_code) might not be invoked in all cases, use this opportunity to inform of failed commissioning
// and default the error to timeout since that is best guess in this layer.
if (status == chip::Controller::DevicePairingDelegate::Status::SecurePairingFailed && [strongDelegate respondsToSelector:@selector(controller:commissioningComplete:nodeID:metrics:)]) {
OnCommissioningComplete(mDeviceNodeId, CHIP_ERROR_TIMEOUT);
Copy link
Contributor

Choose a reason for hiding this comment

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

But if the API consumer tries to set up a new PASE session while the old setup is in progress, what happens? That will clobber mDeviceNodeId, right? Because we set it before we try to do the new PASE setup, which I think will fail out sync in that case...

This really needs an actual sound model for how this stuff works, so we don't get stuck with behavior clients expect that is broken and we can't change.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yup, but I am not sure how to fix this without changing the C++ layer. Ideally, if the callbacks can be fixed to pass on the NodeId, it will eliminate this issue

Copy link
Contributor

Choose a reason for hiding this comment

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

Well, one option is to set this only if we successfully kick off an async pairing operation, right? As in, don't set this until the call into the C++ returns success.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

But in that case, the callback above won't be invoked and clobbering the NodeId for the latest one should be fine. Right?

Copy link
Contributor

Choose a reason for hiding this comment

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

So the situation is:

  1. Start PASE with node id 1.
  2. Try to start PASE with node id 2, that fails to start (because the core SDK can only do one thing at a time for now), but sets mDeviceNodeId to 2.
  3. Now PASE to node id 1 fails, reports OnCommissioningComplete for node id 2.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah I see, I can fix it in next iteration

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants