Black Lives Matter. Support the Equal Justice Initiative.

Source file src/cmd/compile/internal/gc/trace.go

Documentation: cmd/compile/internal/gc

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

View as plain text