Skip to content

Instantly share code, notes, and snippets.

View nickolai-voyage's full-sized avatar
😃
hacking away...

nickolai-voyage

😃
hacking away...
View GitHub Profile
@nickolai-voyage
nickolai-voyage / gist:ae421f7c5fa879b2c9ba1ba2fe0bcc45
Created April 26, 2019 21:48
Processor utilization of process as perfcentage
# Output CPU update, proccess stats, and system ticks/second all at once
# Replace newlines with spaces, to be able to analyze the thing as a single line
# Using awk, evaluate ((utime + stime)/CLK_TCK)/(uptime - starttime/CLK_TCK)
cat /proc/uptime /proc/16901/stat <(getconf CLK_TCK) | tr '\n' ' ' | awk '{print (($16+$17)/$NF) / ($1 - $24/$NF)}'
# $16 is utime
# $17 is stime
# $1 is uptime
# $24 is start time
# These numbers are from man page for /prod/[pid]/stat, but plus 2 since /proc/uptime is at the start of the line
# NF refers to `getconf CLK_TCK`
@nickolai-voyage
nickolai-voyage / reviewer.url
Created February 26, 2019 18:35
Search github PR's by reviewer
List of PRs reviewed or being reviewed by $GITHUB_USERNAME
https://github.com/pulls?q=is:pr+reviewed-by:$GITHUB_USERNAME+archived:false+is:open
More search operators for issues and PR's: https://help.github.com/en/articles/using-search-to-filter-issues-and-pull-requests