How to measure CPU usage?

I am using AppGyver Preview to test my app on two different phones and they get quite hot even though the app isn’t doing much.

Is there a way to track, what is using the CPU and how much?

My suspicion is, that I have set the delay functions for refreshing the local storage too short. Default is 5000 ms, which creates a very slow user experience. So I’ve set it to 500, which then seems to use too much CPU?

If the app isn´t doing much why are you refreshing the storage so often? Perhaps explain how the user experience is affected by the longer time? Perhaps there is another trigger for your refresh.

I have a list of text items. When the user adds a new item, that list has to be refreshed in order for the new item to be visible. If the delay is set to the default value of 5 seconds, the user has to wait 5 seconds before the new value is visible. This makes the experience of the app very sluggish.

But now that I think about it, maybe there should be another trigger, as you mentioned. I am taking my queue from the default behavior of AppGyver when placing a new data variable on the page. It’s set to an automatic refresh from the data source. Would it then be better to move this code behind the add button logic? Then there is no need for the automatic refresh.

But anyway, it does not answer the core of my question. I need automatic refreshing for other purposes anyway. If I don’t see how much they cost in terms of CPU usage and I have to measure by hotness of the device that’s very vague.

I also don’t understand how a few refreshes of every 500ms in a local storage with less than 5 properties and a handful of rows can cause so much CPU cost that the device heats up. I am playing fancy video games on that device without the device heating up…

Yes. Definitely!

For original question, I don’t think there is a way to measure CPU usage from Appgyver preview app. Maybe you can use external apps that track device stats. But I guess even those don’t have such detailed data as the task manager on windows for example. Maybe you could try viewing your app on your desktop and check the usage on that one?


Agreed, I think there must be something else happing that is causing that level of CPU usage. What does the debugger tell you about the transactions taking place? Is it all as expected? Is it just this one page thats causing the high usage?

Well that’s what I try to figure out. I am working on the app, debugging things, testing and during that process the devices suddenly get hot. But why? Since I don’t have any measurement which page / flow function causes how much cost it’s just guessing what it actually could be.

I guess under these circumstances I will just have to throttle the refresh rate until I find that sweet spot where the device doesn’t get hot anymore while the user experience is still enjoyable.

BTW is it en external api or device storage data resource?
How do you store the other data.
You might be better of with doing a get record collection or get record on page load, saving the data to an app variable or even page variable and updating that on the new submission. So all lists are automatically updated and you do not need to pull the data again and again…

1 Like