Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@kenzieschmoll
Copy link
Member

Before this PR, the CPU profiler only supported a small set of "toggle" filters. This adds a query filter to the profiler's filter dialog. This PR also increases the test coverage for FilterControllerMixin.

This required some refactoring / cleanup to the existing Filter functionality. Work towards #2524.

@kenzieschmoll kenzieschmoll requested review from a team and bkonyi as code owners February 7, 2023 23:11
_selectedCpuStackFrameNotifier.dispose();
_processingNotifier.dispose();
transformer.dispose();
super.dispose();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: super.dispose() should probably be the first call in this method.

Copy link
Member Author

@kenzieschmoll kenzieschmoll Feb 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dispose is the one exception where we want to call super.dispose last so that a subclass's disposable items are disposed before the superclass. Most of our codebase follows this pattern, but we probably need to clean up a few cases for consistency.

_buildTab(key: callTreeTab, tabName: 'Call Tree'),
_buildTab(key: flameChartTab, tabName: 'CPU Flame Chart'),
],
_buildTab(key: bottomUpTab, tabName: 'Bottom Up'),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can the tabs handle no data now?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah. This is necessary because if a filter is applied that results in no stack frames, the user needs to still have a way to widen the filter. When we got rid of the profiler for an "empty" profile, there was no way for the user to get back to the data they were looking at and filtering.

);
// At this point, data is filtered by the default toggle filter values.
var filteredData = controller.dataNotifier.value!;
expect(filteredData.stackFrames.values.length, equals(12));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ubernit: the equals(...) matcher is the default, so it's not necessary. Feel free to remove it if you'd like.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ack. this is a big clean up, so I filed #5210 to track.

controller.setActiveFilter(query: 'Ba cat:foobar');
expect(
controller.filteredData.value.toString(),
equals('[1-FooBar-foobar]'),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need one more test case here... ;-)

controller.toggleFilters[0].enabled.value = true;
controller.toggleFilters[1].enabled.value = true;
controller.setActiveFilter(query: 'Basset');
// There ain't nothin' but a hound dog
expect(
  controller.filteredData.value.toString(),
  equals('[5-Basset Hound-dog]'),
);

@kenzieschmoll kenzieschmoll merged commit e56d5b4 into flutter:master Feb 8, 2023
@kenzieschmoll kenzieschmoll deleted the profile-filtering branch February 8, 2023 20:31
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.

2 participants