On Tue, Apr 2, 2019 at 8:38 PM <pmmurley...@gmail.com> wrote:
> I am trying to track which scripts are responsible for executing microtasks 
> (by ScriptId).
>
> I am instrumenting MicrotaskQueue::RunMicrotasks to show when microtask 
> execution begins and ends, but I want to track which script is responsible 
> for things that happen during microtask execution.
>
> Essentially, I'd just like to generate a trace that logs the following info:
>
> "Microtask generated by scriptId X begins execution"
> "Microtask generated by scriptId X ends execution"
>
> Any ideas on how/where to insert instrumentation to achieve this? Thanks!

It's unfortunately not really easy to accomplish because the dispatch
normally happens in AOT-generated machine code, not run-time C++ code.
Specifically, the RunMicrotasks and RunSingleMicrotask builtins in
src/builtins/builtins-microtask-queue-gen.cc (and note that you need
to filter on microtasks of type CALLABLE_TASK_TYPE and maybe the
PROMISE_* types.)

It _is_ possible to call out to C functions from there but it's not
exactly trivial either: grep src/builtins for "CallCFunction" (there
are many variants) for examples. Hope that helps!

-- 
-- 
v8-dev mailing list
v8-dev@googlegroups.com
http://groups.google.com/group/v8-dev
--- 
You received this message because you are subscribed to the Google Groups 
"v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to