Skip to content

Commit

Permalink
Bring "Include CPU samples" option out of settings menu (#8785)
Browse files Browse the repository at this point in the history
  • Loading branch information
kenzieschmoll authored Jan 17, 2025
1 parent 91e176c commit e2cde7b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -131,18 +131,28 @@ class TimelineEventsTabControls extends StatelessWidget {

@override
Widget build(BuildContext context) {
final showingOfflineData = offlineDataController.showingOfflineData.value;
return Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Padding(
padding: const EdgeInsets.only(right: densePadding),
child: PerfettoHelpButton(
perfettoController: controller.perfettoController,
if (!showingOfflineData)
Row(
children: [
const Text('Include CPU samples'),
const SizedBox(width: densePadding),
DevToolsTooltip(
message:
'Include CPU samples in the timeline\n'
'(this may negatively impact performance)',
child: NotifierSwitch(
notifier: preferences.performance.includeCpuSamplesInTimeline,
),
),
],
),
),
if (!offlineDataController.showingOfflineData.value) ...[
// TODO(kenz): add a switch to enable the CPU profiler once the
// tracing format supports it (when we switch to protozero).
const SizedBox(width: densePadding),
PerfettoHelpButton(perfettoController: controller.perfettoController),
if (!showingOfflineData) ...[
const SizedBox(width: densePadding),
const TimelineSettingsButton(),
const SizedBox(width: densePadding),
Expand Down Expand Up @@ -258,13 +268,6 @@ class _TimelineSettingsDialogState extends State<TimelineSettingsDialog>

List<Widget> _defaultRecordedStreams(ThemeData theme) {
return [
...dialogSubHeader(theme, 'General'),
CheckboxSetting(
notifier: preferences.performance.includeCpuSamplesInTimeline,
title: 'Include CPU samples in the timeline',
description: 'This may negatively affect performance.',
),
const SizedBox(height: defaultSpacing),
...dialogSubHeader(theme, 'Trace categories'),
RichText(text: TextSpan(text: 'Default', style: theme.subtleTextStyle)),
..._timelineStreams(advanced: false),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ void main() {
await tester.tap(find.text('Timeline Events'));
await tester.pumpAndSettle();

expect(find.byType(NotifierSwitch), findsOneWidget);
expect(find.byType(TimelineSettingsButton), findsOneWidget);
expect(find.byType(RefreshTimelineEventsButton), findsOneWidget);
expect(find.byType(TimelineEventsTabView), findsOneWidget);
Expand Down Expand Up @@ -227,6 +228,7 @@ void main() {
expect(find.byType(DevToolsTab), findsOneWidget);
expect(find.text('Timeline Events'), findsOneWidget);
expect(find.text('Frame Analysis'), findsNothing);
expect(find.text('Rebuild Stats'), findsNothing);
});
},
);
Expand Down

0 comments on commit e2cde7b

Please sign in to comment.