mirror of
https://github.com/datarhei/core.git
synced 2025-10-20 22:49:50 +08:00
Accumulate cpu and memory usage of child processes
This commit is contained in:
@@ -27,13 +27,13 @@ func init() {
|
||||
}
|
||||
}
|
||||
|
||||
func (p *process) cpuTimes() (*cpuTimesStat, error) {
|
||||
func cpuTimes(pid int32) (*cpuTimesStat, error) {
|
||||
value := os.Getenv("HOST_PROC")
|
||||
if value == "" {
|
||||
value = "/proc"
|
||||
}
|
||||
|
||||
path := filepath.Join(value, strconv.FormatInt(int64(p.pid), 10), "stat")
|
||||
path := filepath.Join(value, strconv.FormatInt(int64(pid), 10), "stat")
|
||||
|
||||
contents, err := os.ReadFile(path)
|
||||
if err != nil {
|
||||
|
Reference in New Issue
Block a user