From: Michael Anthony Knyszek Date: Tue, 9 May 2023 19:36:13 +0000 (+0000) Subject: runtime: add traceEnabled function X-Git-Tag: go1.21rc1~579 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=3e9876cd3a5a83be9bb0f5cbc600aadf9b599558;p=gostls13.git runtime: add traceEnabled function This change introduces the trivial traceEnabled function to help tighten up the execution tracer's API in preparation for the execution trace redesign GOEXPERIMENT. A follow-up change will refactor the runtime to use it. Change-Id: I19c8728e30aefe543b4a826d95446affa14897e3 Reviewed-on: https://go-review.googlesource.com/c/go/+/494180 Run-TryBot: Michael Knyszek TryBot-Result: Gopher Robot Auto-Submit: Michael Knyszek Reviewed-by: Michael Pratt --- diff --git a/src/runtime/trace.go b/src/runtime/trace.go index 860b53bdbb..64314f62e8 100644 --- a/src/runtime/trace.go +++ b/src/runtime/trace.go @@ -206,6 +206,11 @@ func traceBufPtrOf(b *traceBuf) traceBufPtr { return traceBufPtr(unsafe.Pointer(b)) } +// traceEnabled returns true if the trace is currently enabled. +func traceEnabled() bool { + return trace.enabled +} + // StartTrace enables tracing for the current process. // While tracing, the data will be buffered and available via ReadTrace. // StartTrace returns an error if tracing is already enabled.