github.com/gagliardetto/golang-go@v0.0.0-20201020153340-53909ea70814/cmd/compile/internal/gc/trace.go (about)

     1  // Copyright 2016 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  // +build go1.7
     6  
     7  package gc
     8  
     9  import (
    10  	"os"
    11  	tracepkg "runtime/trace"
    12  )
    13  
    14  func init() {
    15  	traceHandler = traceHandlerGo17
    16  }
    17  
    18  func traceHandlerGo17(traceprofile string) {
    19  	f, err := os.Create(traceprofile)
    20  	if err != nil {
    21  		Fatalf("%v", err)
    22  	}
    23  	if err := tracepkg.Start(f); err != nil {
    24  		Fatalf("%v", err)
    25  	}
    26  	atExit(tracepkg.Stop)
    27  }