Grigory-Rylov / android-methods-profiler

Yet another Android Profiler for AOSP .trace files
Apache License 2.0
270 stars 16 forks source link

Provide a way to filter operations and get duration #97

Open Monabr opened 11 months ago

Monabr commented 11 months ago

Hello.

I want to use a profiler to measure how long each of the methods in my application takes. I measured it and made a trace, but there are a lot of system calls in it. How can I make it show only my methods and the time for them? I need a list of my methods from different threads because there are a lot of coroutines running.

Grigory-Rylov commented 11 months ago

Hello! Do I understand correctly that you want to generate a flat list in a text file containing the names of the methods corresponding to some filter and the duration of the methods? Did you want it for selected thread or all threads? If so, I've made something similar before and will try to make that kind report.

Monabr commented 11 months ago

@Grigory-Rylov I have a business logic with 200+ methods. I want to optimize the calculations, but to do this I either need to manually put all the logs or use a profiler. The problem is, there are 20+ different threads running. In the android studio profiler, I collect them into one selection and go to the "BottomUp" tab. There is a search there, but when I enter the name of my package, it gives me a lot of library methods, such as run, park, runWorker, etc., which clutters the list and does not allow me to properly analyze which longest method I should start with, so I'm searching tools to solve the problem.

Having stumbled upon your library, I did not find such functionality and would really like to get it.

Grigory-Rylov commented 11 months ago

@Monabr for now you can use custom color highlighting for your methods in Call chart and Flame char (View -> Show highlighting settings, add color relation for your package filter).

And then you can open Flame chart and look for your methods (read more about flame chart in https://developer.android.com/studio/profile/inspect-traces)

Monabr commented 11 months ago

@Grigory-Rylov I think you didn't fully understand me. I think I don’t need a diagram, plus it shows the diagram for each thread separately, but I need it for all of them together. I don't have problems with rendering, I have a need to measure the duration of the methods. The diagram is also inconvenient for this purpose in my opinion.

Grigory-Rylov commented 11 months ago

@Monabr what you expect to receive in report, when, for example, you have next code: ''' class Foo{

fun main() { a() }

fun a() { b() }

fun b() { c() }

fun c() {}

} ''' ?

Monabr commented 11 months ago
name                           | duration
--------------------------------------------
- main()                       | 100s
-- a()                         | 100s
--- b()                        | 100s  
---- c()                       | 100s

@Grigory-Rylov This is what I would like to get based on your example.

blue4sky commented 9 months ago

Hi - are there any updates on this? I also have the same needs as @Monabr (measuring how long each of the methods in my application takes)

Grigory-Rylov commented 9 months ago

Hi - are there any updates on this? I also have the same needs as @Monabr (measuring how long each of the methods in my application takes)

Hello! Sorry, I was busy as a bee) I' ll try to make that ability due to several days.