Skip to content

Add --log-markers option to extract Log-type marker payloads#1

Open
alastor0325 wants to merge 3 commits intodpalmeiro:mainfrom
alastor0325:main
Open

Add --log-markers option to extract Log-type marker payloads#1
alastor0325 wants to merge 3 commits intodpalmeiro:mainfrom
alastor0325:main

Conversation

@alastor0325
Copy link
Copy Markdown

Summary

  • --top-markers and --focus-marker silently skip zero-duration markers, making about:logging media profiles unanalyzable — the log messages are stored as instant Log-type markers with no duration
  • Add --log-markers [filter] which reads these markers directly from profile.threads, extracts data.name / data.module from each type:"Log" entry, and outputs them grouped by thread in chronological order
  • An optional filter string restricts output by message text, module name, or thread name (case-insensitive)

What --log-markers is for

When Firefox captures an about:logging profile with the "Media playback" preset, the media pipeline log messages are stored as instant Log-type markers (zero duration, point-in-time). Examples:

[D/MediaDecoder] MediaDecoderStateMachine[...] state=LOOPING_DECODING audio sample after time-adjustment
[V/MediaFormatReader] Update(Video) desc:blank media data decoder pending:0 waiting:0
[V/AudioSinkWrapper] Dropping audio packets: media position: 1565.790710, packet dropped: [1565.760, 1565.781] (1 so far).

These are invisible to --top-markers (which skips markers without an end time) and to --focus-marker (which filters CPU samples, not log text).

Usage

# All log markers across all threads
profiler-cli <url> --log-markers

# Filter by thread name
profiler-cli <url> --log-markers "MediaDecoderStateMachine"

# Filter by message content
profiler-cli <url> --log-markers "blank media"

# Filter by module
profiler-cli <url> --log-markers "D/MediaDecoder"

Implementation notes

  • getLogMarkers() in profiler.ts accesses selectors.profile.getProfile(getState()).threads directly — bypassing window.filteredMarkers which only covers the currently selected thread and skips zero-duration entries
  • data.name for Log-type markers is already a fully resolved string in the Redux store (no string table lookup needed)
  • The markers table uses startTime (not time) as the timestamp field

Tests

  • tests/options.test.ts: unit tests for flag parsing and validateArgs
  • tests/log-markers.test.ts: integration tests against a new fixture (log-markers-profile.json.gz) — covers all-markers output, module label formatting, message/module/thread filtering, no-match message, chronological sort, and timestamp format

about:logging profiles store media log messages as instant Log-type
markers. The existing --top-markers skipped these entirely because it
filters out markers without an end time and zero-duration markers.

Add getLogMarkers() which accesses profile.threads directly, finds all
markers with data.type === "Log", and extracts their text payload from
data.name (already a resolved string in the Redux store). An optional
filter string restricts output by message text, module name, or thread
name.

Usage:
  profiler-cli <url> --log-markers              # all log markers
  profiler-cli <url> --log-markers "MediaDecoder"  # filter by keyword
- options.test.ts: unit tests for --log-markers parsing and validateArgs
  (flag accepted alone, with filter string, rejected alongside --calltree)
- log-markers.test.ts: integration tests against a fixture profile with
  known Log markers in MediaDecoderStateMachine and MediaSupervisor threads
  (all markers shown, module labels, message/module/thread filtering,
   no-match message, chronological sort, timestamp format)
- tests/fixtures/log-markers-profile.json.gz: minimal profile fixture with
  4 Log markers across two media threads and one non-Log DOMEvent marker
@alastor0325
Copy link
Copy Markdown
Author

@dpalmeiro could you help review this? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant