From f1f56d1bfcfc8a75fc27ebefb9c3662820ef54ed Mon Sep 17 00:00:00 2001 From: Brian McGee Date: Tue, 7 May 2024 17:18:49 +0100 Subject: [PATCH] fix: remove setting of cpu profile rate Signed-off-by: Brian McGee --- cli/format.go | 3 --- cli/format_test.go | 3 +-- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/cli/format.go b/cli/format.go index 693ba6f..bd85ae3 100644 --- a/cli/format.go +++ b/cli/format.go @@ -42,9 +42,6 @@ var ( func (f *Format) Run() (err error) { // cpu profiling if Cli.CpuProfile != "" { - // it is not recommended to go over 500 hz, but anything less wasn't producing meaningful samples - runtime.SetCPUProfileRate(500) - cpuProfile, err := os.Create(Cli.CpuProfile) if err != nil { return fmt.Errorf("failed to open file for writing cpu profile: %w", err) diff --git a/cli/format_test.go b/cli/format_test.go index 63e71a4..cd3d990 100644 --- a/cli/format_test.go +++ b/cli/format_test.go @@ -37,9 +37,8 @@ func TestCpuProfile(t *testing.T) { _, err = cmd(t, "-C", tempDir, "--allow-missing-formatter", "--cpu-profile", "cpu.pprof") as.NoError(err) as.FileExists(filepath.Join(tempDir, "cpu.pprof")) - file, err := os.Stat(filepath.Join(tempDir, "cpu.pprof")) + _, err = os.Stat(filepath.Join(tempDir, "cpu.pprof")) as.NoError(err) - as.False(file.Size() == 0) } func TestAllowMissingFormatter(t *testing.T) {