Documentation
¶
Index ¶
- func Example()
- func FormatBytes(bytes uint64) string
- type ProfileCmd
- func (c *ProfileCmd) GetProfiler() *Profiler
- func (c *ProfileCmd) Run() error
- func (c *ProfileCmd) SetCPUOnly(cpuOnly bool) *ProfileCmd
- func (c *ProfileCmd) SetDuration(d time.Duration) *ProfileCmd
- func (c *ProfileCmd) SetHTTP(http bool) *ProfileCmd
- func (c *ProfileCmd) SetHTTPAddr(addr string) *ProfileCmd
- func (c *ProfileCmd) SetMemOnly(memOnly bool) *ProfileCmd
- func (c *ProfileCmd) SetOutputDir(dir string) *ProfileCmd
- type ProfileResult
- type Profiler
- func (p *Profiler) FormatMemoryStats(stats *runtime.MemStats) string
- func (p *Profiler) GetGoroutineStats() string
- func (p *Profiler) GetMemoryStats() *runtime.MemStats
- func (p *Profiler) RegisterHTTPHandlers()
- func (p *Profiler) Start() error
- func (p *Profiler) StartCPUProfile() error
- func (p *Profiler) Stop() (*ProfileResult, error)
- func (p *Profiler) StopCPUProfile()
- func (p *Profiler) TakeMemorySnapshot(label string) (string, error)
- type ProfilerConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ProfileCmd ¶
type ProfileCmd struct {
// contains filtered or unexported fields
}
ProfileCmd 性能分析命令
func (*ProfileCmd) SetCPUOnly ¶
func (c *ProfileCmd) SetCPUOnly(cpuOnly bool) *ProfileCmd
SetCPUOnly 设置仅进行CPU分析
func (*ProfileCmd) SetDuration ¶
func (c *ProfileCmd) SetDuration(d time.Duration) *ProfileCmd
SetDuration 设置分析持续时间
func (*ProfileCmd) SetHTTP ¶
func (c *ProfileCmd) SetHTTP(http bool) *ProfileCmd
SetHTTP 设置是否启用HTTP服务
func (*ProfileCmd) SetHTTPAddr ¶
func (c *ProfileCmd) SetHTTPAddr(addr string) *ProfileCmd
SetHTTPAddr 设置HTTP服务地址
func (*ProfileCmd) SetMemOnly ¶
func (c *ProfileCmd) SetMemOnly(memOnly bool) *ProfileCmd
SetMemOnly 设置仅进行内存分析
func (*ProfileCmd) SetOutputDir ¶
func (c *ProfileCmd) SetOutputDir(dir string) *ProfileCmd
SetOutputDir 设置输出目录
type ProfileResult ¶
type ProfileResult struct {
// 分析类型
Type string
// 文件路径
FilePath string
// 分析时长
Duration time.Duration
// 分析开始时间
StartTime time.Time
// 分析结束时间
EndTime time.Time
// 内存统计
MemStats *runtime.MemStats
}
ProfileResult 分析结果
type Profiler ¶
type Profiler struct {
// contains filtered or unexported fields
}
Profiler 性能分析器
func (*Profiler) FormatMemoryStats ¶
FormatMemoryStats 格式化内存统计信息
func (*Profiler) GetGoroutineStats ¶
GetGoroutineStats 获取协程统计信息
func (*Profiler) GetMemoryStats ¶
GetMemoryStats 获取内存统计信息
func (*Profiler) RegisterHTTPHandlers ¶
func (p *Profiler) RegisterHTTPHandlers()
RegisterHTTPHandlers 注册HTTP处理器
func (*Profiler) StartCPUProfile ¶
StartCPUProfile 启动CPU分析
Click to show internal directories.
Click to hide internal directories.