Skip to content

Commit

Permalink
feat: accurately measure extension startup performance
Browse files Browse the repository at this point in the history
  • Loading branch information
Codeneos committed Aug 20, 2023
1 parent 0dd7048 commit 87d7e88
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions packages/vscode-extension/src/extension.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
const startTime = Date.now(); // Track start up performance

// Easier debugging with source maps
//import 'source-map-support/register';
import * as vscode from 'vscode';
import * as vlocityPackageManifest from 'vlocity/package.json';
import vlocityPackageManifest from 'vlocity/package.json';

import * as constants from './constants';
import { LogManager, LogLevel, Logger , ConsoleWriter, OutputChannelWriter, TerminalWriter , container, LifecyclePolicy, Container, FileSystem, NodeFileSystem } from '@vlocode/core';
Expand Down Expand Up @@ -35,6 +32,12 @@ import { SfdxConfigWatcher } from './lib/sfdxConfigWatcher';

import './commands';

/**
* Start time of the extension set when the extension is packed by webpack when the entry point is loaded
* by VSCode. This is used to determine the startup time of the extension.
*/
declare const __vlocodeStartTime: number | undefined;

class VlocityLogFilter {
private readonly vlocityLogFilterRegex = [
/^(Initializing Project|Using SFDX|Salesforce Org|Continuing Export|Adding to File|Deploy [0-9]* Items).*/i,
Expand Down Expand Up @@ -218,7 +221,7 @@ class Vlocode {

// track activation time
this.logger.focus();
this.logger.info(`Vlocode activated in ${Date.now() - startTime}ms`);
__vlocodeStartTime && this.logger.info(`Vlocode activated in ${Date.now() - __vlocodeStartTime}ms`);

// Connect to SF
void this.service.initialize();
Expand Down

0 comments on commit 87d7e88

Please sign in to comment.