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
5package pprof
6
7import "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.
13func 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