Skip to content

Commit

Permalink
Add an option to profile AppImage (#9998)
Browse files Browse the repository at this point in the history
* Add an option to profile AppImage

Add `-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.

* fix linter

* fix linter warning

* more linting

* lint
  • Loading branch information
hubertp authored Jun 13, 2024
1 parent 0ff2ed6 commit 6163733
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
1 change: 0 additions & 1 deletion app/gui2/src/composables/syncLocalStorage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { useAbortScope } from '@/util/net'
import { debouncedWatch, useLocalStorage } from '@vueuse/core'
import { encoding } from 'lib0'
import { xxHash128 } from 'shared/ast/ffi'
import { assert } from 'shared/util/assert'
import { AbortScope } from 'shared/util/net'
import { computed, getCurrentInstance, ref, watch, withCtx } from 'vue'

Expand Down
13 changes: 13 additions & 0 deletions app/ide-desktop/lib/client/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export const HELP_EXTENDED_OPTION_NAME = naming.camelToKebabCase(HELP_EXTENDED_N
const DEFAULT_WIDTH = 1380
const DEFAULT_HEIGHT = 900
const DEFAULT_PORT = 8080
const DEFAULT_PROFILING_TIME = 120

// ==================
// === WindowSize ===
Expand Down Expand Up @@ -313,6 +314,18 @@ 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: DEFAULT_PROFILING_TIME,
description:
'Time since backend startup for which profiling data will be collected, if enabled',
}),
},
}),
chrome: new contentConfig.Group({
Expand Down
9 changes: 8 additions & 1 deletion app/ide-desktop/lib/client/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,14 @@ 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 backendProfileTime = this.args.groups.debug.options.profileTime.value
? ['--profiling-time', String(this.args.groups.debug.options.profileTime.value)]
: ['--profiling-time', '120']
const backendProfileOpts = this.args.groups.debug.options.profile.value
? ['--profiling-path', 'profiling.npss', ...backendProfileTime]
: []
const backendOpts = [...backendVerboseOpts, ...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 6163733

Please sign in to comment.