| 
									
										
										
										
											2020-02-11 10:53:25 +08:00
										 |  |  | package staros | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | import ( | 
					
						
							|  |  |  | 	"time" | 
					
						
							|  |  |  | ) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-07-17 09:56:23 +08:00
										 |  |  | const ( | 
					
						
							|  |  |  | 	KB = 1024 | 
					
						
							|  |  |  | 	MB = KB << 10 | 
					
						
							|  |  |  | 	GB = MB << 10 | 
					
						
							|  |  |  | 	TB = GB << 10 | 
					
						
							|  |  |  | 	PB = TB << 10 | 
					
						
							|  |  |  | ) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | type NetAdapter struct { | 
					
						
							|  |  |  | 	Name      string | 
					
						
							|  |  |  | 	RecvBytes uint64 | 
					
						
							|  |  |  | 	SendBytes uint64 | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | type NetSpeed struct { | 
					
						
							|  |  |  | 	Name      string | 
					
						
							|  |  |  | 	RecvBytes float64 | 
					
						
							|  |  |  | 	SendBytes float64 | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-11 10:53:25 +08:00
										 |  |  | // Process 定义一个进程的信息 | 
					
						
							|  |  |  | type Process struct { | 
					
						
							|  |  |  | 	PPid      int64 | 
					
						
							|  |  |  | 	Pid       int64 | 
					
						
							|  |  |  | 	Name      string | 
					
						
							|  |  |  | 	ExecPath  string | 
					
						
							|  |  |  | 	LocalPath string | 
					
						
							| 
									
										
										
										
											2020-07-17 09:56:23 +08:00
										 |  |  | 	Path      string | 
					
						
							| 
									
										
										
										
											2020-02-11 10:53:25 +08:00
										 |  |  | 	Args      []string | 
					
						
							|  |  |  | 	RUID      int | 
					
						
							|  |  |  | 	EUID      int | 
					
						
							|  |  |  | 	RGID      int | 
					
						
							|  |  |  | 	EGID      int | 
					
						
							|  |  |  | 	TPid      int64 | 
					
						
							|  |  |  | 	Uptime    time.Time | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | type MemStatus struct { | 
					
						
							|  |  |  | 	All           uint64 | 
					
						
							|  |  |  | 	Used          uint64 | 
					
						
							|  |  |  | 	Free          uint64 | 
					
						
							|  |  |  | 	Shared        uint64 | 
					
						
							|  |  |  | 	BuffCache     uint64 | 
					
						
							|  |  |  | 	Available     uint64 | 
					
						
							|  |  |  | 	SwapAll       uint64 | 
					
						
							|  |  |  | 	SwapUsed      uint64 | 
					
						
							|  |  |  | 	SwapFree      uint64 | 
					
						
							|  |  |  | 	VirtualAll    uint64 | 
					
						
							|  |  |  | 	VirtualUsed   uint64 | 
					
						
							|  |  |  | 	VirtualAvail  uint64 | 
					
						
							|  |  |  | 	AvailExtended uint64 | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2020-06-08 14:52:16 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | type DiskStatus struct { | 
					
						
							|  |  |  | 	All       uint64 | 
					
						
							|  |  |  | 	Used      uint64 | 
					
						
							|  |  |  | 	Free      uint64 | 
					
						
							|  |  |  | 	Available uint64 | 
					
						
							|  |  |  | } |