2016-12-09 14:00:02 -07:00
|
|
|
// Copyright 2017 The Go Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style
|
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
|
|
|
|
package runtime
|
|
|
|
|
|
|
|
import "unsafe"
|
|
|
|
|
2017-04-28 10:45:46 -06:00
|
|
|
var labelSync uintptr
|
|
|
|
|
2016-12-09 14:00:02 -07:00
|
|
|
//go:linkname runtime_setProfLabel runtime/pprof.runtime_setProfLabel
|
|
|
|
func runtime_setProfLabel(labels unsafe.Pointer) {
|
2017-04-28 10:45:46 -06:00
|
|
|
// Introduce race edge for read-back via profile.
|
|
|
|
// This would more properly use &getg().labels as the sync address,
|
|
|
|
// but we do the read in a signal handler and can't call the race runtime then.
|
|
|
|
if raceenabled {
|
|
|
|
racerelease(unsafe.Pointer(&labelSync))
|
|
|
|
}
|
2016-12-09 14:00:02 -07:00
|
|
|
getg().labels = labels
|
|
|
|
}
|
|
|
|
|
|
|
|
//go:linkname runtime_getProfLabel runtime/pprof.runtime_getProfLabel
|
|
|
|
func runtime_getProfLabel() unsafe.Pointer {
|
|
|
|
return getg().labels
|
|
|
|
}
|