runtime/trace: stop treating cgo calls as syscalls #64865
Labels
compiler/runtime
Issues related to the Go compiler and/or runtime.
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
The tracer currently treats calls into C as syscalls. In the old tracer, this was fine, because cgo calls are either few or they don't take enough time to cause state transitions. However, the new tracer emits state transitions for all syscalls, regardless of duration.
For OpenGL applications that don't have optimized renderers this can result in hundreds to thousands of state transitions per frame, two per call into OpenGL. A trace of Gotraceui (with vsync disabled) managed to have 5 million spans in 2.5 seconds, with half of the spans being for "blocked in syscall" and the other half being for "running."
With the new implementation, treating cgo calls as syscalls is as tenable as tracing every Go function call.
Treating cgo calls as syscalls was never done intentionally as far as I can tell, and is a side-effect of the implementation.
/cc @mknyszek
The text was updated successfully, but these errors were encountered: