Skip to content

Commit

Permalink
doc: update json format
Browse files Browse the repository at this point in the history
  • Loading branch information
ZhouYixun committed Jan 8, 2023
1 parent 2ac49bf commit 6058357
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 70 deletions.
92 changes: 46 additions & 46 deletions src/entity/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ type ProcessIO struct {
Wchar int `json:"wchar"`
Syscr int `json:"syscr"`
Syscw int `json:"syscw"`
ReadBytes int `json:"read_bytes"`
WriteBytes int `json:"write_bytes"`
CancelledWriteBytes int `json:"cancelled_write_bytes"`
ReadBytes int `json:"readBytes"`
WriteBytes int `json:"writeBytes"`
CancelledWriteBytes int `json:"cancelledWriteBytes"`
}

type ProcessStat struct {
Expand Down Expand Up @@ -61,49 +61,49 @@ type ProcessStat struct {
}

type ProcessStatus struct {
Name string `json:"Name"`
Umask string `json:"Umask"`
State string `json:"State"`
Tgid string `json:"Tgid"`
Ngid string `json:"Ngid"`
Pid string `json:"Pid"`
PPid string `json:"PPid"`
TracerPid string `json:"TracerPid"`
Uid string `json:"Uid"`
Gid string `json:"Gid"`
FDSize string `json:"FDSize"`
Groups string `json:"Groups"`
VmPeak string `json:"VmPeak"`
VmSize string `json:"VmSize"`
VmLck string `json:"VmLck"`
VmPin string `json:"VmPin"`
VmHWM string `json:"VmHWM"`
VmRSS string `json:"VmRSS"`
RssAnon string `json:"RssAnon"`
RssFile string `json:"RssFile"`
RssShmem string `json:"RssShmem"`
VmData string `json:"VmData"`
VmStk string `json:"VmStk"`
VmExe string `json:"VmExe"`
VmLib string `json:"VmLib"`
VmPTE string `json:"VmPTE"`
VmSwap string `json:"VmSwap"`
Threads string `json:"Threads"`
SigQ string `json:"SigQ"`
SigPnd string `json:"SigPnd"`
ShdPnd string `json:"ShdPnd"`
SigBlk string `json:"SigBlk"`
SigIgn string `json:"SigIgn"`
SigCgt string `json:"SigCgt"`
CapInh string `json:"CapInh"`
CapPrm string `json:"CapPrm"`
CapEff string `json:"CapEff"`
CapBnd string `json:"CapBnd"`
CapAmb string `json:"CapAmb"`
CpusAllowed string `json:"Cpus_allowed"`
CpusAllowedList string `json:"Cpus_allowed_list"`
VoluntaryCtxtSwitches string `json:"voluntary_ctxt_switches"`
NonVoluntaryCtxtSwitches string `json:"nonvoluntary_ctxt_switches"`
Name string `json:"name"`
Umask string `json:"umask"`
State string `json:"state"`
Tgid string `json:"tgid"`
Ngid string `json:"ngid"`
Pid string `json:"pid"`
PPid string `json:"pPid"`
TracerPid string `json:"tracerPid"`
Uid string `json:"uid"`
Gid string `json:"gid"`
FDSize string `json:"fdSize"`
Groups string `json:"groups"`
VmPeak string `json:"vmPeak"`
VmSize string `json:"vmSize"`
VmLck string `json:"vmLck"`
VmPin string `json:"vmPin"`
VmHWM string `json:"vmHWM"`
VmRSS string `json:"vmRSS"`
RssAnon string `json:"rssAnon"`
RssFile string `json:"rssFile"`
RssShmem string `json:"rssShmem"`
VmData string `json:"vmData"`
VmStk string `json:"vmStk"`
VmExe string `json:"vmExe"`
VmLib string `json:"vmLib"`
VmPTE string `json:"vmPTE"`
VmSwap string `json:"vmSwap"`
Threads string `json:"threads"`
SigQ string `json:"sigQ"`
SigPnd string `json:"sigPnd"`
ShdPnd string `json:"shdPnd"`
SigBlk string `json:"sigBlk"`
SigIgn string `json:"sigIgn"`
SigCgt string `json:"sigCgt"`
CapInh string `json:"capInh"`
CapPrm string `json:"capPrm"`
CapEff string `json:"capEff"`
CapBnd string `json:"capBnd"`
CapAmb string `json:"capAmb"`
CpusAllowed string `json:"cpusAllowed"`
CpusAllowedList string `json:"cpusAllowedList"`
VoluntaryCtxtSwitches string `json:"voluntaryCtxtSwitches"`
NonVoluntaryCtxtSwitches string `json:"nonVoluntaryCtxtSwitches"`
}

type ProcessInfo struct {
Expand Down
48 changes: 24 additions & 24 deletions src/entity/system.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ type SystemFSInfo struct {
}

type SystemNetworkInfo struct {
IPv4 string
IPv6 string
Rx uint64
Tx uint64
IPv4 string `json:"ipv4"`
IPv6 string `json:"ipv6"`
Rx uint64 `json:"rx"`
Tx uint64 `json:"tx"`
}

type SystemCpuRaw struct {
Expand All @@ -51,29 +51,29 @@ type SystemCpuRaw struct {
}

type SystemCPUInfo struct {
User float32
Nice float32
System float32
Idle float32
Iowait float32
Irq float32
SoftIrq float32
Steal float32
Guest float32
User float32 `json:"user"`
Nice float32 `json:"nice"`
System float32 `json:"system"`
Idle float32 `json:"idle"`
Iowait float32 `json:"iowait"`
Irq float32 `json:"irq"`
SoftIrq float32 `json:"softIrq"`
Steal float32 `json:"steal"`
Guest float32 `json:"guest"`
}

type SystemStats struct {
Uptime time.Duration
Hostname string
MemTotal uint64
MemFree uint64
MemBuffers uint64
MemCached uint64
SwapTotal uint64
SwapFree uint64
NetworkInfo map[string]*SystemNetworkInfo
CPU map[string]*SystemCPUInfo // or []SystemCPUInfo to get all the cpu-core's stats?
TimeStamp int64
Uptime time.Duration `json:"uptime"`
Hostname string `json:"hostname"`
MemTotal uint64 `json:"memTotal"`
MemFree uint64 `json:"memFree"`
MemBuffers uint64 `json:"memBuffers"`
MemCached uint64 `json:"memCached"`
SwapTotal uint64 `json:"swapTotal"`
SwapFree uint64 `json:"swapFree"`
NetworkInfo map[string]*SystemNetworkInfo `json:"networkInfo"`
CPU map[string]*SystemCPUInfo `json:"cpu"`
TimeStamp int64 `json:"timeStamp"`
}

func (stats *SystemStats) ToString() string {
Expand Down

0 comments on commit 6058357

Please sign in to comment.