Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type MemoryUsage ¶
type MemoryUsage struct {
// contains filtered or unexported fields
}
The MemoryUsage struct to holds memory usage and memory limit information about a cgroup.
func GetMemoryUsage ¶
func GetMemoryUsage(ctx context.Context) *MemoryUsage
The GetMemoryUsage function returns MemoryUsage info for the entire cgroup.
func (*MemoryUsage) PercentUsed ¶
func (m *MemoryUsage) PercentUsed() int
The MemoryUsage.PercentUsed method returns memory usage as a percentage of memory limit.
func (*MemoryUsage) Refresh ¶
func (m *MemoryUsage) Refresh(ctx context.Context)
The MemoryUsage.Refresh method updates memory usage information.
func (*MemoryUsage) ShortString ¶
func (m *MemoryUsage) ShortString() string
func (*MemoryUsage) String ¶
func (m *MemoryUsage) String() string
Pretty print a summary of memory usage suitable for logging.
func (*MemoryUsage) Watch ¶
func (usage *MemoryUsage) Watch(ctx context.Context)
The Watch method will check memory usage every 10 seconds and log it if it jumps more than 10Gi up or down. Additionally if memory usage exceeds 50% of the cgroup limit, it will log usage every minute. Usage is also unconditionally logged before returning. This function only returns if the context is canceled.
type ProcessUsage ¶
type ProcessUsage struct { Pid int Cmdline []string Usage memory // This is zero if the process is still running. If the process has exited, this counts how many // refreshes have happened. We GC after 10 refreshes. RefreshesSinceExit int }
The ProcessUsage struct holds per process memory usage information.
func (ProcessUsage) String ¶
func (pu ProcessUsage) String() string
Pretty print a summary of process memory usage.