MCPcopy Create free account
hub / github.com/MertJSX/folderhost / getProcessTreeRAM

Function getProcessTreeRAM

utils/service_utils/ram_management.go:62–90  ·  view source on GitHub ↗
(pid int)

Source from the content-addressed store, hash-verified

60}
61
62func getProcessTreeRAM(pid int) (int64, error) {
63 switch runtime.GOOS {
64 case "windows":
65 return getProcessRAM(pid)
66
67 default:
68 var total int64
69 visited := make(map[int]bool)
70
71 var walk func(int)
72 walk = func(p int) {
73 if visited[p] {
74 return
75 }
76 visited[p] = true
77
78 if ram, err := getProcessRAM(p); err == nil {
79 total += ram
80 }
81
82 for _, child := range getChildPIDs(p) {
83 walk(child)
84 }
85 }
86
87 walk(pid)
88 return total, nil
89 }
90}
91
92func getChildPIDs(pid int) []int {
93 var children []int

Callers 5

ListServicesMethod · 0.85
ListAllowedServicesMethod · 0.85
GetServiceStatusMethod · 0.85
GetAllServicesRAMMethod · 0.85
StartMonitoringMethod · 0.85

Calls 2

getProcessRAMFunction · 0.85
getChildPIDsFunction · 0.85

Tested by

no test coverage detected