1
0
mirror of https://github.com/shirou/gopsutil.git synced 2025-04-28 13:48:49 +08:00
shirou_gopsutil/process.go

44 lines
761 B
Go
Raw Normal View History

package gopsutil
type Process struct {
2014-04-29 14:59:22 +09:00
Pid int32 `json:"pid"`
}
type Open_filesStat struct {
2014-04-24 00:38:19 +09:00
Path string `json:"path"`
Fd uint64 `json:"fd"`
}
type Memory_infoStat struct {
RSS uint64 `json:"rss"` // bytes
VMS uint64 `json:"vms"` // bytes
}
type RlimitStat struct {
2014-04-24 00:38:19 +09:00
Resource int32 `json:"resource"`
Soft int32 `json:"soft"`
Hard int32 `json:"hard"`
}
type Io_countersStat struct {
2014-04-24 00:38:19 +09:00
Read_count int32 `json:"read_count"`
Write_count int32 `json:"write_count"`
Read_bytes int32 `json:"read_bytes"`
Write_bytes int32 `json:"write_bytes"`
}
func Pid_exists(pid int32) (bool, error) {
pids, err := Pids()
if err != nil {
return false, err
}
for _, i := range pids {
if i == pid {
return true, err
}
}
return false, err
}