Skip to content

Commit 53883bd

Browse files
committed
Mark fields readonly
1 parent d00ce85 commit 53883bd

1 file changed

Lines changed: 44 additions & 45 deletions

File tree

src/vs/workbench/services/timer/electron-browser/timerService.ts

Lines changed: 44 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ import { IEditorService } from 'vs/workbench/services/editor/common/editorServic
3030
}
3131
*/
3232
export interface IMemoryInfo {
33-
workingSetSize: number;
34-
peakWorkingSetSize: number;
35-
privateBytes: number;
36-
sharedBytes: number;
33+
readonly workingSetSize: number;
34+
readonly peakWorkingSetSize: number;
35+
readonly privateBytes: number;
36+
readonly sharedBytes: number;
3737
}
3838

3939
/* __GDPR__FRAGMENT__
@@ -85,53 +85,53 @@ export interface IStartupMetrics {
8585
/**
8686
* The version of these metrics.
8787
*/
88-
version: 2;
88+
readonly version: 2;
8989

9090
/**
9191
* If this started the main process and renderer or just a renderer (new or reloaded).
9292
*/
93-
initialStartup: boolean;
93+
readonly initialStartup: boolean;
9494

9595
/**
9696
* No folder, no file, no workspace has been opened
9797
*/
98-
emptyWorkbench: boolean;
98+
readonly emptyWorkbench: boolean;
9999

100100
/**
101101
* This is the latest (stable/insider) version. Iff not we should ignore this
102102
* measurement.
103103
*/
104-
isLatestVersion: boolean;
104+
readonly isLatestVersion: boolean;
105105

106106
/**
107107
* Whether we asked for and V8 accepted cached data.
108108
*/
109-
didUseCachedData: boolean;
109+
readonly didUseCachedData: boolean;
110110

111111
/**
112112
* How/why the window was created. See https://github.com/Microsoft/vscode/blob/d1f57d871722f4d6ba63e4ef6f06287121ceb045/src/vs/platform/lifecycle/common/lifecycle.ts#L50
113113
*/
114-
windowKind: number;
114+
readonly windowKind: number;
115115

116116
/**
117117
* The total number of windows that have been restored/created
118118
*/
119-
windowCount: number;
119+
readonly windowCount: number;
120120

121121
/**
122122
* The active viewlet id or `undedined`
123123
*/
124-
viewletId?: string;
124+
readonly viewletId?: string;
125125

126126
/**
127127
* The active panel id or `undefined`
128128
*/
129-
panelId?: string;
129+
readonly panelId?: string;
130130

131131
/**
132132
* The editor input types or `[]`
133133
*/
134-
editorIds: string[];
134+
readonly editorIds: string[];
135135

136136
/**
137137
* The time it took to create the workbench.
@@ -146,12 +146,12 @@ export interface IStartupMetrics {
146146
* * The numbers of windows being restored (when starting 'fresh')
147147
* * The viewlet being restored (esp. when it's a contributed viewlet)
148148
*/
149-
ellapsed: number;
149+
readonly ellapsed: number;
150150

