-
Notifications
You must be signed in to change notification settings - Fork 364
Add text filtering to the CPU profiler #5204
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| _selectedCpuStackFrameNotifier.dispose(); | ||
| _processingNotifier.dispose(); | ||
| transformer.dispose(); | ||
| super.dispose(); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
packages/devtools_app/lib/src/screens/profiler/cpu_profile_controller.dart
Outdated
Show resolved
Hide resolved
| _buildTab(key: callTreeTab, tabName: 'Call Tree'), | ||
| _buildTab(key: flameChartTab, tabName: 'CPU Flame Chart'), | ||
| ], | ||
| _buildTab(key: bottomUpTab, tabName: 'Bottom Up'), |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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)); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
packages/devtools_app/test/cpu_profiler/cpu_profiler_controller_test.dart
Show resolved
Hide resolved
| controller.setActiveFilter(query: 'Ba cat:foobar'); | ||
| expect( | ||
| controller.filteredData.value.toString(), | ||
| equals('[1-FooBar-foobar]'), |
There was a problem hiding this comment.
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]'),
);
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.