Source file src/runtime/pprof/pe.go

     1  // Copyright 2022 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  package pprof
     6  
     7  import "os"
     8  
     9  // peBuildID returns a best effort unique ID for the named executable.
    10  //
    11  // It would be wasteful to calculate the hash of the whole file,
    12  // instead use the binary name and the last modified time for the buildid.
    13  func peBuildID(file string) string {
    14  	s, err := os.Stat(file)
    15  	if err != nil {
    16  		return file
    17  	}
    18  	return file + s.ModTime().String()
    19  }
    20  

View as plain text