Open Bug 1745967 Opened 3 years ago Updated 1 year ago

Consider generating processNames for all process types

Categories

(Core :: Gecko Profiler, enhancement, P3)

enhancement

Tracking

()

People

(Reporter: mstange, Unassigned)

Details

Attachments

(2 files)

The Firefox Profiler front-end code has a mapping which creates human readable names for the processes in the profiler:

https://github.com/firefox-devtools/profiler/blob/d0aaf9f2d9b5348e0514ba4450b65ae0c59eff54/src/profile-logic/profile-data.js#L2102-L2125

        switch (thread.processType) {
          case 'default':
            label = 'Parent Process';
            break;
          case 'gpu':
            label = 'GPU Process';
            break;
          case 'rdd':
            label = 'Remote Data Decoder';
            break;
          case 'tab': {
            label = 'Content Process';
            homonymThreads = threads.filter((thread) => {
              return (
                thread.name === 'GeckoMain' && thread.processType === 'tab'
              );
            });
            break;
          }
          case 'plugin':
            label = 'Plugin Process';
            break;
          case 'socket':
            label = 'Socket Process';
            break;

It would be great if we could replace this mapping with something that's inside of Gecko, so that we don't need to tweak the front-end when we add new process types.

Severity: -- → N/A
Priority: -- → P3

(In reply to Markus Stange [:mstange] from comment #0)

The Firefox Profiler front-end code has a mapping which creates human readable names for the processes in the profiler:

https://github.com/firefox-devtools/profiler/blob/d0aaf9f2d9b5348e0514ba4450b65ae0c59eff54/src/profile-logic/profile-data.js#L2102-L2125

        switch (thread.processType) {
          case 'default':
            label = 'Parent Process';
            break;
          case 'gpu':
            label = 'GPU Process';
            break;
          case 'rdd':
            label = 'Remote Data Decoder';
            break;
          case 'tab': {
            label = 'Content Process';
            homonymThreads = threads.filter((thread) => {
              return (
                thread.name === 'GeckoMain' && thread.processType === 'tab'
              );
            });
            break;
          }
          case 'plugin':
            label = 'Plugin Process';
            break;
          case 'socket':
            label = 'Socket Process';
            break;

It would be great if we could replace this mapping with something that's inside of Gecko, so that we don't need to tweak the front-end when we add new process types.

Maybe use geckoprocesstypes python module and introduce that as a GeneratedFile ?

Could you clarify? Who would generate which kind of file and who would consume it? Would this support l10n, and if so, would the localized name be stored in the profile or would it be resolved when viewing the profile?

(In reply to Markus Stange [:mstange] from comment #3)

Could you clarify? Who would generate which kind of file and who would consume it? Would this support l10n, and if so, would the localized name be stored in the profile or would it be resolved when viewing the profile?

I'm not sure I understand enough of the profiler-related bits to answer the last part. For the first part, you could add a GeneratedFile entry in mozbuild (see e.g. https://searchfox.org/mozilla-central/rev/72c7cef167829b6f1e24cae216fa261934c455fc/xpcom/build/moz.build#78-82) that could produce a C++ header defining your nice names, that you could use directly within GeckoProcessTypeToProfilerProcessName. This way, you don't have to introduce yet-another-field to the GECKO_PROCESS_TYPE macro that we would like to simplify in the future.

Markus, have you had a chance to take a look at the WIP I shared ?

Flags: needinfo?(mstange.moz)

(In reply to :gerard-majax from comment #6)

Markus, have you had a chance to take a look at the WIP I shared ?

It only took three years, but I have now! So with the WIP approach somebody who adds a new process type would need to remember that they need to edit tools/profiler/gen_profilerNames.py to add a new if branch for their new process type. And it doesn't address Nika's request to share the mapping with other places that want to translate these names for the UI.

Flags: needinfo?(mstange.moz)
Assignee: mstange.moz → nobody
Status: ASSIGNED → NEW
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: