sysinfo

package
v0.0.0-...-0caaa62 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 1, 2017 License: GPL-3.0-or-later Imports: 10 Imported by: 0

Documentation

Overview

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

Index

Constants

View Source
const KernelDiskStats = "/proc/diskstats"

KernelDiskStats is the disk activity information source.

View Source
const KernelNetStats = "/proc/net/dev"

KernelNetStats is the network activity information source.

Variables

This section is empty.

Functions

func FormatIcon

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

func FormatRate(size uint64) string

FormatRate format value to string, or nothing if 0.

func ProcessMemory

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.

Types

type FormatIO

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

FormatIO is a text format method for IOActivity.

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

func (ioa *IOActivity) Get()

Get new data from source.

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.

func (*RenderOne) Append

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

func (ro *RenderOne) Clear()

Clear resets the internal text.

func (*RenderOne) Text

func (ro *RenderOne) Text() string

Text returns the text to display.

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) Clear

func (rp *RenderPercent) Clear()

Clear resets the internal data.

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.

func (*TextIcon) Display

func (ti *TextIcon) Display()

Display renders data 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) Append

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

Append adds new data values to the renderer.

func (*TextInfo) Clear

func (ti *TextInfo) Clear()

Clear resets the internal text.

func (*TextInfo) Fail

func (ti *TextInfo) Fail(dev string)

Fail adds a data error to the renderer.

func (*TextInfo) SetCallAppend

func (ti *TextInfo) SetCallAppend(call FormatIO)

SetCallAppend declares the text formatter callback for each value.

func (*TextInfo) SetCallFail

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

SetCallFail declares the error formatter callback.

func (*TextInfo) SetSeparator

func (ti *TextInfo) SetSeparator(sep string)

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.

func (*TextLabel) Display

func (ti *TextLabel) Display()

Display renders data 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.

func (*TextNil) Display

func (ti *TextNil) Display()

Display will do nothing on the nil renderer.

type Value

type Value struct {
	Field string
	In    uint64
	Out   uint64
}

Value define a counter value for the paired renderer.

func GetDiskActivity

func GetDiskActivity() ([]Value, error)

GetDiskActivity returns activity information for configured disks.

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

func GetNetActivity

func GetNetActivity() ([]Value, error)

GetNetActivity returns activity information for configured network interfaces.

type VideoCard

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

VideoCard defines video card and drivers informations.

func NewVideoCard

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

NewVideoCard gets informations about the video card.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL