procmon

package module
v0.0.0-...-612c548 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2017 License: MIT Imports: 11 Imported by: 0

README

procmon

A Go library to send resource consumption data to datadog

Documentation

Overview

Package procmon is a simple library for recording samples of a process and sending the results to datadog.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Measure

type Measure struct {
	// User is the number of usermode CPU jiffies used
	User uint64
	// System is the number of kernelmode CPU jiffies used
	System uint64
	// UserTotal is the number of usermode CPU jiffies used across all processes
	UserTotal uint64
	// SystemTotal is the number of kernelmode CPU jiffies used across all processes
	SystemTotal uint64
	// IdleTotal is the number of CPU jiffies spent in the idle task.
	IdleTotal uint64
	// Memory is the amount of memory used in kB
	Memory uint64
}

Measure is a point in time measure of a process's resource consumption.

func (*Measure) IdlePerc

func (m *Measure) IdlePerc() float64

IdlePerc calculates the percentage of CPU time spent idling.

func (*Measure) SysInECU

func (m *Measure) SysInECU(instance *ecu.Instance) float64

SysInECU calculates the amount of CPU time spent in the kernel, as measured in ECUs, for the monitored process assuming it is running on a machine of type `instance`.

func (*Measure) SysPerc

func (m *Measure) SysPerc() float64

SysPerc calculates the percentage of CPU time spent in the kernel by the monitored process.

func (*Measure) Total

func (m *Measure) Total() uint64

Total calculates the total jiffies spent between ticks.

func (*Measure) UserInECU

func (m *Measure) UserInECU(instance *ecu.Instance) float64

UserInECU calculates the amount of CPU time spent in userland, as measured in ECUs, for the monitored process assuming it is running on a machine of type `instance`.

func (*Measure) UserPerc

func (m *Measure) UserPerc() float64

UserPerc calculates the percentage of CPU time spent in userland by the monitored process.

type Monitor

type Monitor struct {
	Output chan<- Measure
	// contains filtered or unexported fields
}

Monitor represents a continuous monitoring of a given Linux process.

func New

func New(out chan<- Measure, process int) (*Monitor, error)

New creates a new monitor and starts it.

func (*Monitor) Monitor

func (m *Monitor) Monitor()

Monitor runs in a background goroutine that can be halted with Stop and monitors process metrics, submitting results to datadog every 5 seconds.

func (*Monitor) Stop

func (m *Monitor) Stop()

Stop halts the background monitoring task.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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