|
|
|
|
|
|
|
|
| from collections import namedtuple as nt
|
|
|
| from ._common import AIX
|
| from ._common import BSD
|
| from ._common import FREEBSD
|
| from ._common import LINUX
|
| from ._common import MACOS
|
| from ._common import SUNOS
|
| from ._common import WINDOWS
|
|
|
|
|
|
|
|
|
|
|
|
|
| sswap = nt("sswap", ("total", "used", "free", "percent", "sin", "sout"))
|
|
|
|
|
| sdiskusage = nt("sdiskusage", ("total", "used", "free", "percent"))
|
|
|
|
|
| sdiskio = nt(
|
| "sdiskio",
|
| (
|
| "read_count",
|
| "write_count",
|
| "read_bytes",
|
| "write_bytes",
|
| "read_time",
|
| "write_time",
|
| ),
|
| )
|
|
|
|
|
| sdiskpart = nt("sdiskpart", ("device", "mountpoint", "fstype", "opts"))
|
|
|
|
|
| snetio = nt(
|
| "snetio",
|
| (
|
| "bytes_sent",
|
| "bytes_recv",
|
| "packets_sent",
|
| "packets_recv",
|
| "errin",
|
| "errout",
|
| "dropin",
|
| "dropout",
|
| ),
|
| )
|
|
|
|
|
| suser = nt("suser", ("name", "terminal", "host", "started", "pid"))
|
|
|
|
|
| sconn = nt(
|
| "sconn", ("fd", "family", "type", "laddr", "raddr", "status", "pid")
|
| )
|
|
|
|
|
| snicaddr = nt("snicaddr", ("family", "address", "netmask", "broadcast", "ptp"))
|
|
|
|
|
| snicstats = nt("snicstats", ("isup", "duplex", "speed", "mtu", "flags"))
|
|
|
|
|
| scpustats = nt(
|
| "scpustats", ("ctx_switches", "interrupts", "soft_interrupts", "syscalls")
|
| )
|
|
|
|
|
| scpufreq = nt("scpufreq", ("current", "min", "max"))
|
|
|
|
|
| shwtemp = nt("shwtemp", ("label", "current", "high", "critical"))
|
|
|
|
|
| sbattery = nt("sbattery", ("percent", "secsleft", "power_plugged"))
|
|
|
|
|
| sfan = nt("sfan", ("label", "current"))
|
|
|
|
|
| if LINUX or WINDOWS or MACOS or BSD:
|
| pheap = nt(
|
| "pheap",
|
| [
|
| "heap_used",
|
| "mmap_used",
|
| ],
|
| )
|
| if WINDOWS:
|
| pheap = nt("pheap", pheap._fields + ("heap_count",))
|
|
|
|
|
|
|
|
|
|
|
|
|
| pcputimes = nt(
|
| "pcputimes", ("user", "system", "children_user", "children_system")
|
| )
|
|
|
|
|
| popenfile = nt("popenfile", ("path", "fd"))
|
|
|
|
|
| pthread = nt("pthread", ("id", "user_time", "system_time"))
|
|
|
|
|
| puids = nt("puids", ("real", "effective", "saved"))
|
|
|
|
|
| pgids = nt("pgids", ("real", "effective", "saved"))
|
|
|
|
|
| pio = nt("pio", ("read_count", "write_count", "read_bytes", "write_bytes"))
|
|
|
|
|
| pionice = nt("pionice", ("ioclass", "value"))
|
|
|
|
|
| pctxsw = nt("pctxsw", ("voluntary", "involuntary"))
|
|
|
|
|
| pconn = nt("pconn", ("fd", "family", "type", "laddr", "raddr", "status"))
|
|
|
|
|
| addr = nt("addr", ("ip", "port"))
|
|
|
|
|
|
|
|
|
|
|
| if LINUX:
|
|
|
|
|
| scputimes = None
|
|
|
|
|
| svmem = nt(
|
| "svmem",
|
| (
|
| "total",
|
| "available",
|
| "percent",
|
| "used",
|
| "free",
|
| "active",
|
| "inactive",
|
| "buffers",
|
| "cached",
|
| "shared",
|
| "slab",
|
| ),
|
| )
|
|
|
|
|
| sdiskio = nt(
|
| "sdiskio",
|
| (
|
| "read_count",
|
| "write_count",
|
| "read_bytes",
|
| "write_bytes",
|
| "read_time",
|
| "write_time",
|
| "read_merged_count",
|
| "write_merged_count",
|
| "busy_time",
|
| ),
|
| )
|
|
|
|
|
| popenfile = nt("popenfile", ("path", "fd", "position", "mode", "flags"))
|
|
|
|
|
| pmem = nt("pmem", ("rss", "vms", "shared", "text", "lib", "data", "dirty"))
|
|
|
|
|
| pfullmem = nt("pfullmem", pmem._fields + ("uss", "pss", "swap"))
|
|
|
|
|
| pmmap_grouped = nt(
|
| "pmmap_grouped",
|
| (
|
| "path",
|
| "rss",
|
| "size",
|
| "pss",
|
| "shared_clean",
|
| "shared_dirty",
|
| "private_clean",
|
| "private_dirty",
|
| "referenced",
|
| "anonymous",
|
| "swap",
|
| ),
|
| )
|
|
|
|
|
| pmmap_ext = nt(
|
| "pmmap_ext", "addr perms " + " ".join(pmmap_grouped._fields)
|
| )
|
|
|
|
|
| pio = nt(
|
| "pio",
|
| (
|
| "read_count",
|
| "write_count",
|
| "read_bytes",
|
| "write_bytes",
|
| "read_chars",
|
| "write_chars",
|
| ),
|
| )
|
|
|
|
|
| pcputimes = nt(
|
| "pcputimes",
|
| ("user", "system", "children_user", "children_system", "iowait"),
|
| )
|
|
|
|
|
|
|
|
|
|
|
| elif WINDOWS:
|
|
|
|
|
| scputimes = nt("scputimes", ("user", "system", "idle", "interrupt", "dpc"))
|
|
|
|
|
| svmem = nt("svmem", ("total", "available", "percent", "used", "free"))
|
|
|
|
|
| pmem = nt(
|
| "pmem",
|
| (
|
| "rss",
|
| "vms",
|
| "num_page_faults",
|
| "peak_wset",
|
| "wset",
|
| "peak_paged_pool",
|
| "paged_pool",
|
| "peak_nonpaged_pool",
|
| "nonpaged_pool",
|
| "pagefile",
|
| "peak_pagefile",
|
| "private",
|
| ),
|
| )
|
|
|
|
|
| pfullmem = nt("pfullmem", pmem._fields + ("uss",))
|
|
|
|
|
| pmmap_grouped = nt("pmmap_grouped", ("path", "rss"))
|
|
|
|
|
| pmmap_ext = nt(
|
| "pmmap_ext", "addr perms " + " ".join(pmmap_grouped._fields)
|
| )
|
|
|
|
|
| pio = nt(
|
| "pio",
|
| (
|
| "read_count",
|
| "write_count",
|
| "read_bytes",
|
| "write_bytes",
|
| "other_count",
|
| "other_bytes",
|
| ),
|
| )
|
|
|
|
|
|
|
|
|
|
|
| elif MACOS:
|
|
|
|
|
| scputimes = nt("scputimes", ("user", "nice", "system", "idle"))
|
|
|
|
|
| svmem = nt(
|
| "svmem",
|
| (
|
| "total",
|
| "available",
|
| "percent",
|
| "used",
|
| "free",
|
| "active",
|
| "inactive",
|
| "wired",
|
| ),
|
| )
|
|
|
|
|
| pmem = nt("pmem", ("rss", "vms", "pfaults", "pageins"))
|
|
|
|
|
| pfullmem = nt("pfullmem", pmem._fields + ("uss",))
|
|
|
|
|
|
|
|
|
|
|
| elif BSD:
|
|
|
|
|
| svmem = nt(
|
| "svmem",
|
| (
|
| "total",
|
| "available",
|
| "percent",
|
| "used",
|
| "free",
|
| "active",
|
| "inactive",
|
| "buffers",
|
| "cached",
|
| "shared",
|
| "wired",
|
| ),
|
| )
|
|
|
|
|
| scputimes = nt("scputimes", ("user", "nice", "system", "idle", "irq"))
|
|
|
|
|
| pmem = nt("pmem", ("rss", "vms", "text", "data", "stack"))
|
|
|
|
|
| pfullmem = pmem
|
|
|
|
|
| pcputimes = nt(
|
| "pcputimes", ("user", "system", "children_user", "children_system")
|
| )
|
|
|
|
|
| pmmap_grouped = nt(
|
| "pmmap_grouped", "path rss, private, ref_count, shadow_count"
|
| )
|
|
|
|
|
| pmmap_ext = nt(
|
| "pmmap_ext", "addr, perms path rss, private, ref_count, shadow_count"
|
| )
|
|
|
|
|
| if FREEBSD:
|
| sdiskio = nt(
|
| "sdiskio",
|
| (
|
| "read_count",
|
| "write_count",
|
| "read_bytes",
|
| "write_bytes",
|
| "read_time",
|
| "write_time",
|
| "busy_time",
|
| ),
|
| )
|
| else:
|
| sdiskio = nt(
|
| "sdiskio",
|
| ("read_count", "write_count", "read_bytes", "write_bytes"),
|
| )
|
|
|
|
|
|
|
|
|
|
|
| elif SUNOS:
|
|
|
|
|
| scputimes = nt("scputimes", ("user", "system", "idle", "iowait"))
|
|
|
|
|
| pcputimes = nt(
|
| "pcputimes", ("user", "system", "children_user", "children_system")
|
| )
|
|
|
|
|
| svmem = nt("svmem", ("total", "available", "percent", "used", "free"))
|
|
|
|
|
| pmem = nt("pmem", ("rss", "vms"))
|
|
|
|
|
| pfullmem = pmem
|
|
|
|
|
| pmmap_grouped = nt("pmmap_grouped", ("path", "rss", "anonymous", "locked"))
|
|
|
|
|
| pmmap_ext = nt(
|
| "pmmap_ext", "addr perms " + " ".join(pmmap_grouped._fields)
|
| )
|
|
|
|
|
|
|
|
|
|
|
| elif AIX:
|
|
|
|
|
| pmem = nt("pmem", ("rss", "vms"))
|
|
|
|
|
| pfullmem = pmem
|
|
|
|
|
| scputimes = nt("scputimes", ("user", "system", "idle", "iowait"))
|
|
|
|
|
| svmem = nt("svmem", ("total", "available", "percent", "used", "free"))
|
|
|