...

Source file src/cmd/compile/internal/inline/inlheur/trace_on.go

Documentation: cmd/compile/internal/inline/inlheur

     1  // Copyright 2023 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  //go:build debugtrace
     6  
     7  package inlheur
     8  
     9  import (
    10  	"os"
    11  	"strconv"
    12  )
    13  
    14  var debugTrace = 0
    15  
    16  func enableDebugTrace(x int) {
    17  	debugTrace = x
    18  }
    19  
    20  func enableDebugTraceIfEnv() {
    21  	v := os.Getenv("DEBUG_TRACE_INLHEUR")
    22  	if v == "" {
    23  		return
    24  	}
    25  	if v[0] == '*' {
    26  		if !UnitTesting() {
    27  			return
    28  		}
    29  		v = v[1:]
    30  	}
    31  	i, err := strconv.Atoi(v)
    32  	if err != nil {
    33  		return
    34  	}
    35  	debugTrace = i
    36  }
    37  
    38  func disableDebugTrace() {
    39  	debugTrace = 0
    40  }
    41  

View as plain text