Skip to content

Read stacks filter patterns from files - #6

Merged
lhotari merged 1 commit into
mainfrom
stacks-filter-files
Sep 23, 2026
Merged

lhotari merged 1 commit into
mainfrom
stacks-filter-files

Conversation

@lhotari

@lhotari lhotari commented Sep 23, 2026

Copy link
Copy Markdown
Collaborator

Stacked on #5: this PR's base is stacks-native-frames, so its diff shows only this change. Retarget it to main once that PR merges.

Change

stacks gains --include-from FILE and --exclude-from FILE, so a list of patterns you maintain, such as a service's idle waits, can live in a file instead of being repeated on every command line.

  • Both options repeat, and their patterns are added after any given with --include/--exclude. The filter rules are unchanged: any matching pattern counts, and an exclude beats an include.
  • A file holds one regular expression per line, read as UTF-8, with CRLF line endings accepted.
  • Blank lines and lines starting with # are skipped. \# escapes a pattern that starts with #.
  • Every other line is used exactly as written, spaces included, because frame names such as C2 Runtime complete_monitor_locking contain spaces.
  • A file with no patterns is refused rather than read as no filter; for an include, no filter would keep everything.
  • An invalid pattern is reported with its file and line, and a missing file fails with its name.
  • The --summary file lists the patterns read.

The usage text, README §5 (with an --exclude-from example) and OFFLINE.md are updated.

Verification

./gradlew spotlessCheck :jonoffcpu-correlator:check passes. New cases in StackProfileTest.filters:

  • a pattern file gives the same output as the same patterns passed with repeated --include;
  • inline and file patterns combine, as the summary shows;
  • a pattern starting with \# is kept;
  • an empty file, an invalid pattern (reported with its line) and a missing file are each refused.

@lhotari
lhotari added this pull request to stack #7 September 23, 2026 16:25
Base automatically changed from stacks-native-frames to main September 23, 2026 16:33
stacks gains --include-from FILE and --exclude-from FILE, so a maintained
list of patterns, such as a service's idle waits, can be kept in a file
instead of repeated on every command line. Both repeat, and their patterns
are added after any given with --include/--exclude; the filter rules are
unchanged.

A file holds one regular expression per line, read as UTF-8. Blank lines and
lines starting with '#' are skipped ('\#' escapes a pattern that starts with
'#'), and every other line is taken verbatim, spaces included, since frame
names such as "C2 Runtime complete_monitor_locking" contain them. A file
with no patterns is refused rather than read as no filter, which for an
include would keep everything, and an invalid pattern is reported with its
file and line. The --summary file lists the patterns read.
@lhotari
lhotari force-pushed the stacks-filter-files branch from bb24b1c to 94d9477 Compare September 23, 2026 16:33
@lhotari
lhotari merged commit 3b02829 into main Sep 23, 2026
4 checks passed
@lhotari
lhotari deleted the stacks-filter-files branch September 24, 2026 13:12
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