Skip to content

runtime/trace: stop treating cgo calls as syscalls #64865

@dominikh

Description

@dominikh

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

Metadata

Metadata

Assignees

Labels

NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.compiler/runtimeIssues related to the Go compiler and/or runtime.

Type

No type

Projects

Status

Todo

Relationships

None yet

Development

No branches or pull requests

Issue actions