mirror of
https://github.com/crazy-max/diun.git
synced 2025-12-21 13:23:09 +01:00
Fix profiler path (#339)
Co-authored-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"fmt"
|
||||
"os"
|
||||
"os/signal"
|
||||
"path"
|
||||
"runtime"
|
||||
"strings"
|
||||
"syscall"
|
||||
@@ -77,8 +78,12 @@ func main() {
|
||||
log.Debug().Msg(cfg.String())
|
||||
|
||||
// Profiler
|
||||
if len(cli.Profiler) > 0 {
|
||||
profilePath := profile.ProfilePath(cfg.Db.Path)
|
||||
if len(cli.Profiler) > 0 && len(cli.ProfilerPath) > 0 {
|
||||
profilerPath := path.Clean(cli.ProfilerPath)
|
||||
if err = os.MkdirAll(profilerPath, os.ModePerm); err != nil {
|
||||
log.Fatal().Err(err).Msg("Cannot create profiler folder")
|
||||
}
|
||||
profilePath := profile.ProfilePath(profilerPath)
|
||||
switch cli.Profiler {
|
||||
case "cpu":
|
||||
defer profile.Start(profile.CPUProfile, profilePath).Stop()
|
||||
|
||||
Reference in New Issue
Block a user