{"modulePath":"github.com/wavetermdev/waveterm","version":"v0.14.5","isLatest":true,"isStandardLibrary":false,"goos":"linux","goarch":"amd64","docs":"# package procinfo\n\n## Variables\n\n```go\nvar ErrNotFound = errors.New(\"procinfo: process not found\")\n```\nErrNotFound is returned by GetProcInfo when the requested pid does not exist.\n\n```go\nvar LinuxStatStatus = map[string]string{\n\t\"R\": \"running\",\n\t\"S\": \"sleeping\",\n\t\"D\": \"disk-wait\",\n\t\"Z\": \"zombie\",\n\t\"T\": \"stopped\",\n\t\"t\": \"tracing-stop\",\n\t\"W\": \"paging\",\n\t\"X\": \"dead\",\n\t\"x\": \"dead\",\n\t\"K\": \"wakekill\",\n\t\"P\": \"parked\",\n\t\"I\": \"idle\",\n}\n```\nLinuxStatStatus maps the single-character state from /proc/\\[pid]/stat to a human-readable name.\n\n## Functions\n\n```go\nfunc MakeGlobalSnapshot() (any, error)\n```\n\n## Types\n\n```go\ntype ProcInfo struct {\n\tPid        int32\n\tPpid       int32\n\tCommand    string\n\tStatus     string\n\tCpuUser    float64 // cumulative user CPU seconds; -1 if unavailable\n\tCpuSys     float64 // cumulative system CPU seconds; -1 if unavailable\n\tVmRSS      int64   // resident set size in bytes; -1 if unavailable\n\tUid        uint32\n\tNumThreads int32 // -1 if unavailable\n}\n```\nProcInfo holds per-process information read from the OS. CpuUser and CpuSys are cumulative CPU seconds since process start; callers should diff two samples over a known interval to derive a rate. CpuUser, CpuSys, and VmRSS are set to -1 when the data is unavailable (e.g. permission denied reading another user's process).\n\n```go\nfunc GetProcInfo(_ context.Context, _ any, pid int32) (*ProcInfo, error)\n```\nGetProcInfo reads process information for the given pid from /proc. It reads /proc/\\[pid]/stat for most fields and /proc/\\[pid]/status for the UID.\n\n","path":"github.com/wavetermdev/waveterm/pkg/util/procinfo","name":"procinfo","synopsis":"","isRedistributable":true}
