Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
nice trick: formatting the time code in emerge.log
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
geeksheik
Tux's lil' helper
Tux's lil' helper


Joined: 07 Sep 2003
Posts: 75

PostPosted: Wed Nov 08, 2006 1:14 pm    Post subject: nice trick: formatting the time code in emerge.log Reply with quote

Greetings Fellow Gentoo Users/Devs:

I've been running several gentoo systems for years. While I love it, the only drawback IMHO is the compile time required. I often find myself watching the progress of emerge.log, comparing the compile times to that of other systems, and trying to figure out when a new package (or an upgrade) will be fully cooked.

As anyone else who's done this knows, the time format is in raw, unformatted unix time (the number of seconds since midnight on 1-1-1970). Translating this to hours:minutes:seconds, or trying to figure out exactly what date/time the last compile was has always been a pain in the ass for me.

So....today, I wrote a nice little bash one-liner to format the time within /var/log/emerge.log and display it humanistically:

# while read 'line' ; do echo "`date -u -d "1970-1-1 ${line/:*/} sec"`:${line#*:}" ; done

So, this can be used with tail -f , if your watching your log in real-time.
Code:
# tail -f /var/log/emerge.log | while read 'line' ; do echo "`date -u -d "1970-1-1 ${line/:*/} sec"`:${line#*:}" ; done


Or, you could view an entire emerge.log within the less utility, for searching around for last compile date/time/lengths:

Code:
# cat /var/log/emerge.log | while read 'line' ; do echo "`date -u -d "1970-1-1 ${line/:*/} sec"`:${line#*:}" ; done | less


I hope somebody finds this useful.

Cheers,

Bryant
Back to top
View user's profile Send private message
Earthwings
Administrator
Administrator


Joined: 14 Apr 2003
Posts: 7753
Location: Karlsruhe, Germany

PostPosted: Wed Nov 08, 2006 2:00 pm    Post subject: Reply with quote

The last GWN discusses it as well: http://www.gentoo.org/news/en/gwn/20061030-newsletter.xml#doc_chap2
Moved from Portage & Programming to Documentation, Tips & Tricks
_________________
KDE 4.14 - Get It While It's Hot!
Back to top
View user's profile Send private message
bludger
Guru
Guru


Joined: 09 Apr 2003
Posts: 389

PostPosted: Thu Nov 16, 2006 1:10 pm    Post subject: Reply with quote

As mentioned in the newletter, you can just use genlop. Eg. "genlop -l".
Back to top
View user's profile Send private message
truc
Advocate
Advocate


Joined: 25 Jul 2005
Posts: 3199

PostPosted: Sat Nov 18, 2006 3:00 pm    Post subject: Reply with quote

you can even use qlop from portage-utils, it will translate the time for you, make an average time and so on..
_________________
The End of the Internet!
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum