Closed Bug 1630895 Opened 5 years ago Closed 5 years ago

Add some categories to the Java stack

Categories

(Core :: Gecko Profiler, enhancement)

enhancement

Tracking

()

RESOLVED FIXED
mozilla77
Tracking Status
firefox77 --- fixed

People

(Reporter: canova, Assigned: mstange)

References

(Blocks 1 open bug)

Details

Attachments

(2 files)

Currently we don't have a way to annotate java stack to add the categories. We are using label frames for that in the profiler. There could be 2 possible implementation

  1. Adding label frames for Java. But it requires adding a stack merging step, and it's not quite fast easy/fast.
  2. We could deduce the categories from the function names. That would be the easier implementation. Also we already have something like this for idle category

There is also another issue which Markus mentioned on the Matrix channel:

the big problem to having useful categories in Java code is the fact that a totally different set of categories would be useful for Java code
e.g. there's no "Layout" or "JS" or "GC" running on the Java thread
but there's "Mozilla" vs "Android" vs "Java language" code running
we only have one list of categories for the entire profile, and a limited set of category colors
in theory, we could just add the new Java categories to the central category list and then have duplicated colors, and then Gecko threads only use one half of the list and Java threads use the other half
it might be a bit misleading that different colors in the activity graph have different meanings depending on what thread you're looking at

Attached image Android Studio

Would it make sense to re-use colors from the Android Studio? They might already be familiar to some engineers.

Yeah, that sounds good to me!

I basically implemented this in the Android trace importer PR so I'm just going to port that implementation to CollectJavaThreadProfileData.

Example profile from the Android trace importer: https://perfht.ml/2IGD6KG
I followed the colors from Android studio to some extent: org.mozilla.* / mozilla.* is green, sun.* / java.* is blue, androidx.* is orange.
I also added some other colors; I split out android.* into a separate yellow category, kotlin.* / kotlinx.* into a purple category, and I added a special "Blocking" category in light blue for java.lang.Object.wait.

Assignee: nobody → mstange
Status: NEW → ASSIGNED

(I'm still waiting for this patch to finish compiling. I will post a profile once I have an Android build.)

Here's a profile from GeckoView-example: https://perfht.ml/2VimhNo

Here's a profile from a (debug) Fenix: https://perfht.ml/3csNW48

Pushed by mstange@themasta.com: https://hg.mozilla.org/integration/autoland/rev/7670fe6b5a81 Infer categories for Java frames. r=gerald
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla77
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: