procfs

package
v0.0.0-...-0003b89 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2014 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

procfs contains several low level functions to read information from /proc filesystem, and also provides some utility functions like JiffiesToDuration.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func JiffiesToDuration

func JiffiesToDuration(jiffies uint64) time.Duration

Types

type ProcessSchedStat

type ProcessSchedStat struct {
	// Number of processes
	NumProcesses int

	// Total time spent on the cpu (Unit: nanoseconds)
	Running uint64

	// Total time spent waiting on a runqueue (Unit: nanoseconds)
	RunWait uint64

	// # of timeslices run on this cpu. i.e. # of times run on the cpu
	NumTimeSlices uint64
}

func (*ProcessSchedStat) Add

func (self *ProcessSchedStat) Add(pid int) error

Add() read the schedstat of pid, and add stat to the fields in self parameters. This function is useful if one wants to read stats of a group of processes.

type SchedulerLoadReader

type SchedulerLoadReader interface {
	// Load() returns the load of each core of given container. If there's
	// no information of given container, it should return nil, nil. If the
	// returned load is not nil, the number of elements in the returned
	// slice must be the same as the number of cores on the machine.  Each
	// element in the returned slices represents number of tasks/threads in
	// the container and waiting for the CPU, i.e. number of runnable
	// tasks.
	Load(container string) ([]int, error)

	AllContainers() ([]string, error)
}

func NewSchedulerLoadReader

func NewSchedulerLoadReader() (SchedulerLoadReader, error)

Jump to

Keyboard shortcuts

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