fix: remove setting of cpu profile rate

Signed-off-by: Brian McGee <brian@bmcgee.ie>
This commit is contained in:
Brian McGee 2024-05-07 17:18:49 +01:00
parent b7458e6530
commit f1f56d1bfc
No known key found for this signature in database
GPG Key ID: D49016E76AD1E8C0
2 changed files with 1 additions and 5 deletions

View File

@ -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)

View File

@ -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) {