Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions profiler-cli/src/commands/filter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ export function registerFilterCommand(
.command('push')
.description('Push a sticky sample filter')
.option('--thread <handle>', 'Thread handle')
.option(
'--search <term>',
'Marker search text (used with --during-marker / --outside-marker)'
)
)
).action(async (opts) => {
const spec = parseFilterSpec({
Expand Down
20 changes: 20 additions & 0 deletions profiler-cli/src/test/integration/basic.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import {
type CliTestContext,
} from './utils';

import type { FilterStackResult } from '../../protocol';

describe('profiler-cli basic functionality', () => {
let ctx: CliTestContext;

Expand Down Expand Up @@ -256,6 +258,24 @@ describe('profiler-cli basic functionality', () => {
expect(afterPop.filters).toHaveLength(0);
});

it('filter push supports --during-marker with --search', async () => {
await cli(ctx, ['load', 'src/test/fixtures/upgrades/processed-1.json']);
await cli(ctx, ['thread', 'select', 't-0']);

await cli(ctx, ['filter', 'push', '--during-marker', '--search', 'Reflow']);

const filterListResult = await cli(ctx, ['filter', 'list', '--json']);
const filterList = JSON.parse(filterListResult.stdout) as FilterStackResult;

expect(filterList.filters).toHaveLength(1);
expect(filterList.filters[0].transforms).toEqual([
{ type: 'filter-samples', filterType: 'marker-search', filter: 'Reflow' },
]);
expect(filterList.filters[0].description).toBe(
'during marker matching: "Reflow"'
);
});

it('ephemeral sample filters do not persist into session state', async () => {
await cli(ctx, ['load', 'src/test/fixtures/upgrades/processed-1.json']);

Expand Down
Loading