From 64add546a4261d48f55a50884489651bfc01d0b3 Mon Sep 17 00:00:00 2001 From: WAKAYAMA Shirou Date: Thu, 24 Apr 2014 00:38:19 +0900 Subject: [PATCH] add json tags to Process class. --- process.go | 84 +++++++++++++++++++++++++++++++------------------------------- 1 file changed, 42 insertions(+), 42 deletions(-) diff --git a/process.go b/process.go index 0d880d6..a5ddae4 100644 --- a/process.go +++ b/process.go @@ -6,64 +6,64 @@ type Process struct { Name string `json:"name"` Exe string `json:"exe"` Cmdline string `json:"cmdline"` - Create_time int64 + Create_time int64 `json:"create_time"` // Parent Process // FIXME: recursive - Status string - Cwd string - Username string - Uids []int32 - Gids []int32 - Terminal string - Nice int32 - Ionice int32 - Rlimit []RlimitStat - Io_counters Io_countersStat - Num_ctx_switches int32 - Num_fds int32 - Num_handles int32 - Num_Threads int32 - // Threads map[string]string - Cpu_times CPU_TimesStat - // Cpu_percent - Cpu_affinity []int32 - Memory_info Memory_infoStat - Memory_info_ex map[string]string - Memory_percent float32 - Memory_maps []Memory_mapsStat - // Children []Process // FIXME: recursive - Open_files []Open_filesStat - Connections []Net_connectionStat - Is_running bool + Status string `json:"status"` + Cwd string `json:"cwd"` + Username string `json:"username"` + Uids []int32 `json:"uids"` + Gids []int32 `json:"gids"` + Terminal string `json:"terminal"` + Nice int32 `json:"nice"` + Ionice int32 `json:"ionice"` + Rlimit []RlimitStat `json:"rlimit"` + Io_counters Io_countersStat `json:"io_counter"` + Num_ctx_switches int32 `json:"num_ctx_switches"` + Num_fds int32 `json:"num_fds"` + Num_handles int32 `json:"num_handles"` + Num_Threads int32 `json:"nunm_threads"` + // Threads map[string]string `json:"threads"` + Cpu_times CPU_TimesStat `json:"cpu_times"` + // Cpu_percent `json:"cpu_percent"` + Cpu_affinity []int32 `json:"cpu_affinity"` + Memory_info Memory_infoStat `json:"memory_info"` + Memory_info_ex map[string]string `json:"memori_info_ex"` + Memory_percent float32 `json:"memory_percent"` + Memory_maps []Memory_mapsStat `json:"memory_maps"` + // Children []Process // FIXME: recursive `json:"children"` + Open_files []Open_filesStat `json:"open_files"` + Connections []Net_connectionStat `json:"connections"` + Is_running bool `json:"is_running"` } type Open_filesStat struct { - Path string - Fd uint32 + Path string `json:"path"` + Fd uint32 `json:"fd"` } type Memory_infoStat struct { - RSS int32 // bytes - VMS int32 // bytes + RSS int32 `json:"rss"` // bytes + VMS int32 `json:"vms"` // bytes } type Memory_mapsStat struct { - Path string - RSS int32 - Anonymous int32 - Swap int32 + Path string `json:"path"` + RSS int32 `json:"rss"` + Anonymous int32 `json:"anonymous"` + Swap int32 `json:"swap"` } type RlimitStat struct { - Rresource int32 - Soft int32 - Hard int32 + Resource int32 `json:"resource"` + Soft int32 `json:"soft"` + Hard int32 `json:"hard"` } type Io_countersStat struct { - Read_count int32 - Write_count int32 - Read_bytes int32 - Write_bytes int32 + 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) {