Skip to content

Commit

Permalink
fix: remove setting of cpu profile rate
Browse files Browse the repository at this point in the history
Signed-off-by: Brian McGee <[email protected]>
  • Loading branch information
brianmcgee committed May 7, 2024
1 parent b7458e6 commit f1f56d1
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 5 deletions.
3 changes: 0 additions & 3 deletions cli/format.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 1 addition & 2 deletions cli/format_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit f1f56d1

Please sign in to comment.