gops

package
Version: v0.0.0-...-87dfe0d Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Extract the information on running processes from gopsutil

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ByRSSDesc

type ByRSSDesc struct {
	ProcessNameGroups
}

func (ByRSSDesc) Less

func (s ByRSSDesc) Less(i, j int) bool

type ProcessInfo

type ProcessInfo struct {
	PID      int32
	PPID     int32
	Name     string
	RSS      uint64
	PctMem   float64
	VMS      uint64
	Username string
}

func GetProcesses

func GetProcesses() ([]*ProcessInfo, error)

Return a slice of all the processes that are running

type ProcessNameGroup

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

Represents a group of processes, grouped by name

func NewProcessNameGroup

func NewProcessNameGroup() *ProcessNameGroup

func (*ProcessNameGroup) Name

func (pg *ProcessNameGroup) Name() string

func (*ProcessNameGroup) PctMem

func (pg *ProcessNameGroup) PctMem() float64

func (*ProcessNameGroup) Pids

func (pg *ProcessNameGroup) Pids() []int32

func (*ProcessNameGroup) RSS

func (pg *ProcessNameGroup) RSS() uint64

func (*ProcessNameGroup) Usernames

func (pg *ProcessNameGroup) Usernames() []string

Return a slice of the usernames, sorted alphabetically

func (*ProcessNameGroup) VMS

func (pg *ProcessNameGroup) VMS() uint64

type ProcessNameGroups

type ProcessNameGroups []*ProcessNameGroup

func GroupByName

func GroupByName(processInfos []*ProcessInfo) ProcessNameGroups

Group the processInfos by name and return a slice of ProcessNameGroup

func TopRSSProcessGroups

func TopRSSProcessGroups(limit int) (ProcessNameGroups, error)

Return an ordered slice of the process groups that use the most RSS

func (ProcessNameGroups) Len

func (s ProcessNameGroups) Len() int

Sort slices of process groups

func (ProcessNameGroups) Swap

func (s ProcessNameGroups) Swap(i, j int)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL