Merge pull request #710 from rjnagal/summary
Add memory-percent to ps output.
This commit is contained in:
commit
45a0cc2dc7
@ -176,6 +176,7 @@ type ProcessInfo struct {
|
||||
Ppid int `json:"parent_pid"`
|
||||
StartTime string `json:"start_time"`
|
||||
PercentCpu string `json:"percent_cpu"`
|
||||
PercentMemory string `json:"percent_mem"`
|
||||
RSS string `json:"rss"`
|
||||
VirtualSize string `json:"virtual_size"`
|
||||
Status string `json:"status"`
|
||||
|
@ -130,9 +130,9 @@ func (c *containerData) GetProcessList() ([]v2.ProcessInfo, error) {
|
||||
}
|
||||
}
|
||||
// TODO(rjnagal): Take format as an option?
|
||||
format := "user,pid,ppid,stime,pcpu,rss,vsz,stat,time,comm"
|
||||
format := "user,pid,ppid,stime,pcpu,pmem,rss,vsz,stat,time,comm"
|
||||
args := []string{"-e", "-o", format}
|
||||
expectedFields := 10
|
||||
expectedFields := 11
|
||||
out, err := exec.Command("ps", args...).Output()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to execute ps command: %v", err)
|
||||
@ -162,11 +162,12 @@ func (c *containerData) GetProcessList() ([]v2.ProcessInfo, error) {
|
||||
Ppid: ppid,
|
||||
StartTime: fields[3],
|
||||
PercentCpu: fields[4],
|
||||
RSS: fields[5],
|
||||
VirtualSize: fields[6],
|
||||
Status: fields[7],
|
||||
RunningTime: fields[8],
|
||||
Cmd: strings.Join(fields[9:], " "),
|
||||
PercentMemory: fields[5],
|
||||
RSS: fields[6],
|
||||
VirtualSize: fields[7],
|
||||
Status: fields[8],
|
||||
RunningTime: fields[9],
|
||||
Cmd: strings.Join(fields[10:], " "),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -427,8 +427,8 @@ function drawFileSystemUsage(machineInfo, stats) {
|
||||
}
|
||||
|
||||
function drawProcesses(processInfo) {
|
||||
var titles = ["User", "PID", "PPID", "Start Time", "CPU %", "RSS", "Virtual Size", "Status", "Running Time", "Command"];
|
||||
var titleTypes = ['string', 'number', 'number', 'string', 'string', 'string', 'string', 'string', 'string', 'string'];
|
||||
var titles = ["User", "PID", "PPID", "Start Time", "CPU %", "MEM %", "RSS", "Virtual Size", "Status", "Running Time", "Command"];
|
||||
var titleTypes = ['string', 'number', 'number', 'string', 'string', 'string', 'string', 'string', 'string', 'string', 'string'];
|
||||
var data = []
|
||||
for (var i = 1; i < processInfo.length; i++) {
|
||||
var elements = [];
|
||||
@ -437,6 +437,7 @@ function drawProcesses(processInfo) {
|
||||
elements.push(processInfo[i].parent_pid);
|
||||
elements.push(processInfo[i].start_time);
|
||||
elements.push(processInfo[i].percent_cpu);
|
||||
elements.push(processInfo[i].percent_mem);
|
||||
elements.push(processInfo[i].rss);
|
||||
elements.push(processInfo[i].virtual_size);
|
||||
elements.push(processInfo[i].status);
|
||||
|
Loading…
Reference in New Issue
Block a user