...

Package psutil

import "github.com/cybertec-postgresql/pgwatch/v3/internal/metrics/psutil"
Overview
Index

Overview ▾

Variables

var ErrNotImplemented = errors.New("not implemented")
var prevCPULoadTimeStats cpu.TimesStat

"cache" of last CPU utilization stats for GetGoPsutilCPU to get more exact results and not having to sleep

var prevCPULoadTimeStatsLock sync.RWMutex
var prevCPULoadTimestamp time.Time

func CheckFolderExistsAndReadable

func CheckFolderExistsAndReadable(path string) bool

func GetGoPsutilCPU

func GetGoPsutilCPU(interval time.Duration) ([]map[string]any, error)

Simulates "psutil" metric output. Assumes the result from last call as input, otherwise uses a 1s measurement

func GetGoPsutilDiskPG

func GetGoPsutilDiskPG(DataDirs, TblspaceDirs []map[string]any) ([]map[string]any, error)

func GetGoPsutilDiskTotals

func GetGoPsutilDiskTotals() ([]map[string]any, error)

func GetGoPsutilMem

func GetGoPsutilMem() ([]map[string]any, error)

func GetLoadAvgLocal

func GetLoadAvgLocal() ([]map[string]any, error)

func GetPathUnderlyingDeviceID

func GetPathUnderlyingDeviceID(_ string) (uint64, error)

func goPsutilCalcCPUUtilization

func goPsutilCalcCPUUtilization(probe0, probe1 cpu.TimesStat) float64