Documentation
¶
Overview ¶
Package diagnostics keeps what shows why icebath is slow or large: the profile of the processor time each process writes as it runs, the memory dumps, and the memory watch that warns as the memory grows fast, lets go of caches and dumps at its high level, and at its last one dumps and ends the process cleanly rather than have the system kill it
Index ¶
- type Diagnostics
- func (d *Diagnostics) Close() error
- func (d *Diagnostics) Dump(trigger Trigger) (Dump, error)
- func (d *Diagnostics) Dumps() []Dump
- func (d *Diagnostics) Ending(end func())
- func (d *Diagnostics) Folder() string
- func (d *Diagnostics) Heap() int64
- func (d *Diagnostics) Levels() Levels
- func (d *Diagnostics) Newest() Dump
- func (d *Diagnostics) Shedding(shed func(all bool))
- func (d *Diagnostics) Start()
- func (d *Diagnostics) Telling(tell func(profile, text string))
- type Dump
- type Ended
- type Levels
- type Trigger
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Diagnostics ¶
type Diagnostics struct {
// contains filtered or unexported fields
}
The diagnostics of this process
func New ¶
func New(cfg *config.Config) *Diagnostics
func (*Diagnostics) Close ¶
func (d *Diagnostics) Close() error
Stops the profile, writing it whole a last time, and the watch; the process ended itself for lack of memory when it says so, as an *Ended
func (*Diagnostics) Dump ¶
func (d *Diagnostics) Dump(trigger Trigger) (Dump, error)
Writes a dump of this process: the memory facts first, which explain a dump where the profile of a very large heap could not be written, then the heap profile after a collection, so it shows what is live; an automatic dump writes the profile only while Heap profiles is on, as profiles written at every level can fill a disk. The oldest dumps past Dump space go after it
func (*Diagnostics) Dumps ¶
func (d *Diagnostics) Dumps() []Dump
The dumps in the folder, every process's, newest first; a file icebath did not write is left out
func (*Diagnostics) Ending ¶
func (d *Diagnostics) Ending(end func())
Takes what ends the process as a stop signal ends it, which the watch calls at its last level
func (*Diagnostics) Folder ¶
func (d *Diagnostics) Folder() string
Folder the dumps go to, as Dump folder names it
func (*Diagnostics) Heap ¶
func (d *Diagnostics) Heap() int64
Live heap of this process now, in bytes
func (*Diagnostics) Levels ¶
func (d *Diagnostics) Levels() Levels
The levels of this process now: the budget is the memory limit of the Go runtime where one is set within what the computer has, as the collector then holds the whole process under it, else the memory of the computer or of its control group divided by the growth the collector allows between two collections, as that bounds what the process holds rather than what is live
func (*Diagnostics) Newest ¶
func (d *Diagnostics) Newest() Dump
The newest dump this process wrote, the zero Dump for none
func (*Diagnostics) Shedding ¶
func (d *Diagnostics) Shedding(shed func(all bool))
Takes what lets go of a feature's caches when the memory nears what the process may use, all of them at the last level
func (*Diagnostics) Start ¶
func (d *Diagnostics) Start()
Starts what the settings ask once the process is set up: the profile of its processor time, the dump at start, and the memory watch, which reads Memory watch at every look so turning it off or on holds at once
func (*Diagnostics) Telling ¶
func (d *Diagnostics) Telling(tell func(profile, text string))
Takes how the person is told what the watch found, in the sessions of the profile of the process
type Dump ¶
type Dump struct {
Facts, Profile string
At time.Time
Trigger Trigger
// Process that wrote it, and the bytes its files take
PID int
Size int64
}
One memory dump: the memory facts and the heap profile beside them, either missing where it was not written
type Ended ¶
type Ended struct {
// Live heap and resident memory as it ended, and the dump written then
Heap, Resident int64
Dump string
}
The process ended itself for lack of memory, which Close says so the process exits with the status a kill by the system leaves
type Levels ¶
type Levels struct {
// Fast growth is warned of from Warn up, when the heap grew by Step or more since the look before; caches go and a dump is written at
// High, and the process ends at Last
Warn, Step, High, Last int64
// What the live heap may come to, and what says so, as a person reads it
Budget int64
From string
// The memory limit of the Go runtime, and the memory of this computer or of the control group it runs in; zero for none known
GoLimit, Memory int64
// How far the heap grows past what is live before the collector runs, in percent, -1 with the collector off
Percent int64
}
Live heap sizes the watch acts at, in bytes, with the bounds they come from