mirror of
https://github.com/minio/minio.git
synced 2024-12-28 08:05:55 -05:00
9531cddb06
Two handlers are added to admin API to enable profiling and disable profiling of a server in a standalone mode, or all nodes in the distributed mode. /minio/admin/profiling/start/{cpu,block,mem}: - Start profiling and return starting JSON results, e.g. one node is offline. /minio/admin/profiling/download: - Stop the on-going profiling task - Stream a zip file which contains all profiling files that can be later inspected by go tool pprof
55 lines
1.3 KiB
Markdown
55 lines
1.3 KiB
Markdown
profile
|
|
=======
|
|
|
|
Simple profiling support package for Go
|
|
|
|
[![Build Status](https://travis-ci.org/pkg/profile.svg?branch=master)](https://travis-ci.org/pkg/profile) [![GoDoc](http://godoc.org/github.com/pkg/profile?status.svg)](http://godoc.org/github.com/pkg/profile)
|
|
|
|
|
|
installation
|
|
------------
|
|
|
|
go get github.com/pkg/profile
|
|
|
|
usage
|
|
-----
|
|
|
|
Enabling profiling in your application is as simple as one line at the top of your main function
|
|
|
|
```go
|
|
import "github.com/pkg/profile"
|
|
|
|
func main() {
|
|
defer profile.Start().Stop()
|
|
...
|
|
}
|
|
```
|
|
|
|
options
|
|
-------
|
|
|
|
What to profile is controlled by config value passed to profile.Start.
|
|
By default CPU profiling is enabled.
|
|
|
|
```go
|
|
import "github.com/pkg/profile"
|
|
|
|
func main() {
|
|
// p.Stop() must be called before the program exits to
|
|
// ensure profiling information is written to disk.
|
|
p := profile.Start(profile.MemProfile, profile.ProfilePath("."), profile.NoShutdownHook)
|
|
...
|
|
}
|
|
```
|
|
|
|
Several convenience package level values are provided for cpu, memory, and block (contention) profiling.
|
|
|
|
For more complex options, consult the [documentation](http://godoc.org/github.com/pkg/profile).
|
|
|
|
contributing
|
|
------------
|
|
|
|
We welcome pull requests, bug fixes and issue reports.
|
|
|
|
Before proposing a change, please discuss it first by raising an issue.
|