Skip to content

Commit af1e9c0

Browse files
committed
sweet/benchmarks/internal/driver: delete now-unused diagnostics code
Change-Id: Ie4376c70a17c718373064d30577b3afef0f5365b Cq-Include-Trybots: luci.golang.try:x_benchmarks-gotip-linux-amd64-longtest Reviewed-on: https://go-review.googlesource.com/c/benchmarks/+/600070 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Pratt <mpratt@google.com>
1 parent c5c5040 commit af1e9c0

File tree

2 files changed

+1
-41
lines changed

2 files changed

+1
-41
lines changed

sweet/benchmarks/internal/driver/driver.go

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import (
2121
"sync"
2222
"time"
2323

24-
"github.com/google/pprof/profile"
2524
"golang.org/x/benchmarks/sweet/common/diagnostics"
2625
)
2726

@@ -575,49 +574,10 @@ func DiagnosticEnabled(typ diagnostics.Type) bool {
575574
return ok
576575
}
577576

578-
// TODO: Delete below here
579-
580-
func WritePprofProfile(prof *profile.Profile, typ diagnostics.Type, pattern string) error {
581-
if !typ.IsPprof() {
582-
return fmt.Errorf("this type of diagnostic doesn't use the pprof format")
583-
}
584-
if !DiagnosticEnabled(typ) {
585-
return fmt.Errorf("this type of diagnostic is not currently enabled")
586-
}
587-
f, err := newDiagnosticDataFile(typ, pattern)
588-
if err != nil {
589-
return err
590-
}
591-
defer f.Close()
592-
return prof.Write(f)
593-
}
594-
595-
func CopyDiagnosticData(diagPath string, typ diagnostics.Type, pattern string) error {
596-
inF, err := os.Open(diagPath)
597-
if err != nil {
598-
return err
599-
}
600-
defer inF.Close()
601-
outF, err := newDiagnosticDataFile(typ, pattern)
602-
if err != nil {
603-
return err
604-
}
605-
defer outF.Close()
606-
_, err = io.Copy(outF, inF)
607-
return err
608-
}
609-
610577
func PerfFlags() []string {
611578
cfg, ok := diag.ConfigSet.Get(diagnostics.Perf)
612579
if !ok {
613580
panic("perf not enabled")
614581
}
615582
return strings.Split(cfg.Flags, " ")
616583
}
617-
618-
func newDiagnosticDataFile(typ diagnostics.Type, pattern string) (*os.File, error) {
619-
if !DiagnosticEnabled(typ) {
620-
return nil, fmt.Errorf("this type of profile is not currently enabled")
621-
}
622-
return os.CreateTemp(diag.ResultsDir, pattern+"."+string(typ))
623-
}

sweet/cmd/sweet/run.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,7 @@ func (c *runCmd) preparePGO(configs []*common.Config, benchmarks []*benchmark) (
447447
return newConfigs, nil
448448
}
449449

450-
var cpuProfileRe = regexp.MustCompile(`\.cpuprofile[0-9]+|-cpu\.prof$`)
450+
var cpuProfileRe = regexp.MustCompile(`-cpu\.prof$`)
451451

452452
func mergeCPUProfiles(dir string) (string, error) {
453453
profiles, err := sprofile.ReadDirPprof(dir, func(name string) bool {

0 commit comments

Comments
 (0)