Hello,
Is there any way to know CPU load (active vs sleep time) ?
Hello,
Is there any way to know CPU load (active vs sleep time) ?
The idea is good, the difficulty is the precision of the measure and the current consumption pattern. Advanced improvements in your code modify current for the last micro ampers and current is not constant versus time so you have to integrate current (because voltage is just a quasi constant factor here) to get energy consumption or mean power (if you divide by time). Next thing you have to substract consumptions of RF frontend, ... there could be higher (when your code load is low) and not defined with enough precision so you are looking at a candle near the sun :-)
I still don't get it. What special "load" you have in mind? If I get it right this isn't anything like ARM Cortex-A or x86/AMD64 with out-of-order execution, variable clock, multicore, turbo etc. Here once the CPU works it executes the instructions pretty much linearly at constant clock. So the power consumption depends only on peripherals turned on (and I guess only radio have really dynamic power characteristic, right?). So unless your code has some disturbing busy wait loops it should be easy to see from the power consumption when you execute the code (= CPU is 100% busy) and when you go to sleep (assuming you use this standard architecture of asynchronous event-based BLE app with just app_sd_evt_wait() - or directly WFE - in the main program loop). Or you want to filter SoftDevice processing out of it?