Skip to content

Commit

Permalink
Added processgraph function
Browse files Browse the repository at this point in the history
  • Loading branch information
eko committed Jun 16, 2018
1 parent 2e86472 commit 92f9986
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .functions
Expand Up @@ -307,3 +307,9 @@ function pingraph {
function wwwgraph {
while true; do curl -s -o /dev/null -w '{"lookup": %{time_namelookup}, "connect": %{time_connect}, "appconnect": %{time_appconnect}, "pretransfer": %{time_pretransfer}, "redirect": %{time_redirect}, "starttransfer": %{time_starttransfer}, "total": %{time_total}}' $1 | sed -E 's/([0-9]),([0-9])/\1.\2/g'; sleep 1.5; done | jplot lookup+connect+appconnect+pretransfer+redirect+starttransfer+total
}

# Graph a process CPU and memory usage
# Usage: processgraph <name> (Chrome, node, ...)
function processgraph {
while true; do ps aux | grep $1 | grep -v grep | awk '{ cpu += $3; mem += $4} END {print "{\"cpu\":"cpu",\"mem\":"mem"}"}' | sed -E 's/([0-9]),([0-9])/\1.\2/g'; sleep 0.2; done | jplot --steps 600 cpu+mem
}

0 comments on commit 92f9986

Please sign in to comment.