Created
October 31, 2014 18:22
-
-
Save bmeck/5a2a06440b85c3d9740a to your computer and use it in GitHub Desktop.
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
Async Stack Traces in Chromium: | |
=== | |
These are only turned on once the debugger starts up due to performance hits! | |
Implementing this requires the ability to integrate with V8 on a C++ level or a suitable debugging agent for the V8 debug APIs | |
### Setup | |
1. Whenever a worker starts up (HTML page or Worker()) we create a NEW `AsyncCallChainTracker` for the `v8::Isolate` representing a task | |
### Aggregation | |
1. Whenever we start a task (`setImmediate` etc.) | |
1. Load up any AsyncCallChain associated with the task or create a new AsyncChain if there is none | |
2. Whenever we perform a known async action | |
* These are hard coded into Chromium, so you would need to modify the source to add more (this not a requirement technically speaking) | |
1. Create data representing this call chain | |
1. `V8::StackTrace::CurrentStackTrace()` represents the JS call stack | |
* **NB** this includes references to the `v8::StackFrame`s | |
2. `blink::ExecutionContext()` represents all the browser info like URL | |
2. Create a NEW AsyncCallChain by concatenating the current chain with the data that represents the async action | |
1. if the length of the chain is greater than our max, we are sure not to include the extras at the front | |
3. Store the AsyncCallChain on the JS task to be performed | |
### Inspection | |
1. Whenever we inspect a stack (not Error object) | |
1. Find out the Isolate it came from and its AsyncCallChainTracker | |
2. Get the current AsyncCallChain and dump all the call chain data |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment