USB performance got worse on v3.1.0-preview4 and main branch

We tested the USB performance on the v3.1.0-preview4 and main it looks like it got even worse.

All tests were done on the attached test project: TestProject

main (6855b38ca69d2a70d0a088d9964e606e9981cb14)

USB FS 1K report rate
Thread analyze:
...
usbd : STACK: unused 1512 usage 536 / 2048 (26 %); CPU: 34 %
: Total CPU cycles used: 45517627
usbhs@86000 : STACK: unused 96 usage 416 / 512 (81 %); CPU: 19 %
: Total CPU cycles used: 25762594
...

Thread analyze shows very high CPU usage for USB FS with 1 K HID endpoint ~53%

USB HS 8K report rate
Thread analyze:
...
usbd : STACK: unused 1632 usage 416 / 2048 (20 %); CPU: 10 %
: Total CPU cycles used: 17171786
usbhs@86000 : STACK: unused 96 usage 416 / 512 (81 %); CPU: 17 %
: Total CPU cycles used: 29665104
idle : STACK: unused 248 usage 72 / 320 (22 %); CPU: 19 %
: Total CPU cycles used: 32271812
...

Thread analyze shows high CPU usage for USB HS with 8 K HID endpoint ~27%. The idle CPU left is only 19%

v3.1.0-preview4

USB HS 4K report rate
Thread analyze:
...
usbd : STACK: unused 1624 usage 424 / 2048 (20 %); CPU: 11 %
: Total CPU cycles used: 9612250
usbhs@86000 : STACK: unused 112 usage 400 / 512 (78 %); CPU: 9 %
: Total CPU cycles used: 7924142
idle : STACK: unused 248 usage 72 / 320 (22 %); CPU: 32 %
: Total CPU cycles used: 26576904
...
Thread analyze shows high CPU usage for USB HS with 4 K HID endpoint ~20%

With 8K endpoint configuration the project does not work

Even with half the report rate the overall performance is worse compared to previous NCS releases.

Could you please also advice on how to test this with suit approach, because to run these tests we had to switch to iron.

Related