@@ -96,7 +96,11 @@ const UIStrings = {
9696 */
9797 dropTimelineFileOrUrlHere : 'Drop trace file or URL here' ,
9898 /**
99- * @description Title of capture layers and pictures setting in timeline panel of the performance panel
99+ * @description Title of disable capture jsprofile setting in timeline panel of the performance panel
100+ */
101+ disableJavascriptSamples : 'Disable JavaScript samples' ,
102+ /**
103+ *@description Title of capture layers and pictures setting in timeline panel of the performance panel
100104 */
101105 enableAdvancedPaint : 'Enable advanced paint instrumentation (slow)' ,
102106 /**
@@ -138,6 +142,10 @@ const UIStrings = {
138142 /**
139143 * @description Text in Timeline Panel of the Performance panel
140144 */
145+ disablesJavascriptSampling : 'Disables JavaScript sampling, reduces overhead when running against mobile devices' ,
146+ /**
147+ *@description Text in Timeline Panel of the Performance panel
148+ */
141149 capturesAdvancedPaint : 'Captures advanced paint instrumentation, introduces significant performance overhead' ,
142150 /**
143151 * @description Text in Timeline Panel of the Performance panel
@@ -174,6 +182,10 @@ const UIStrings = {
174182 /**
175183 * @description Text in Timeline Panel of the Performance panel
176184 */
185+ JavascriptSamplingIsDisabled : '- JavaScript sampling is disabled' ,
186+ /**
187+ *@description Text in Timeline Panel of the Performance panel
188+ */
177189 stoppingTimeline : 'Stopping timeline…' ,
178190 /**
179191 * @description Text in Timeline Panel of the Performance panel
@@ -322,6 +334,7 @@ export class TimelinePanel extends Common.ObjectWrapper.eventMixin<EventTypes, t
322334 private readonly toggleRecordAction : UI . ActionRegistration . Action ;
323335 private readonly recordReloadAction : UI . ActionRegistration . Action ;
324336 readonly #historyManager: TimelineHistoryManager ;
337+ private disableCaptureJSProfileSetting : Common . Settings . Setting < boolean > ;
325338 private readonly captureLayersAndPicturesSetting : Common . Settings . Setting < boolean > ;
326339 private readonly captureSelectorStatsSetting : Common . Settings . Setting < boolean > ;
327340 readonly #thirdPartyTracksSetting: Common . Settings . Setting < boolean > ;
@@ -453,6 +466,9 @@ export class TimelinePanel extends Common.ObjectWrapper.eventMixin<EventTypes, t
453466
454467 this . traceLoadStart = null ;
455468
469+ this . disableCaptureJSProfileSetting = Common . Settings . Settings . instance ( ) . createSetting (
470+ 'timeline-disable-js-sampling' , false , Common . Settings . SettingStorageType . SESSION ) ;
471+ this . disableCaptureJSProfileSetting . setTitle ( i18nString ( UIStrings . disableJavascriptSamples ) ) ;
456472 this . captureLayersAndPicturesSetting = Common . Settings . Settings . instance ( ) . createSetting (
457473 'timeline-capture-layers-and-pictures' , false , Common . Settings . SettingStorageType . SESSION ) ;
458474 this . captureLayersAndPicturesSetting . setTitle ( i18nString ( UIStrings . enableAdvancedPaint ) ) ;
@@ -1217,6 +1233,7 @@ export class TimelinePanel extends Common.ObjectWrapper.eventMixin<EventTypes, t
12171233 this ) ;
12181234 SDK . CPUThrottlingManager . CPUThrottlingManager . instance ( ) . addEventListener (
12191235 SDK . CPUThrottlingManager . Events . RATE_CHANGED , this . updateShowSettingsToolbarButton , this ) ;
1236+ this . disableCaptureJSProfileSetting . addChangeListener ( this . updateShowSettingsToolbarButton , this ) ;
12201237 this . captureLayersAndPicturesSetting . addChangeListener ( this . updateShowSettingsToolbarButton , this ) ;
12211238 this . captureSelectorStatsSetting . addChangeListener ( this . updateShowSettingsToolbarButton , this ) ;
12221239
@@ -1229,16 +1246,20 @@ export class TimelinePanel extends Common.ObjectWrapper.eventMixin<EventTypes, t
12291246 cpuThrottlingPane . append ( this . cpuThrottlingSelect . control . element ) ;
12301247
12311248 this . settingsPane . append ( UI . SettingsUI . createSettingCheckbox (
1232- this . captureLayersAndPicturesSetting . title ( ) , this . captureLayersAndPicturesSetting ,
1233- i18nString ( UIStrings . capturesAdvancedPaint ) ) ) ;
1249+ this . captureSelectorStatsSetting . title ( ) , this . captureSelectorStatsSetting ,
1250+ i18nString ( UIStrings . capturesSelectorStats ) ) ) ;
12341251
12351252 const networkThrottlingPane = this . settingsPane . createChild ( 'div' ) ;
12361253 networkThrottlingPane . append ( i18nString ( UIStrings . network ) ) ;
12371254 networkThrottlingPane . append ( this . createNetworkConditionsSelectToolbarItem ( ) . element ) ;
12381255
12391256 this . settingsPane . append ( UI . SettingsUI . createSettingCheckbox (
1240- this . captureSelectorStatsSetting . title ( ) , this . captureSelectorStatsSetting ,
1241- i18nString ( UIStrings . capturesSelectorStats ) ) ) ;
1257+ this . captureLayersAndPicturesSetting . title ( ) , this . captureLayersAndPicturesSetting ,
1258+ i18nString ( UIStrings . capturesAdvancedPaint ) ) ) ;
1259+
1260+ this . settingsPane . append ( UI . SettingsUI . createSettingCheckbox (
1261+ this . disableCaptureJSProfileSetting . title ( ) , this . disableCaptureJSProfileSetting ,
1262+ i18nString ( UIStrings . disablesJavascriptSampling ) ) ) ;
12421263
12431264 const thirdPartyCheckbox =
12441265 this . createSettingCheckbox ( this . #thirdPartyTracksSetting, i18nString ( UIStrings . showDataAddedByExtensions ) ) ;
@@ -1627,6 +1648,9 @@ export class TimelinePanel extends Common.ObjectWrapper.eventMixin<EventTypes, t
16271648 if ( this . captureSelectorStatsSetting . get ( ) ) {
16281649 messages . push ( i18nString ( UIStrings . SelectorStatsEnabled ) ) ;
16291650 }
1651+ if ( this . disableCaptureJSProfileSetting . get ( ) ) {
1652+ messages . push ( i18nString ( UIStrings . JavascriptSamplingIsDisabled ) ) ;
1653+ }
16301654
16311655 this . showSettingsPaneButton . setChecked ( messages . length > 0 ) ;
16321656 this . showSettingsPaneButton . element . style . setProperty ( '--dot-toggle-top' , '16px' ) ;
@@ -1769,7 +1793,7 @@ export class TimelinePanel extends Common.ObjectWrapper.eventMixin<EventTypes, t
17691793 await this . #navigateToAboutBlank( ) ;
17701794 }
17711795 const recordingOptions = {
1772- enableJSSampling : true ,
1796+ enableJSSampling : ! this . disableCaptureJSProfileSetting . get ( ) ,
17731797 capturePictures : this . captureLayersAndPicturesSetting . get ( ) ,
17741798 captureFilmStrip : this . showScreenshotsSetting . get ( ) ,
17751799 captureSelectorStats : this . captureSelectorStatsSetting . get ( ) ,
0 commit comments