MCPcopy
hub / github.com/grpc/grpc-go / after

Function after

benchmark/benchmain/main.go:974–1000  ·  view source on GitHub ↗
(opts *benchOpts, data []stats.BenchResults)

Source from the content-addressed store, hash-verified

972}
973
974func after(opts *benchOpts, data []stats.BenchResults) {
975 if opts.cpuProfile != "" {
976 pprof.StopCPUProfile() // flushes profile to disk
977 }
978 if opts.memProfile != "" {
979 f, err := os.Create(opts.memProfile)
980 if err != nil {
981 fmt.Fprintf(os.Stderr, "testing: %s\n", err)
982 os.Exit(2)
983 }
984 runtime.GC() // materialize all statistics
985 if err = pprof.WriteHeapProfile(f); err != nil {
986 fmt.Fprintf(os.Stderr, "testing: can't write heap profile %s: %s\n", opts.memProfile, err)
987 os.Exit(2)
988 }
989 f.Close()
990 }
991 if opts.benchmarkResultFile != "" {
992 f, err := os.Create(opts.benchmarkResultFile)
993 if err != nil {
994 log.Fatalf("testing: can't write benchmark result %s: %s\n", opts.benchmarkResultFile, err)
995 }
996 dataEncoder := gob.NewEncoder(f)
997 dataEncoder.Encode(data)
998 f.Close()
999 }
1000}
1001
1002// nopCompressor is a compressor that just copies data.
1003type nopCompressor struct{}

Callers 1

mainFunction · 0.85

Calls 3

CloseMethod · 0.65
FatalfMethod · 0.65
EncodeMethod · 0.45

Tested by

no test coverage detected