Skip to content

Commit

Permalink
add application.experimental.rendererProfiling setting (defaults to…
Browse files Browse the repository at this point in the history
… false) (#164237)

#163819
  • Loading branch information
jrieken authored Oct 21, 2022
1 parent 9f065d0 commit a7b1c3e
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import { Extensions, IWorkbenchContributionsRegistry } from 'vs/workbench/common
import { StartupProfiler } from './startupProfiler';
import { StartupTimings } from './startupTimings';
import { RendererProfiling } from 'vs/workbench/contrib/performance/electron-sandbox/rendererAutoProfiler';
import { IConfigurationRegistry, Extensions as ConfigExt } from 'vs/platform/configuration/common/configurationRegistry';
import { localize } from 'vs/nls';


Registry.as<IWorkbenchContributionsRegistry>(Extensions.Workbench).registerWorkbenchContribution(
Expand All @@ -29,3 +31,16 @@ Registry.as<IWorkbenchContributionsRegistry>(Extensions.Workbench).registerWorkb
StartupTimings,
LifecyclePhase.Eventually
);

Registry.as<IConfigurationRegistry>(ConfigExt.Configuration).registerConfiguration({
id: 'application',
order: 100,
type: 'object',
'properties': {
'application.experimental.rendererProfiling': {
type: 'boolean',
default: false,
markdownDescription: localize('experimental.rendererProfiling', "When enabled slow renderers are automatically profiled")
}
}
});
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import { timeout } from 'vs/base/common/async';
import { generateUuid } from 'vs/base/common/uuid';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
import { ILogService } from 'vs/platform/log/common/log';
import { INativeHostService } from 'vs/platform/native/electron-sandbox/native';
Expand All @@ -20,6 +21,7 @@ export class RendererProfiling {
@IEnvironmentService environmentService: IEnvironmentService,
@ILogService logService: ILogService,
@ITimerService timerService: ITimerService,
@IConfigurationService configService: IConfigurationService
) {

const devOpts = parseExtensionDevOptions(environmentService);
Expand Down Expand Up @@ -50,6 +52,11 @@ export class RendererProfiling {
return;
}

if (!configService.getValue('application.experimental.rendererProfiling')) {
logService.debug(`[perf] SLOW task detected (${maxDuration}ms) but renderer profiling is disabled via 'application.experimental.rendererProfiling'`);
return;
}

const sessionId = generateUuid();
// start heartbeat monitoring
logService.warn(`[perf] Renderer reported VERY LONG TASK (${maxDuration}ms), starting profiling session '${sessionId}'`);
Expand Down

0 comments on commit a7b1c3e

Please sign in to comment.