CPU Profiler Android Studio

Issue

I am facing a problem with my Android App.

My application get a microphone by using Native Code in C and other services like MQTT.
But actually my app use a lot of CPU usage and a notification request the user to set my app on a deep sleep mode.

So I’m searching what part of my code use as much CPU and when I start CPU Profiler I see some Thread that use a lot of CPU but I don’t know what part of my code it is.

enter image description here

My question is : How to know what Thread indicate in the CPU Profiler, corresponds to which service or thread of my code.

Thanks in advance.

Solution

I solved my problem basically by setting a name to my thread like that :

thread.setName("MainActivity_Thread");

This allow to display the name of the thread to the CPU Profiler.

Answered By – Stimm4

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published