diff options
author | Valery Piashchynski <[email protected]> | 2021-04-19 21:00:11 +0300 |
---|---|---|
committer | Valery Piashchynski <[email protected]> | 2021-04-19 21:00:11 +0300 |
commit | 779cc3f5aebb749ab4bc6190e03cc86ff3f151a0 (patch) | |
tree | d36dc3ce9a36fff1b15b8795e8fa08d397317d14 /pkg | |
parent | 885b65aa3964d68c63e46031e6c8b65a05a15be8 (diff) |
- Add command information to the `./rr workers` info
Signed-off-by: Valery Piashchynski <[email protected]>
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/process/state.go | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/pkg/process/state.go b/pkg/process/state.go index 462dd47e..652ec77c 100644 --- a/pkg/process/state.go +++ b/pkg/process/state.go @@ -24,7 +24,11 @@ type State struct { // Values might vary for different operating systems and based on RSS. MemoryUsage uint64 `json:"memoryUsage"` + // CPU_Percent returns how many percent of the CPU time this process uses CPUPercent float64 + + // Command used in the service plugin and shows a command for the particular service + Command string } // WorkerProcessState creates new worker state definition. @@ -51,7 +55,7 @@ func WorkerProcessState(w worker.BaseProcess) (State, error) { }, nil } -func GeneralProcessState(pid int) (State, error) { +func GeneralProcessState(pid int, command string) (State, error) { const op = errors.Op("process_state") p, _ := process.NewProcess(int32(pid)) i, err := p.MemoryInfo() @@ -67,5 +71,6 @@ func GeneralProcessState(pid int) (State, error) { CPUPercent: percent, Pid: pid, MemoryUsage: i.RSS, + Command: command, }, nil } |