godock: github.com/sqp/godock/libs/sysinfo Index | Files

package sysinfo

import "github.com/sqp/godock/libs/sysinfo"

Package sysinfo is a library that get some linux system information.

Index

Package Files

data.go ioactivity.go system.go

Constants

const KernelDiskStats = "/proc/diskstats"

KernelDiskStats is the disk activity information source.

const KernelNetStats = "/proc/net/dev"

KernelNetStats is the network activity information source.

func FormatIcon Uses

func FormatIcon(dev string, in, out uint64) string

FormatIcon is a Quick-info display callback. One line for each value. Zero are replaced by empty string.

func FormatRate Uses

func FormatRate(size uint64) string

FormatRate format value to string, or nothing if 0.

func GetDiskActivity Uses

func GetDiskActivity() ([]Value, error)

GetDiskActivity returns activity information for configured disks.

Using Linux iostat : http://www.kernel.org/doc/Documentation/iostats.txt

func GetNetActivity Uses

func GetNetActivity() ([]Value, error)

GetNetActivity returns activity information for configured network interfaces.

func ProcessMemory Uses

func ProcessMemory(pid int) (uint64, error)

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.

type FormatIO Uses

type FormatIO func(device string, in, out uint64) string

FormatIO is a text format method for IOActivity.

type IOActivity Uses

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 Uses

func NewIOActivity(app cdtype.RenderSimple) *IOActivity

NewIOActivity create a new data store for IO activity monitoring.

func (*IOActivity) Check Uses

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) Get Uses

func (ioa *IOActivity) Get()

Get new data from source.

func (*IOActivity) Settings Uses

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 Uses

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 Uses

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.

func (*RenderOne) Append Uses

func (ro *RenderOne) Append(str string, value float64)

Append adds new data values to the renderer. The value must be in the 0..100 range.

func (*RenderOne) Clear Uses

func (ro *RenderOne) Clear()

Clear resets the internal text.

func (*RenderOne) Text Uses

func (ro *RenderOne) Text() string

Text returns the text to display.

type RenderPercent Uses

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 Uses

func (rp *RenderPercent) Append(str string, value float64)

Append adds a value to the renderer.

func (*RenderPercent) Clear Uses

func (rp *RenderPercent) Clear()

Clear resets the internal data.

func (*RenderPercent) Display Uses

func (rp *RenderPercent) Display()

Display renders and displays the provided values.

func (*RenderPercent) SetSize Uses

func (rp *RenderPercent) SetSize(size int)

SetSize sets the number of values to render on icon. Mandatory with and after Settings.

func (*RenderPercent) Settings Uses

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 Uses

type TextIcon struct {
    TextInfo
    // contains filtered or unexported fields
}

TextIcon renders a paired value text on icon quickinfo.

func NewTextIcon Uses

func NewTextIcon(app cdtype.RenderSimple) *TextIcon

NewTextIcon creates a new paired value text renderer on icon quickinfo.

func (*TextIcon) Display Uses

func (ti *TextIcon) Display()

Display renders data on icon quickinfo.

type TextInfo Uses

type TextInfo struct {
    // contains filtered or unexported fields
}

TextInfo defines the base data for a paired value text renderer.

func (*TextInfo) Append Uses

func (ti *TextInfo) Append(dev string, in, out uint64)

Append adds new data values to the renderer.

func (*TextInfo) Clear Uses

func (ti *TextInfo) Clear()

Clear resets the internal text.

func (*TextInfo) Fail Uses

func (ti *TextInfo) Fail(dev string)

Fail adds a data error to the renderer.

func (*TextInfo) SetCallAppend Uses

func (ti *TextInfo) SetCallAppend(call FormatIO)

SetCallAppend declares the text formatter callback for each value.

func (*TextInfo) SetCallFail Uses

func (ti *TextInfo) SetCallFail(call func(dev string) string)

SetCallFail declares the error formatter callback.

func (*TextInfo) SetSeparator Uses

func (ti *TextInfo) SetSeparator(sep string)

SetSeparator declares the text separator to add between text values.

type TextLabel Uses

type TextLabel struct {
    TextInfo
    // contains filtered or unexported fields
}

TextLabel renders a paired value text on icon label.

func NewTextLabel Uses

func NewTextLabel(app cdtype.RenderSimple) *TextLabel

NewTextLabel creates a new paired value text renderer on icon label.

func (*TextLabel) Display Uses

func (ti *TextLabel) Display()

Display renders data on icon label.

type TextNil Uses

type TextNil struct {
    TextInfo
}

TextNil provides a dumb interface compatible with a paired value text renderer.

func NewTextNil Uses

func NewTextNil() *TextNil

NewTextNil creates a dumb interface compatible with paired value text renderer.

func (*TextNil) Display Uses

func (ti *TextNil) Display()

Display will do nothing on the nil renderer.

type Value Uses

type Value struct {
    Field string
    In    uint64
    Out   uint64
}

Value define a counter value for the paired renderer.

type VideoCard Uses

type VideoCard struct {
    Vendor            string
    Renderer          string
    CoreProfileOpenGL string
    VersionOpenGL     string
}

VideoCard defines video card and drivers informations.

func NewVideoCard Uses

func NewVideoCard(log cdtype.Logger) (*VideoCard, error)

NewVideoCard gets informations about the video card.

Package sysinfo imports 10 packages (graph) and is imported by 6 packages. Updated 2017-09-30. Refresh now. Tools for package owners.