File: process.go

package info (click to toggle)
witr 0.2.4%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 736 kB
  • sloc: sh: 79; makefile: 10
file content (64 lines) | stat: -rw-r--r-- 1,711 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
package model

import "time"

type Process struct {
	PID       int
	PPID      int
	Command   string
	Cmdline   string
	Exe       string
	StartedAt time.Time
	User      string

	WorkingDir string
	GitRepo    string
	GitBranch  string
	Container  string
	Service    string

	// Network context
	ListeningPorts []int
	BindAddresses  []string

	// Health status ("healthy", "zombie", "stopped", "high-cpu", "high-mem")
	Health string

	// Forked status ("forked", "not-forked", "unknown")
	Forked string
	// Environment variables (key=value)
	Env []string

	// True if the executable was deleted after the process started
	ExeDeleted bool

	// Extended information for verbose output
	Memory      MemoryInfo `json:",omitempty"`
	IO          IOStats    `json:",omitempty"`
	FileDescs   []string   `json:",omitempty"`
	FDCount     int        `json:",omitempty"`
	FDLimit     uint64     `json:",omitempty"`
	Children    []int      `json:",omitempty"`
	ThreadCount int        `json:",omitempty"`
}

// MemoryInfo contains detailed memory information
type MemoryInfo struct {
	VMS    uint64  // Virtual memory size in bytes
	RSS    uint64  // Resident set size in bytes
	VMSMB  float64 // Virtual memory in MB
	RSSMB  float64 // Resident memory in MB
	Shared uint64  // Shared memory size in bytes
	Text   uint64  // Code size in bytes
	Lib    uint64  // Library size in bytes
	Data   uint64  // Data + stack size in bytes
	Dirty  uint64  // Dirty pages size in bytes
}

// IOStats contains I/O statistics
type IOStats struct {
	ReadBytes  uint64 // Bytes read from storage
	WriteBytes uint64 // Bytes written to storage
	ReadOps    uint64 // Number of read operations
	WriteOps   uint64 // Number of write operations
}