Open Bug 2095570 Opened 3 days ago Updated 20 hours ago

Add a MOZ_PROFILER_MARKER environment variable to choose which log modules record profiler markers

Categories

(Core :: Gecko Profiler, enhancement)

enhancement

Tracking

()

ASSIGNED

People

(Reporter: dcarver, Assigned: dcarver)

References

(Blocks 1 open bug)

Details

Attachments

(1 external file)

Bug 2069963 filters profiler markers by the log module that emits them. Bug 2084269 configures this with an m flag in MOZ_LOG, as in nsHttp:5+m. That depends on the per-module flag syntax of bug 2080769 and also extends the logging.<name> prefs, about:logging and the profiler presets. This bug replaces it with something smaller: a separate environment variable, with MOZ_LOG left unchanged.

MOZ_PROFILER_MARKER is a comma-separated list of log module names. If it is set, only markers emitted through a listed module are recorded. Child processes inherit it, as they do MOZ_LOG.

Recording markers is still a setting stored on each LogModule, separate from its level. Listing a module does not send its statements to the log.

When this lands, markers go through only two modules: LogMarker, for the Log markers recorded for enabled log statements, and orphanMarker, for every other marker. For example, with MOZ_LOG=nsHttp:5:

  • MOZ_PROFILER_MARKER unset: every marker is recorded, as today.
  • MOZ_PROFILER_MARKER= (empty): no marker is recorded.
  • MOZ_PROFILER_MARKER=LogMarker: the nsHttp Log markers and nothing else.
  • MOZ_PROFILER_MARKER=orphanMarker: every marker except the Log markers.
  • MOZ_PROFILER_MARKER=LogMarker,orphanMarker: every marker, the same as unset.

Entries that start with - or contain * are reserved: they are ignored, and the parent process prints a warning on stderr. That way a later bug can give them a meaning without changing any value that works today.

Later (not in this bug)

The plan is to follow the trace event categories of Chromium: * matches any run of characters, -name excludes, and a list made only of exclusions means "everything except". Every value accepted today keeps its meaning:

  • MOZ_PROFILER_MARKER=LogMarker: unchanged, only the Log markers.
  • MOZ_PROFILER_MARKER= (empty): unchanged, no marker is recorded.
  • MOZ_PROFILER_MARKER=*: every marker, the same as unset.
  • MOZ_PROFILER_MARKER=-LogMarker: every marker except the Log markers.
  • MOZ_PROFILER_MARKER=*,-LogMarker: the same, written out.
  • MOZ_PROFILER_MARKER=Media*: only markers from modules starting with Media, once more modules emit markers.
  • MOZ_PROFILER_MARKER=Media*,-MediaDecoder: the same, without MediaDecoder.

Out of scope

  • wildcards, exclusions and other pattern matching (see above)
  • per-module defaults (bug 2095517)
  • prefs, about:logging, profiler presets and about:profiling
  • changing the setting while Firefox is running

This makes it possible to filter profiler markers by log module. It holds a
comma-separated list of module names that says which modules record markers.
When it is set, only the listed modules record markers; when it is unset, every
module does, as today. This is stored on each LogModule, separately from its
level: listing a module doesn't send its statements to the log.

Entries that start with '-' or contain '*' are reserved for exclusions and
wildcards, and are ignored, so that giving them a meaning later doesn't change
any value that works today. Empty entries are ignored too, and a value that
lists no module, such as an empty one, records the markers of every module, as
when it is unset.

The variable is read and parsed by ProfilerMarkerFilter, in tools/profiler, and
LogModuleManager sets each module's flag from it when it creates the module.

The markers guide describes the variable and its syntax. Nothing reads this
setting yet.

Assignee: nobody → dcarver
Status: NEW → ASSIGNED
Attachment #9687418 - Attachment description: WIP: Bug 2095570 - Add a MOZ_PROFILER_MARKER environment variable to choose which log modules record profiler markers. r?#xpcom-reviewers,#profiler-reviewers → Bug 2095570 - Add a MOZ_PROFILER_MARKER environment variable to choose which log modules record profiler markers. r?#xpcom-reviewers,#profiler-reviewers
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: