-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
UBERF-8052: Allow easy profiling of transactor
Signed-off-by: Andrey Sobolev <[email protected]>
- Loading branch information
Showing
21 changed files
with
358 additions
and
158 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -100,3 +100,4 @@ services/github/pod-github/src/github.graphql | |
dev/tool/report.csv | ||
bundle/* | ||
bundle.js.map | ||
tests/profiles |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -187,6 +187,12 @@ export function devTool ( | |
|
||
program.version('0.0.1') | ||
|
||
program.command('version').action(() => { | ||
console.log( | ||
`tools git_version: ${process.env.GIT_REVISION ?? ''} model_version: ${process.env.MODEL_VERSION ?? ''}` | ||
) | ||
}) | ||
|
||
// create-account [email protected] --password 123 --workspace workspace --fullname "John Appleseed" | ||
program | ||
.command('create-account <email>') | ||
|
@@ -937,8 +943,9 @@ export function devTool ( | |
program | ||
.command('generate-token <name> <workspace>') | ||
.description('generate token') | ||
.action(async (name: string, workspace: string) => { | ||
console.log(generateToken(name, getWorkspaceId(workspace))) | ||
.option('--admin', 'Generate token with admin access', false) | ||
.action(async (name: string, workspace: string, opt: { admin: boolean }) => { | ||
console.log(generateToken(name, getWorkspaceId(workspace), { ...(opt.admin ? { admin: 'true' } : {}) })) | ||
}) | ||
program | ||
.command('decode-token <token>') | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { PlatformError, unknownError } from '@hcengineering/platform' | ||
import * as inspector from 'node:inspector' | ||
|
||
let session: inspector.Session | undefined | ||
export function profileStart (): void { | ||
try { | ||
session = new inspector.Session() | ||
session.connect() | ||
|
||
session.post('Profiler.enable') | ||
session.post('Profiler.start') | ||
} catch (err) { | ||
console.error(err) | ||
} | ||
} | ||
|
||
export async function profileStop (): Promise<string | undefined> { | ||
return await new Promise<string | undefined>((resolve, reject) => { | ||
if (session == null) { | ||
reject(new PlatformError(unknownError('no session started'))) | ||
return | ||
} | ||
try { | ||
session.post('Profiler.stop', (err, profile) => { | ||
if (err != null) { | ||
reject(err) | ||
} else { | ||
const json = JSON.stringify(profile.profile) | ||
session?.disconnect() | ||
session = undefined | ||
resolve(json) | ||
} | ||
}) | ||
} catch (err) { | ||
reject(err) | ||
} | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.