// GoSysExit has to happen when we have a P, but before GoStart.
// So we emit it here.
if gp.syscallsp != 0 && gp.trace.sysBlockTraced {
- traceGoSysExit(gp.trace.sysExitTicks)
+ traceGoSysExit()
}
traceGoStart()
}
return
}
- gp.trace.sysExitTicks = 0
if traceEnabled() {
// Wait till traceGoSysBlock event is emitted.
// This ensures consistency of the trace (the goroutine is started after it is blocked).
osyield()
}
}
- traceGoSysExit(0)
+ traceGoSysExit()
}
})
if ok {
// Denote blocking of the new syscall.
traceGoSysBlock(gp.m.p.ptr())
// Denote completion of the current syscall.
- traceGoSysExit(0)
+ traceGoSysExit()
})
}
gp.m.p.ptr().syscalltick++
traceGoStart()
// Note: ticksStart needs to be set after we emit traceEvGoInSyscall events.
// If we do it the other way around, it is possible that exitsyscall will
- // query sysexitticks after ticksStart but before traceEvGoInSyscall timestamp.
+ // query sysExitTicks after ticksStart but before traceEvGoInSyscall timestamp.
// It will lead to a false conclusion that cputicks is broken.
trace.ticksStart = cputicks()
trace.timeStart = nanotime()
traceEvent(traceEvGoSysCall, skip)
}
-func traceGoSysExit(ts int64) {
+func traceGoSysExit() {
+ gp := getg().m.curg
+ ts := gp.trace.sysExitTicks
if ts != 0 && ts < trace.ticksStart {
- // There is a race between the code that initializes sysexitticks
+ // There is a race between the code that initializes sysExitTicks
// (in exitsyscall, which runs without a P, and therefore is not
// stopped with the rest of the world) and the code that initializes
- // a new trace. The recorded sysexitticks must therefore be treated
+ // a new trace. The recorded sysExitTicks must therefore be treated
// as "best effort". If they are valid for this trace, then great,
// use them for greater accuracy. But if they're not valid for this
// trace, assume that the trace was started after the actual syscall
// aka right now), and assign a fresh time stamp to keep the log consistent.
ts = 0
}
- gp := getg().m.curg
+ gp.trace.sysExitTicks = 0
gp.trace.seq++
gp.trace.lastP = gp.m.p
traceEvent(traceEvGoSysExit, -1, gp.goid, gp.trace.seq, uint64(ts)/traceTickDiv)