Skip to content

Fix GJS profiler with MozJS 60

Georges Basile Stavracas Neto requested to merge gbsneto/fix-profiler-js60 into master

In MozJS 60, only using entry.label() is not enough to give meaningful Sysprof entries, since it might be an empty string in various cases. This gives many empty entries in Sysprof, making the profiler not as useful.

Here's an example:

almost empty

As per upstream MozJS, in version 60, the final string is a combination of entry.label() and entry.dynamicString(). In [1], however, the dynamic string is conditionally added depending on a privacy toggle - which is not really the case with GJS since enabling the profiler isn't possible without a large control over the software stack, and opting in.

Thus, use entry.dynamicLabel() as an additional source of information when saving the profiling labels, with enough care to not allocate new strings while there.

Here's how Sysprof looks with the patch applied:

sweet prof

[1] https://hg.mozilla.org/releases/mozilla-esr60/rev/768e500ad190

Edited by Georges Basile Stavracas Neto

Merge request reports