How to estimate app cpu usage in sdk or in device?

I have a simple power graph app in the making. I've gone through several options on how to display the graph. As the app gets updated once per second there are many ways to do it dramatically wrong. :-)

Is there any way to measure (or estimate) app battery or cpu usage? Either in device or in sdk.
  • I have a simple power graph app in the making. I've gone through several options on how to display the graph. As the app gets updated once per second there are many ways to do it dramatically wrong. :-)

    Is there any way to measure (or estimate) app battery or cpu usage? Either in device or in sdk.


    I am not sure there is a great way to get the exact figures your looking for. You could start by simply timing the execution as well as memory usage. That might at least give you an idea of what is operating most efficiently.
  • Former Member
    Former Member over 9 years ago
    If you call Toybox.System.getTimer() at the start and end of your processing, and compare the values, you will get a pretty good rough metric you can use to compare the efficiency of different methods. The time you spend processing will be a good analog for battery draw on ConnectIQ devices.
  • If you call Toybox.System.getTimer() at the start and end of your processing, and compare the values, you will get a pretty good rough metric you can use to compare the efficiency of different methods. The time you spend processing will be a good analog for battery draw on ConnectIQ devices.


    Thanks. Should the results from emulator be roughly consistent? Or is it dependant with the computer I'm running it in?
  • Former Member
    Former Member over 9 years ago
    Sorry... I should have thought that through and been more specific. This will only work on device.

    It isn't really going to be feasible to try to test power on the simulator because it does not emulate the hardware in any direct way. If you do the test I suggested on the simulator, you will probably just get 0 or 1 or something super low because even the lowest end computer is going to be many orders of magnitude faster than the device hardware. The architecture is also completely different, so even if we exposed a higher resolution timer for the simulator, there is no guarantee the that the timings would be proportional to the ones you would get on devices.

    It is however likely that the timings will be similar across the various ConnectIQ products, so if you have one to test on you can assume results would be relatively similar on the others.