mirror of
https://github.com/Microsoft/vscode
synced 2024-09-18 01:58:27 +00:00
perf - add a mark for how long it takes to connect to shared process
This commit is contained in:
parent
072ec46dcf
commit
986996a7da
|
@ -12,6 +12,7 @@ import { generateUuid } from 'vs/base/common/uuid';
|
|||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
import { Disposable } from 'vs/base/common/lifecycle';
|
||||
import { ISharedProcessService } from 'vs/platform/ipc/electron-sandbox/services';
|
||||
import { mark } from 'vs/base/common/performance';
|
||||
|
||||
export class SharedProcessService extends Disposable implements ISharedProcessService {
|
||||
|
||||
|
@ -30,6 +31,7 @@ export class SharedProcessService extends Disposable implements ISharedProcessSe
|
|||
|
||||
private async connect(): Promise<MessagePortClient> {
|
||||
this.logService.trace('Renderer->SharedProcess#connect');
|
||||
mark('code/willConnectSharedProcess');
|
||||
|
||||
// Ask to create message channel inside the window
|
||||
// and send over a UUID to correlate the response
|
||||
|
@ -42,6 +44,7 @@ export class SharedProcessService extends Disposable implements ISharedProcessSe
|
|||
const onMessageChannelResult = Event.fromDOMEventEmitter<{ nonce: string, port: MessagePort, source: unknown }>(window, 'message', (e: MessageEvent) => ({ nonce: e.data, port: e.ports[0], source: e.source }));
|
||||
const { port } = await Event.toPromise(Event.once(Event.filter(onMessageChannelResult, e => e.nonce === nonce && e.source === window)));
|
||||
|
||||
mark('code/didConnectSharedProcess');
|
||||
this.logService.trace('Renderer->SharedProcess#connect: connection established');
|
||||
|
||||
return this._register(new MessagePortClient(port, `window:${this.nativeHostService.windowId}`));
|
||||
|
|
|
@ -177,6 +177,7 @@ class PerfModelContentProvider implements ITextModelContentProvider {
|
|||
table.push(['init storage (global & workspace)', metrics.timers.ellapsedStorageInit, '[renderer]', undefined]);
|
||||
table.push(['require & init workspace storage', metrics.timers.ellapsedWorkspaceStorageInit, '[renderer]', undefined]);
|
||||
table.push(['init workspace service', metrics.timers.ellapsedWorkspaceServiceInit, '[renderer]', undefined]);
|
||||
table.push(['connect to shared process', metrics.timers.ellapsedSharedProcesConnectionCreate, '[renderer]', undefined]);
|
||||
if (isWeb) {
|
||||
table.push(['init settings and global state from settings sync service', metrics.timers.ellapsedRequiredUserDataInit, '[renderer]', undefined]);
|
||||
table.push(['init keybindings, snippets & extensions from settings sync service', metrics.timers.ellapsedOtherUserDataInit, '[renderer]', undefined]);
|
||||
|
|
|
@ -232,6 +232,14 @@ export interface IStartupMetrics {
|
|||
*/
|
||||
readonly ellapsedWorkspaceServiceInit: number;
|
||||
|
||||
/**
|
||||
* The time it took to connect to the shared process.
|
||||
*
|
||||
* * Happens in the renderer-process
|
||||
* * Measured with the `willConnectSharedProcess` and `didConnectSharedProcess` performance marks.
|
||||
*/
|
||||
readonly ellapsedSharedProcesConnectionCreate: number;
|
||||
|
||||
/**
|
||||
* The time it took to initialize required user data (settings & global state) using settings sync service.
|
||||
*
|
||||
|
@ -524,6 +532,7 @@ export abstract class AbstractTimerService implements ITimerService {
|
|||
ellapsedRequire: this._marks.getDuration('code/willLoadWorkbenchMain', 'code/didLoadWorkbenchMain'),
|
||||
ellapsedWaitForShellEnv: this._marks.getDuration('code/willWaitForShellEnv', 'code/didWaitForShellEnv'),
|
||||
ellapsedStorageInit: this._marks.getDuration('code/willInitStorage', 'code/didInitStorage'),
|
||||
ellapsedSharedProcesConnectionCreate: this._marks.getDuration('code/willConnectSharedProcess', 'code/didConnectSharedProcess'),
|
||||
ellapsedWorkspaceStorageInit: this._marks.getDuration('code/willInitWorkspaceStorage', 'code/didInitWorkspaceStorage'),
|
||||
ellapsedWorkspaceServiceInit: this._marks.getDuration('code/willInitWorkspaceService', 'code/didInitWorkspaceService'),
|
||||
ellapsedRequiredUserDataInit: this._marks.getDuration('code/willInitRequiredUserData', 'code/didInitRequiredUserData'),
|
||||
|
|
Loading…
Reference in a new issue