151151
/**
152152
* Individual timers...
153153
*/
154-
timers: {
154+
readonly timers: {
155155
/**
156156
* The time it took to receieve the [`ready`](https://electronjs.org/docs/api/app#event-ready)-event. Measured from the first line
157157
* of JavaScript code till receiving that event.
@@ -163,7 +163,7 @@ export interface IStartupMetrics {
163163
* * This is often affected by AV software (and can change with AV software updates outside of our release-cycle).
164164
* * It is not our code running here and we can only observe what's happening.
165165
*/
166-
ellapsedAppReady?: number;
166+
readonly ellapsedAppReady?: number;
167167

168168
/**
169169
* The time it took to generate NLS data.
@@ -173,7 +173,7 @@ export interface IStartupMetrics {
173173
* * This only happens when a non-english locale is being used.
174174
* * It is our code running here and we should monitor this carefully for regressions.
175175
*/
176-
ellapsedNlsGeneration?: number;
176+
readonly ellapsedNlsGeneration?: number;
177177

178178
/**
179179
* The time it took to tell electron to open/restore a renderer (browser window).
@@ -183,7 +183,7 @@ export interface IStartupMetrics {
183183
* * This can be compared between insider and stable builds.
184184
* * It is our code running here and we should monitor this carefully for regressions.
185185
*/
186-
ellapsedWindowLoad?: number;
186+
readonly ellapsedWindowLoad?: number;
187187

188188
/**
189189
* The time it took to create a new renderer (browser window) and to initialize that to the point
@@ -195,7 +195,7 @@ export interface IStartupMetrics {
195195
* * It is mostly not our code running here and we can only observe what's happening.
196196
*
197197
*/
198-
ellapsedWindowLoadToRequire: number;
198+
readonly ellapsedWindowLoadToRequire: number;
199199

200200
/**
201201
* The time it took to require the global storage DB, connect to it
@@ -204,23 +204,23 @@ export interface IStartupMetrics {
204204
* * Happens in the main-process
205205
* * Measured with the `main:willInitGlobalStorage` and `main:didInitGlobalStorage` performance marks.
206206
*/
207-
ellapsedGlobalStorageInitMain: number;
207+
readonly ellapsedGlobalStorageInitMain: number;
208208

209209
/**
210210
* The time it took to load the initial set of values from the global storage.
211211
*
212212
* * Happens in the renderer-process
213213
* * Measured with the `willInitGlobalStorage` and `didInitGlobalStorage` performance marks.
214214
*/
215-
ellapsedGlobalStorageInitRenderer: number;
215+
readonly ellapsedGlobalStorageInitRenderer: number;
216216

217217
/**
218218
* The time it took to require the workspace storage DB.
219219
*
220220
* * Happens in the renderer-process
221221
* * Measured with the `willRequireSQLite` and `didRequireSQLite` performance marks.
222222
*/
223-
ellapsedWorkspaceStorageRequire: number;
223+
readonly ellapsedWorkspaceStorageRequire: number;
224224

225225
/**
226226
* The time it took to require the workspace storage DB, connect to it
@@ -229,15 +229,15 @@ export interface IStartupMetrics {
229229
* * Happens in the renderer-process
230230
* * Measured with the `willInitWorkspaceStorage` and `didInitWorkspaceStorage` performance marks.
231231
*/
232-
ellapsedWorkspaceStorageInit: number;
232+
readonly ellapsedWorkspaceStorageInit: number;
233233

234234
/**
235235
* The time it took to initialize the workspace and configuration service.
236236
*
237237
* * Happens in the renderer-process
238238
* * Measured with the `willInitWorkspaceService` and `didInitWorkspaceService` performance marks.
239239
*/
240-
ellapsedWorkspaceServiceInit: number;
240+
readonly ellapsedWorkspaceServiceInit: number;
241241

242242
/**
243243
* The time it took to load the main-bundle of the workbench, e.g `workbench.main.js`.
@@ -248,7 +248,7 @@ export interface IStartupMetrics {
248248
* * This should be looked at with and without V8 cached data usage and per electron/v8 version
249249
* * This is affected by the size of our code bundle (which grows about 3-5% per release)
250250
*/
251-
ellapsedRequire: number;
251+
readonly ellapsedRequire: number;
252252

253253
/**
254254
* The time it took to read extensions' package.json-files *and* interpret them (invoking
@@ -262,11 +262,11 @@ export interface IStartupMetrics {
262262
*
263263
* todo@joh/ramya this measures an artifical dealy we have added, see https://github.com/Microsoft/vscode/blob/2f07ddae8bf56e969e3f4ba1447258ebc999672f/src/vs/workbench/services/extensions/electron-browser/extensionService.ts#L311-L326
264264
*/
265-
ellapsedExtensions: number;
265+
readonly ellapsedExtensions: number;
266266

267267
// the time from start till `didLoadExtensions`
268268
// remove?
269-
ellapsedExtensionsReady: number;
269+
readonly ellapsedExtensionsReady: number;
270270

271271
/**
272272
* The time it took to restore the viewlet.
@@ -276,7 +276,7 @@ export interface IStartupMetrics {
276276
* * This should be looked at per viewlet-type/id.
277277
* * Happens in parallel to other things, depends on async timing
278278
*/
279-
ellapsedViewletRestore: number;
279+
readonly ellapsedViewletRestore: number;
280280

281281
/**
282282
* The time it took to restore the panel.
@@ -286,7 +286,7 @@ export interface IStartupMetrics {
286286
* * This should be looked at per panel-type/id.
287287
* * Happens in parallel to other things, depends on async timing
288288
*/
289-
ellapsedPanelRestore: number;
289+
readonly ellapsedPanelRestore: number;
290290

291291
/**
292292
* The time it took to restore editors - that is text editor and complex editor likes the settings UI
@@ -299,7 +299,7 @@ export interface IStartupMetrics {
299299
*
300300
* todo@joh/ramya We should probably measures each editor individually?
301301
*/
302-
ellapsedEditorRestore: number;
302+
readonly ellapsedEditorRestore: number;
303303

304304
/**
305305
* The time it took to create the workbench.
@@ -309,23 +309,23 @@ export interface IStartupMetrics {
309309
*
310310
* todo@joh/ramya Not sure if this is useful because this includes too much
311311
*/
312-
ellapsedWorkbench: number;
312+
readonly ellapsedWorkbench: number;
313313

314314
// the time it took to generate this object.
315315
// remove?
316-
ellapsedTimersToTimersComputed: number;
316+
readonly ellapsedTimersToTimersComputed: number;
317317
};
318318

319-
hasAccessibilitySupport: boolean;
320-
isVMLikelyhood?: number;
321-
platform?: string;
322-
release?: string;
323-
arch?: string;
324-
totalmem?: number;
325-
freemem?: number;
326-
meminfo?: IMemoryInfo;
327-
cpus?: { count: number; speed: number; model: string; };
328-
loadavg?: number[];
319+
readonly hasAccessibilitySupport: boolean;
320+
readonly isVMLikelyhood?: number;
321+
readonly platform?: string;
322+
readonly release?: string;
323+
readonly arch?: string;
324+
readonly totalmem?: number;
325+
readonly freemem?: number;
326+
readonly meminfo?: IMemoryInfo;
327+
readonly cpus?: { count: number; speed: number; model: string; };
328+
readonly loadavg?: number[];
329329
}
330330

331331
export interface ITimerService {
@@ -349,8 +349,7 @@ class TimerService implements ITimerService {
349349
@IViewletService private readonly _viewletService: IViewletService,
350350
@IPanelService private readonly _panelService: IPanelService,
351351
@IEditorService private readonly _editorService: IEditorService,
352-
) {
353-
}
352+
) { }
354353

355354
get startupMetrics(): Promise<IStartupMetrics> {
356355
if (!this._startupMetrics) {

0 commit comments

Comments
 (0)