Skip to content

Commit

Permalink
fix tracing around cycle boundaries
Browse files Browse the repository at this point in the history
previously we would log a threadswitch whenever the current tid changes,
or if the cycle just started and the previous job tid isn't zero.

now we properly log a threadswitch if the _next_ job tid isn't zero.
we only set cycle_started to false if we run a non-tid0 task.

we still log on every tidswitch boundary if (not cycle_started).
  • Loading branch information
Corey Richardson committed Feb 14, 2019
1 parent f2c3955 commit 61f11fa
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/scheduler0.ml
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
open! Core_kernel
open! Import

include Types.Scheduler

let events t = t.time_source.events

let set_execution_context t execution_context =
(* Avoid a caml_modify in most cases. *)
(* XXX: see where job_queue also modifies current_execution_context *)
if not (phys_equal t.current_execution_context execution_context)
then (
if t.current_execution_context.tid <> execution_context.tid then (!Tracing.fns).trace_thread_switch execution_context
else if t.cycle_started && t.current_execution_context.tid <> 0 then ((!Tracing.fns).trace_thread_switch execution_context; t.cycle_started <- false) ;
if not (phys_equal t.current_execution_context execution_context) then (
if t.cycle_started && execution_context.tid <> 0 then (
!Tracing.fns.trace_thread_switch execution_context ;
t.cycle_started <- false )
else if
(not t.cycle_started)
&& t.current_execution_context.tid <> execution_context.tid
then !Tracing.fns.trace_thread_switch execution_context ;
t.current_execution_context <- execution_context )
;;

0 comments on commit 61f11fa

Please sign in to comment.