2
>
* Copyright (c) Microsoft Corporation. All rights reserved.
3
>
* Licensed under the MIT License. See License.txt in the project root for license information.
4
>
*--------------------------------------------------------------------------------------------*/
5
>
6
>
import type * as vscode from 'vscode';
7
>
import * as errors from '../../../base/common/errors.js';
8
>
import { Disposable, IDisposable } from '../../../base/common/lifecycle.js';
9
>
import { ExtensionDescriptionRegistry } from '../../services/extensions/common/extensionDescriptionRegistry.js';
10
>
import { ExtensionIdentifier, ExtensionIdentifierMap } from '../../../platform/extensions/common/extensions.js';
11
>
import { ExtensionActivationReason, MissingExtensionDependency } from '../../services/extensions/common/extensions.js';
12
>
import { ILogService } from '../../../platform/log/common/log.js';
13
>
import { Barrier } from '../../../base/common/async.js';
14
>
15
>
/**
16
>
* Represents the source code (module) of an extension.
17
>
*/
18
>
export interface IExtensionModule {
19
>
activate?(ctx: vscode.ExtensionContext): Promise<IExtensionAPI>;
20
>
deactivate?(): void;
21
>
}
22
>
23
>
/**
24
>
* Represents the API of an extension (return value of `activate`).
25
>
*/
26
>
export interface IExtensionAPI {
27
>
// _extensionAPIBrand: any;
28
>
}
29
>
30
>
export type ExtensionActivationTimesFragment = {
31
>
startup?: { classification: 'SystemMetaData'; purpose: 'PerformanceAndHealth'; comment: 'Activation occurred during startup' };
32
>
codeLoadingTime?: { classification: 'SystemMetaData'; purpose: 'PerformanceAndHealth'; comment: 'Time it took to load the extension\'s code' };
33
>
activateCallTime?: { classification: 'SystemMetaData'; purpose: 'PerformanceAndHealth'; comment: 'Time it took to call activate' };
34
>
activateResolvedTime?: { classification: 'SystemMetaData'; purpose: 'PerformanceAndHealth'; comment: 'Time it took for async-activation to finish' };
35
>
};
36
>
37
>
export class ExtensionActivationTimes {
38
>
39
>
public static readonly NONE = new ExtensionActivationTimes(false, -1, -1, -1);
40
>
41
>
public readonly startup: boolean;
42
>
public readonly codeLoadingTime: number;
43
>
public readonly activateCallTime: number;
44
>
public readonly activateResolvedTime: number;
45
>
46
>
constructor(startup: boolean, codeLoadingTime: number, activateCallTime: number, activateResolvedTime: number) {
47
>
this.startup = startup;
48
>
this.codeLoadingTime = codeLoadingTime;
49
>
this.activateCallTime = activateCallTime;
50
>
this.activateResolvedTime = activateResolvedTime;
51
>
}
52
>
}
53
>
54
>
export class ExtensionActivationTimesBuilder {
55
>
56
>
private readonly _startup: boolean;
57
>
private _codeLoadingStart: number;
58
>
private _codeLoadingStop: number;
59
>
private _activateCallStart: number;
60
>
private _activateCallStop: number;
61
>
private _activateResolveStart: number;
62
>
private _activateResolveStop: number;
63
>
64
>
constructor(startup: boolean) {
65
this._startup = startup;
66
this._codeLoadingStart = -1;