Skip to content

Commit

Permalink
Add an option to profile AppImage
Browse files Browse the repository at this point in the history
Add to `-debug.profile` on startup to turn on the profiler on a local
machine and dump data to `profiling.npss` file. Previously not possible
in a standalone setup.

Useful for #9789.
  • Loading branch information
hubertp committed May 19, 2024
1 parent fe28c23 commit 4c95ea9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
10 changes: 10 additions & 0 deletions app/ide-desktop/lib/client/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,16 @@ export const CONFIG = contentConfig.OPTIONS.merge(
value: false,
description: 'Run the application in development mode.',
}),
profile: new contentConfig.Option({
passToWebApplication: false,
value: false,
description: 'Start backend profiler on startup and log data to a profiling.npss file',
}),
profileTime: new contentConfig.Option({
passToWebApplication: false,
value: 120,
description: 'Time since backend startup for which profiling data will be collected, if enabled',
}),
},
}),
chrome: new contentConfig.Group({
Expand Down
4 changes: 3 additions & 1 deletion app/ide-desktop/lib/client/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,9 @@ class App {
})
const projectManagerUrl = `ws://${this.projectManagerHost}:${this.projectManagerPort}`
this.args.groups.engine.options.projectManagerUrl.value = projectManagerUrl
const backendOpts = this.args.groups.debug.options.verbose.value ? ['-vv'] : []
const backendVerboseOpts = this.args.groups.debug.options.verbose.value ? ['-vv'] : []
const backendProfileOpts = this.args.groups.debug.options.profile.value ? ['--profiling-path', 'profiling.npss', '--profiling-time', this.args.groups.debug.options.profileTime.value] : []
const backendOpts = backendVerboseOpts.concat(backendProfileOpts)
const backendEnv = Object.assign({}, process.env, {
// These are environment variables, and MUST be in CONSTANT_CASE.
// eslint-disable-next-line @typescript-eslint/naming-convention
Expand Down

0 comments on commit 4c95ea9

Please sign in to comment.