Anyway to monitor CPU utilization

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

Hello,

In our use case, Master needs to support the multiple Slave connection simultaneously

and receive Notification data from all Slave simultaneously.

I would like to estimate how many Slave the Master can handle.

I know it supports up to 8 simultaneous connections,

but my concern is CPU bandwidth with simultaneous heavy traffic from multiple Slave.

All data received is to be sent over PUART which would also consume a substantial CPU bandwidth.

Is there any way for the application to check CPU utilization?

Since CPU is to be shared by the application and BLE stack,

it would be valuable for the application to monitor CPU utilization.

Thanks!!

0 Likes
1 Solution
MichaelF_56
Moderator
Moderator
Moderator
250 sign-ins 25 comments on blog 10 comments on blog

I verified with the developers that there is no way to do this on the BCM2073x because the BLE stack runs threads that are invisible to the developer, making it nearly impossible to insert hooks to measure performance.

View solution in original post

0 Likes
7 Replies
MichaelF_56
Moderator
Moderator
Moderator
250 sign-ins 25 comments on blog 10 comments on blog

I don't think this is possible, but I will check around with the developers to see if they have been asked this question in the past.

79rpm

victorz maxsu

0 Likes
Anonymous
Not applicable

If you add your on LOG, TRACE or debug hooks, e.g. sending messages via UART to see if MCU is On/Off ... you might get a clue (with timestamps when you receive messages).

Should be possible with dedicated debug and trace hooks added in the code.

0 Likes
Anonymous
Not applicable

>> I verified with the developers that there is no way to do this on the BCM2073x

>> because the BLE stack runs threads that are invisible to the developer,

>> making it nearly impossible to insert hooks to measure performance


Just providing hooks just before and after ARM WFI (Wait For Interrupt) in your Idle task

would be sufficient for the SDK users to measure CPU utilization.


0 Likes
MichaelF_56
Moderator
Moderator
Moderator
250 sign-ins 25 comments on blog 10 comments on blog

I verified with the developers that there is no way to do this on the BCM2073x because the BLE stack runs threads that are invisible to the developer, making it nearly impossible to insert hooks to measure performance.

0 Likes

You can use the empirical approach, start with one slave advertising and connecting followed by a second one,..., up to eight. I would also try the same scenario with all the slaves advertising at the same time. I that configuration I would add more than 8 slaves advertising (to create extra noise), maybe 10-15.

For the PUART I would generate traffic regularly. If the traffic is based on user action I would generate traffic every 500ms to 1s (even fake traffic).

The application thread that is dedicated to your application processes the event queue (entry point), so you will need to look at that closely, making sure the thread is doing its job on a timely manner.Someone suggested time stamps in your logs, I think it is a good one to add.

I believe you are using the timer (or maybe both) for your internal application design. I would also try to play with the period of the timer, decreasing it (so the timer callback executes more often).

Anonymous
Not applicable

Thanks for the advices.

As for the timestamp, I couldn't find an API to check CPU cycle time.

Only thing available seems like fine timer tick which is 12.5 ms resolution.

So, I don't think it is useful for any CPU profiling.

0 Likes
Anonymous
Not applicable

Cortex M3 does not have Performance Counters (as a Cortex A9). If ETM is available in silicon - no clue
(but it would need anyway a special debugger).

Maybe, you can use the SYSTICK (if not used by RTOS: if so you might use something from RTOS or the SYSTICK counter itself just by reading).

Or you drive a GPIO pin and measure with scope from outside.

embedded - Cycle counter on ARM Cortex M4 (or M3)? - Stack Overflow

0 Likes