github.com/gitbundle/modules@v0.0.0-20231025071548-85b91c5c3b01/log/groutinelabel.go (about)

     1  // Copyright 2023 The GitBundle Inc. All rights reserved.
     2  // Copyright 2017 The Gitea Authors. All rights reserved.
     3  // Use of this source code is governed by a MIT-style
     4  // license that can be found in the LICENSE file.
     5  
     6  package log
     7  
     8  import "unsafe"
     9  
    10  //go:linkname runtime_getProfLabel runtime/pprof.runtime_getProfLabel
    11  func runtime_getProfLabel() unsafe.Pointer // nolint
    12  
    13  type labelMap map[string]string
    14  
    15  func getGoroutineLabels() map[string]string {
    16  	l := (*labelMap)(runtime_getProfLabel())
    17  	if l == nil {
    18  		return nil
    19  	}
    20  	return *l
    21  }