GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — Trace key operations by amcasey · Pull Request #40063 · microsoft/TypeScript Conversation
Member
Produce output in Chrome's event tracing format so that it can be viewed in Chrome/Edge. Hat tip to Sam Saccone (@samccone) for suggesting the format.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
This was referenced
Closed
|
There was an error while loading. Please reload this page.
|
There are some noteworthy rough edges:
Updates:
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
CI failures are because I didn't update the harness System impl(s). That can wait until next week. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
There are deliberately few trace events in the checker to avoid (excessively) skewing the runtime. If people would like to see more, e.g. for debugging, my inclination would be to add a separate mode (i.e. profiling trace vs activity trace). Note that the persistence format is JSON, so it's very easy to create enormous trace files (e.g. adding |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Have you looked at the sources for |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Rough instructions for using it in its present state:
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Produce output in Chrome's event tracing format so that it can be viewed in Chrome/Edge.
b3861c8 to
00804d8
Compare
|
Having applied this to several repos now, I feel pretty confident that this is useful in its current state. Enriching it with additional tracepoints (e.g. for inference) or output (e.g. stack traces) can follow in future PRs. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| export function startTracing(configFilePath: string | undefined, traceDir: string, isBuildMode: boolean) { | ||
| Debug.assert(!traceFd, "Tracing already started"); | ||
|
|
||
| if (fs === undefined) { |
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
In the future we might be able to move some of this logic to a conditionally loaded module, similar to the extended debug information for flow nodes in ~/src/debug/dbg.ts loaded by ~/src/compiler/debug.ts:
TypeScript/src/compiler/debug.ts
Lines 655 to 668 in d896353
| // attempt to load extended debugging information | |
| try { | |
| if (sys && sys.require) { | |
| const basePath = getDirectoryPath(resolvePath(sys.getExecutingFilePath())); | |
| const result = sys.require(basePath, "./compiler-debug") as RequireResult<ExtendedDebugModule>; | |
| if (!result.error) { | |
| result.module.init(ts); | |
| extendedDebugModule = result.module; | |
| } | |
| } | |
| } | |
| catch { | |
| // do nothing | |
| } |
I've been thinking about moving more of ts.Debug into the external file to reduce the file size of tsc.js, typescript.js, and tsserver.js as well.
This obviously isn't something we need to do now, but we might want to consider putting it on the backlog.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
Andrew Casey (@amcasey) I'm having the problem that I am running this patch against 4.1.0-beta to also get the diff --git a/lib/tsc.js b/lib/tsc.js index c78b8d698ea730be5a363592a25eb5eb9815753b..4333d58e45d2b2a55724ce7f7894c482223fc36c 100644 --- a/lib/tsc.js +++ b/lib/tsc.js @@ -59317,7 +59317,13 @@ var ts; } } function checkExpression(node, checkMode, forceTuple) { - ts.tracing.begin("check", "checkExpression", { kind: node.kind, pos: node.pos, end: node.end }); + var parent = node.parent; + while (parent && parent.kind !== 300 /*SyntaxKind.SourceFile*/) { + parent = parent.parent + } + var sourceFile = parent; + + ts.tracing.begin("check", "checkExpression", { kind: node.kind, pos: node.pos, end: node.end, sourceFile: sourceFile && sourceFile.fileName || "unknown" }); var saveCurrentNode = currentNode; currentNode = node; instantiationCount = 0; |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Lenz Weber-Tronic (@phryneas) Thanks for the patch! I had an early version that included similar code (there's actually a helper for walking up to the source file) but concluded that the extra tree walking was distorting the timing and the paths were bloating the log file excessively. Since readability wasn't a goal for v1, I left it out. When I've encountered the problem in practice, I've used code inspection on the frames that are in the right file plus types from later in the call stack to work out what was going on. p.s. Sorry about the confusion this caused you - it's frustrating to waste time on things like that. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.