@@ -9,6 +9,7 @@ import { promisify } from "util";
9
9
import * as vscode from "vscode" ;
10
10
import { sendInfo } from "vscode-extension-telemetry-wrapper" ;
11
11
import { LSDaemon } from "./daemon" ;
12
+ import { activatingTimestamp } from "../extension" ;
12
13
const execFile = promisify ( cp . execFile ) ;
13
14
14
15
interface IJdtlsMetadata {
@@ -59,6 +60,9 @@ export class ProcessWatcher {
59
60
public monitor ( ) {
60
61
const id = setInterval ( ( ) => {
61
62
this . upTime ( ) . then ( seconds => {
63
+ if ( ! this . lastHeartbeat && seconds ) {
64
+ this . sendClientInitializeTime ( seconds ) ;
65
+ }
62
66
this . lastHeartbeat = seconds ;
63
67
} ) . catch ( _e => {
64
68
clearInterval ( id ) ;
@@ -99,6 +103,23 @@ export class ProcessWatcher {
99
103
} ) ;
100
104
this . daemon . logWatcher . sendErrorAndStackOnCrash ( ) ;
101
105
}
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
+ }
102
123
}
103
124
104
125
0 commit comments