From 9f4659884dd45dca726ba38ee6bfacb2bf776eb8 Mon Sep 17 00:00:00 2001 From: dorman <37854724+dormanze@users.noreply.github.com> Date: Tue, 29 Oct 2024 23:34:59 +0800 Subject: [PATCH] Make the profiler easier to use (#5068) --- cmd/profiling.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cmd/profiling.go b/cmd/profiling.go index 743cdd39a4..45a54887ee 100644 --- a/cmd/profiling.go +++ b/cmd/profiling.go @@ -114,6 +114,12 @@ var globalProfilers []profiler func enableProfilers(outputFolder string, profilers []string) error { now := time.Now().Format("2006-01-02T15-04-05") + if _, e := os.Stat(outputFolder); e != nil { + if e := os.MkdirAll(outputFolder, 0o700); e != nil { + return e + } + } + for _, profilerName := range profilers { outputFile := path.Join(outputFolder, profilerName+"."+now) f, e := os.Create(outputFile)