From 596fe65e84d5d8220b723d85633e38f33e34f384 Mon Sep 17 00:00:00 2001 From: Krishnan Parthasarathi Date: Wed, 18 May 2016 00:14:40 +0530 Subject: [PATCH] Write pprof output files under config dir supplied (#1660) Since config dir, supplied as command line argument, is parsed after pprof output directory is determined, pprof output files are written in ~/.minio/profile directory instead of /profile/. This change fixes this behaviour. --- main.go | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/main.go b/main.go index 8402e1be6..54f8ca813 100644 --- a/main.go +++ b/main.go @@ -151,17 +151,6 @@ func mustGetProfilePath() string { } func main() { - // Enable profiling supported modes are [cpu, mem, block]. - // ``MINIO_PROFILER`` supported options are [cpu, mem, block]. - switch os.Getenv("MINIO_PROFILER") { - case "cpu": - defer profile.Start(profile.CPUProfile, profile.ProfilePath(mustGetProfilePath())).Stop() - case "mem": - defer profile.Start(profile.MemProfile, profile.ProfilePath(mustGetProfilePath())).Stop() - case "block": - defer profile.Start(profile.BlockProfile, profile.ProfilePath(mustGetProfilePath())).Stop() - } - // Set global trace flag. trace := os.Getenv("MINIO_TRACE") globalTrace = trace == "1" @@ -204,6 +193,17 @@ func main() { } } + // Enable profiling supported modes are [cpu, mem, block]. + // ``MINIO_PROFILER`` supported options are [cpu, mem, block]. + switch os.Getenv("MINIO_PROFILER") { + case "cpu": + defer profile.Start(profile.CPUProfile, profile.ProfilePath(mustGetProfilePath())).Stop() + case "mem": + defer profile.Start(profile.MemProfile, profile.ProfilePath(mustGetProfilePath())).Stop() + case "block": + defer profile.Start(profile.BlockProfile, profile.ProfilePath(mustGetProfilePath())).Stop() + } + // Return here. return nil }