You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
353 B
19 lines
353 B
package main |
|
|
|
import ( |
|
"github.com/pkg/profile" |
|
) |
|
|
|
func startProfiler(mode string) { |
|
switch mode { |
|
case "cpu": |
|
prof := profile.Start(profile.CPUProfile) |
|
defer prof.Stop() |
|
case "memory": |
|
prof := profile.Start(profile.MemProfile) |
|
defer prof.Stop() |
|
case "allocation": |
|
prof := profile.Start(profile.MemProfileAllocs) |
|
defer prof.Stop() |
|
} |
|
}
|
|
|