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 ignore 6 // +build ignore 7 8 // The pprof command prints the total time in a pprof profile provided 9 // through the standard input. 10 package main 11 12 import ( 13 "compress/gzip" 14 "fmt" 15 "io" 16 "log" 17 "os" 18 19 "golang.org/x/tools/internal/pprof" 20 ) 21 22 func main() { 23 rd, err := gzip.NewReader(os.Stdin) 24 if err != nil { 25 log.Fatal(err) 26 } 27 payload, err := io.ReadAll(rd) 28 if err != nil { 29 log.Fatal(err) 30 } 31 total, err := pprof.TotalTime(payload) 32 if err != nil { 33 log.Fatal(err) 34 } 35 fmt.Println(total) 36 } 37