]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: add traceEnabled function
authorMichael Anthony Knyszek <mknyszek@google.com>
Tue, 9 May 2023 19:36:13 +0000 (19:36 +0000)
committerGopher Robot <gobot@golang.org>
Thu, 11 May 2023 19:07:33 +0000 (19:07 +0000)
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 <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
src/runtime/trace.go

index 860b53bdbb974e502cd817777c332666347dce21..64314f62e875de5666a82db0c913987a9ad43f19 100644 (file)
@@ -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.