Documentation
¶
Overview ¶
* @Author: cnzf1 * @Date: 2022-12-02 21:02:42 * @LastEditors: cnzf1 * @LastEditTime: 2023-01-11 11:08:51 * @Description:
Index ¶
Constants ¶
View Source
const DefaultMemProfileRate = 4096
DefaultMemProfileRate is the default memory profiling rate. See also http://golang.org/pkg/runtime/#pkg-variables
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Profile ¶
type Profile struct {
// contains filtered or unexported fields
}
Profile represents an active profiling session.
type Stopper ¶
type Stopper interface {
Stop()
}
Stopper interface wraps the method Stop.
func StartProfile ¶
StartProfile starts a new profiling session. The caller should call the Stop method on the value returned to cleanly stop profiling.
go func() { var profiler proc.Stopper signals := make(chan os.Signal, 1) signal.Notify(signals, syscall.SIGUSR1, syscall.SIGUSR2, syscall.SIGTERM) for { v := <-signals switch v { case syscall.SIGUSR2: if profiler == nil { profiler = proc.StartProfile() } else { profiler.Stop() profiler = nil } } } }()
Click to show internal directories.
Click to hide internal directories.