@@ -9,6 +9,7 @@ import { promisify } from "util";
99import * as vscode from "vscode" ;
1010import { sendInfo } from "vscode-extension-telemetry-wrapper" ;
1111import { LSDaemon } from "./daemon" ;
12+ import { activatingTimestamp } from "../extension" ;
1213const execFile = promisify ( cp . execFile ) ;
1314
1415interface IJdtlsMetadata {
@@ -59,6 +60,9 @@ export class ProcessWatcher {
5960 public monitor ( ) {
6061 const id = setInterval ( ( ) => {
6162 this . upTime ( ) . then ( seconds => {
63+ if ( ! this . lastHeartbeat && seconds ) {
64+ this . sendClientInitializeTime ( seconds ) ;
65+ }
6266 this . lastHeartbeat = seconds ;
6367 } ) . catch ( _e => {
6468 clearInterval ( id ) ;
@@ -99,6 +103,23 @@ export class ProcessWatcher {
99103 } ) ;
100104 this . daemon . logWatcher . sendErrorAndStackOnCrash ( ) ;
101105 }
106+
107+ /**
108+ * Send the time the client takes to initialize. This is the time between the
109+ * activation and the JVM process is launched.
110+ */
111+ private sendClientInitializeTime ( seconds : string ) {
112+ const upTime = seconds . match ( / \d + \. \d + / ) ?. toString ( ) ;
113+ if ( upTime ) {
114+ let interval = Math . round (
115+ performance . now ( ) - activatingTimestamp - parseFloat ( upTime ) * 1000
116+ ) ;
117+ sendInfo ( "" , {
118+ name : "client-initialize-time" ,
119+ message : interval . toString ( )
120+ } ) ;
121+ }
122+ }
102123}
103124
104125
0 commit comments