I've been trying to implement this for a while without any success, really, and I'm wondering if I can get a little more guidance. I have a logging function set up in the Isolate class, and my understanding is that I need to add an external reference to that function in order to call it from builtins/builtins-microtask-queue-gen.cc.
Can anyone provide a little more detail about how I might log the beginning and end of microtask execution, along with the associated script ID? On Thursday, April 4, 2019 at 4:45:43 AM UTC-5, Ben Noordhuis wrote: > > On Tue, Apr 2, 2019 at 8:38 PM <[email protected] <javascript:>> 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 [email protected] 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 [email protected]. For more options, visit https://groups.google.com/d/optout.
