@@ -5,6 +5,7 @@ if ((Reflect as any).metadata === undefined) {
5
5
// tslint:disable-next-line:no-require-imports no-var-requires
6
6
require ( 'reflect-metadata' ) ;
7
7
}
8
+ const durations : { [ key : string ] : number } = { } ;
8
9
import { StopWatch } from '../utils/stopWatch' ;
9
10
// Do not move this linne of code (used to measure extension load times).
10
11
const stopWatch = new StopWatch ( ) ;
@@ -64,10 +65,12 @@ import { OnEnterFormatter } from './typeFormatters/onEnterFormatter';
64
65
import { TEST_OUTPUT_CHANNEL } from './unittests/common/constants' ;
65
66
import { registerTypes as unitTestsRegisterTypes } from './unittests/serviceRegistry' ;
66
67
68
+ durations . codeLoadingTime = stopWatch . elapsedTime ;
67
69
const activationDeferred = createDeferred < void > ( ) ;
68
70
69
71
// tslint:disable-next-line:max-func-body-length
70
72
export async function activate ( context : ExtensionContext ) : Promise < IExtensionApi > {
73
+ durations . startActivateTime = stopWatch . elapsedTime ;
71
74
const cont = new Container ( ) ;
72
75
const serviceManager = new ServiceManager ( cont ) ;
73
76
const serviceContainer = new ServiceContainer ( cont ) ;
@@ -163,6 +166,7 @@ export async function activate(context: ExtensionContext): Promise<IExtensionApi
163
166
} ) ;
164
167
165
168
serviceContainer . get < IDebuggerBanner > ( IDebuggerBanner ) . initialize ( ) ;
169
+ durations . endActivateTime = stopWatch . elapsedTime ;
166
170
activationDeferred . resolve ( ) ;
167
171
168
172
return { ready : activationDeferred . promise } ;
@@ -213,7 +217,6 @@ async function sendStartupTelemetry(activatedPromise: Promise<void>, serviceCont
213
217
await activatedPromise ;
214
218
const terminalHelper = serviceContainer . get < ITerminalHelper > ( ITerminalHelper ) ;
215
219
const terminalShellType = terminalHelper . identifyTerminalShell ( terminalHelper . getTerminalShellPath ( ) ) ;
216
- const duration = stopWatch . elapsedTime ;
217
220
const condaLocator = serviceContainer . get < ICondaService > ( ICondaService ) ;
218
221
const interpreterService = serviceContainer . get < IInterpreterService > ( IInterpreterService ) ;
219
222
const [ condaVersion , interpreter , interpreters ] = await Promise . all ( [
@@ -230,7 +233,7 @@ async function sendStartupTelemetry(activatedPromise: Promise<void>, serviceCont
230
233
. length > 0 ;
231
234
232
235
const props = { condaVersion, terminal : terminalShellType , pythonVersion, interpreterType, workspaceFolderCount, hasPython3 } ;
233
- sendTelemetryEvent ( EDITOR_LOAD , duration , props ) ;
236
+ sendTelemetryEvent ( EDITOR_LOAD , durations , props ) ;
234
237
} catch ( ex ) {
235
238
logger . logError ( 'sendStartupTelemetry failed.' , ex ) ;
236
239
}
0 commit comments