mirror of
https://github.com/minio/minio.git
synced 2025-01-11 15:03:22 -05:00
Used MINIO_PROFILE_DIR for saving profile information of a minio server (#1722)
To specify the directory where profiling information should be saved ``` export MINIO_PROFILE_DIR=/path/to/profile/dir ``` By default, profiling information would be saved in a directory created using ioutil.TempDir, which would be displayed in stdout on starting the minio server.
This commit is contained in:
parent
3a980eac1a
commit
584813e214
8
main.go
8
main.go
@ -195,14 +195,16 @@ func main() {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Set ``MINIO_PROFILE_DIR`` to the directory where profiling information should be persisted
|
||||
profileDir := os.Getenv("MINIO_PROFILE_DIR")
|
||||
// Enable profiler if ``MINIO_PROFILER`` is set. Supported options are [cpu, mem, block].
|
||||
switch os.Getenv("MINIO_PROFILER") {
|
||||
case "cpu":
|
||||
defer profile.Start(profile.CPUProfile, profile.ProfilePath(mustGetProfilePath())).Stop()
|
||||
defer profile.Start(profile.CPUProfile, profile.ProfilePath(profileDir)).Stop()
|
||||
case "mem":
|
||||
defer profile.Start(profile.MemProfile, profile.ProfilePath(mustGetProfilePath())).Stop()
|
||||
defer profile.Start(profile.MemProfile, profile.ProfilePath(profileDir)).Stop()
|
||||
case "block":
|
||||
defer profile.Start(profile.BlockProfile, profile.ProfilePath(mustGetProfilePath())).Stop()
|
||||
defer profile.Start(profile.BlockProfile, profile.ProfilePath(profileDir)).Stop()
|
||||
}
|
||||
|
||||
// Run the app - exit on error.
|
||||
|
Loading…
Reference in New Issue
Block a user