From bae42e8b53a4f21aec6e26d7f7cc37eefd99f06e Mon Sep 17 00:00:00 2001 From: Kenzie Davisson Date: Fri, 17 Jan 2025 10:14:29 -0800 Subject: [PATCH] Bring "Include CPU samples" option out of settings menu --- .../timeline_events/timeline_events_view.dart | 33 ++++++++++--------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/packages/devtools_app/lib/src/screens/performance/panes/timeline_events/timeline_events_view.dart b/packages/devtools_app/lib/src/screens/performance/panes/timeline_events/timeline_events_view.dart index 946cc213549..3687b02c914 100644 --- a/packages/devtools_app/lib/src/screens/performance/panes/timeline_events/timeline_events_view.dart +++ b/packages/devtools_app/lib/src/screens/performance/panes/timeline_events/timeline_events_view.dart @@ -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), @@ -258,13 +268,6 @@ class _TimelineSettingsDialogState extends State List _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),