Documentation ¶
Overview ¶
Package sysinfo is a library that get some linux system information.
Index ¶
- Constants
- func FormatIcon(dev string, in, out uint64) string
- func FormatRate(size uint64) string
- func ProcessMemory(pid int) (uint64, error)
- type FormatIO
- type IOActivity
- type ITextInfo
- type RenderOne
- type RenderPercent
- type TextIcon
- type TextInfo
- type TextLabel
- type TextNil
- type Value
- type VideoCard
Constants ¶
const KernelDiskStats = "/proc/diskstats"
KernelDiskStats is the disk activity information source.
const KernelNetStats = "/proc/net/dev"
KernelNetStats is the network activity information source.
Variables ¶
This section is empty.
Functions ¶
func FormatIcon ¶
FormatIcon is a Quick-info display callback. One line for each value. Zero are replaced by empty string.
func FormatRate ¶
FormatRate format value to string, or nothing if 0.
func ProcessMemory ¶
ProcessMemory returns the PSS (Proportional Set Size) for a given PID, expressed in KB. If you have just started the process, you should have the rights to access the corresponding /proc file.
Types ¶
type IOActivity ¶
type IOActivity struct { Log cdtype.Logger FormatIcon FormatIO FormatLabel FormatIO GetData func() ([]Value, error) // contains filtered or unexported fields }
IOActivity extract delta IO stats from stacking system counters.
func NewIOActivity ¶
func NewIOActivity(app cdtype.RenderSimple) *IOActivity
NewIOActivity create a new data store for IO activity monitoring.
func (*IOActivity) Check ¶
func (ioa *IOActivity) Check()
Check pull and display activity information for configured interfaces. Display on the Cairo-Dock icon:
RenderValues: gauge or graph RenderText: quickinfo or label
func (*IOActivity) Settings ¶
func (ioa *IOActivity) Settings(interval uint64, textPosition cdtype.InfoPosition, renderer int, graphType cdtype.RendererGraphType, gaugeTheme string, names ...string)
Settings is a all in one method to configure your IOActivity.
type ITextInfo ¶
type ITextInfo interface { Display() Clear() SetSeparator(sep string) Append(dev string, in, out uint64) SetCallAppend(call FormatIO) Fail(dev string) SetCallFail(call func(dev string) string) }
ITextInfo is the interface for a paired value text renderer. Used with ....
type RenderOne ¶
type RenderOne struct { Sep string // separator between lines. ShowPre bool // text pre value. ShowPost bool // text post value. // contains filtered or unexported fields }
RenderOne provides a simple icon/label text renderer with values in percent.
type RenderPercent ¶
type RenderPercent struct { App cdtype.RenderSimple Texts map[cdtype.InfoPosition]RenderOne DisplayText cdtype.InfoPosition DisplayValues int GaugeTheme string GraphType cdtype.RendererGraphType // contains filtered or unexported fields }
RenderPercent provides a simple icon/label text renderer with values in percent.
func (*RenderPercent) Append ¶
func (rp *RenderPercent) Append(str string, value float64)
Append adds a value to the renderer.
func (*RenderPercent) Display ¶
func (rp *RenderPercent) Display()
Display renders and displays the provided values.
func (*RenderPercent) SetSize ¶
func (rp *RenderPercent) SetSize(size int)
SetSize sets the number of values to render on icon. Mandatory with and after Settings.
func (*RenderPercent) Settings ¶
func (rp *RenderPercent) Settings(textPosition cdtype.InfoPosition, renderer int, graphType cdtype.RendererGraphType, gaugeTheme string)
Settings is a all in one method to apply applet settings.
type TextIcon ¶
type TextIcon struct { TextInfo // contains filtered or unexported fields }
TextIcon renders a paired value text on icon quickinfo.
func NewTextIcon ¶
func NewTextIcon(app cdtype.RenderSimple) *TextIcon
NewTextIcon creates a new paired value text renderer on icon quickinfo.
type TextInfo ¶
type TextInfo struct {
// contains filtered or unexported fields
}
TextInfo defines the base data for a paired value text renderer.
func (*TextInfo) SetCallAppend ¶
SetCallAppend declares the text formatter callback for each value.
func (*TextInfo) SetCallFail ¶
SetCallFail declares the error formatter callback.
func (*TextInfo) SetSeparator ¶
SetSeparator declares the text separator to add between text values.
type TextLabel ¶
type TextLabel struct { TextInfo // contains filtered or unexported fields }
TextLabel renders a paired value text on icon label.
func NewTextLabel ¶
func NewTextLabel(app cdtype.RenderSimple) *TextLabel
NewTextLabel creates a new paired value text renderer on icon label.
type TextNil ¶
type TextNil struct {
TextInfo
}
TextNil provides a dumb interface compatible with a paired value text renderer.
func NewTextNil ¶
func NewTextNil() *TextNil
NewTextNil creates a dumb interface compatible with paired value text renderer.
type Value ¶
Value define a counter value for the paired renderer.
func GetDiskActivity ¶
GetDiskActivity returns activity information for configured disks.
Using Linux iostat : http://www.kernel.org/doc/Documentation/iostats.txt
func GetNetActivity ¶
GetNetActivity returns activity information for configured network interfaces.