patch for eventlog tracing in forkProcess

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

patch for eventlog tracing in forkProcess

Duncan Coutts-3
Hi folks,

This is a bit of code I've had lying around for ages but that I never
properly tested or applied. This snippet is in danger of getting lost so
I'm sending it in and perhaps someone can try it.

There's this TODO in rts/Schedule.c forkProcess():

       // TODO: need to trace various other things in the child
       // like startup event, capabilities, process info etc

The context is that the RTS is doing a fork() and we have the eventlog
turned on. The child process makes is own new eventlog file. So events
we do during the startup of the RTS need to be duplicated here.

      // Trace various things in the child like startup event, capabilities,
      // process info etc. This is all so that the eventlog for the new
      // child process will have same stuff as if it were started standalone.
      traceCapsetCreate(CAPSET_OSPROCESS_DEFAULT, CapsetTypeOsProcess);
      traceCapsetCreate(CAPSET_CLOCKDOMAIN_DEFAULT, CapsetTypeClockdomain);
      for (i=0; i < n_capabilities; i++) {
          traceCapsetAssignCap(CAPSET_OSPROCESS_DEFAULT, i);
          traceCapsetAssignCap(CAPSET_CLOCKDOMAIN_DEFAULT, i);
      #if defined(THREADED_RTS)

To test this you'd want to compare the eventlog in the child with one
you get from a normal startup and see if there's anything odd / missing

See also ghc-event merge which can merge eventlogs from multiple
processes by aligning to a common wall clock time.

Duncan Coutts, Haskell Consultant
Well-Typed LLP,