Skip to content

Instantly share code, notes, and snippets.

@aliceinwire
Created February 15, 2017 15:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aliceinwire/7545b1e3cca86340e89a9ddced724840 to your computer and use it in GitHub Desktop.
Save aliceinwire/7545b1e3cca86340e89a9ddced724840 to your computer and use it in GitHub Desktop.
emerge-time.sh
# listing emerge compiling time
function emergetime {
genlop -nt '*' |
tail -n +3 |
sed -n '
1~3 {x;b}
3~3 d
# prefix 0
s/ \([0-9] \)/ 0\1/g
# remove "," and "and"
s/\(,\|and \)//g
# remove tailing dot
/merge time/ s/\.$//
# remove plural
s/\(hour\|minute\|second\)s/\1/g
s/\([0-9]\+\) second/A \1/
s/\([0-9]\+\) minute/B \1/
s/\([0-9]\+\) hour/C \1/
G
s/\n//
# remove extra heading spaces
s/^ \+//
p
'
}
# Sort compiled time package showing the 30 most time expensive package
emergetime | sort | tac | head -30 | nl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment