How can I display values from Android Studio profiler/performance on my app?

142 Views Asked by At

I used the Android Studio profiler to check how the values of CPU, memory and energy change during the execution of an app I'm developing. I wonder if there is any way I could display these values, for instance, the energy consumed and CPU load on my APP?

This is some of the documentation I checked and it doesn't say anything about it.

If there is any other way to display performance values on the app without using the profiler, I could also use that!

1

There are 1 best solutions below

2
Shukang Z On

The energy data presented in Android Studio Profilers are based on a mathematical model that takes CPU utilization, network activity, location activity, etc. as inputs. The source code is here in case you are interested.

The CPU load is calculated from /proc/* files. The code is here.

That said, the profilers collect the data sometimes as the shell user, sometimes as the app. Your app may not have the permission to access them.