Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
How to Measure Elapsed Time for System Operations?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
Bob P
Advocate
Advocate


Joined: 20 Oct 2004
Posts: 3355
Location: Jackass! Development Labs

PostPosted: Wed Jan 05, 2005 5:13 pm    Post subject: How to Measure Elapsed Time for System Operations? Reply with quote

I'm going to fly the n00b flag for a minute and ask a silly question -- what's the best way to measure the elapsed time that it takes for perform a job?

I've tried simple methods, but some of them will either choke or cause problems with running processes. In this circumstance, i'd like to accurately measure how much time it takes to complete an "emerge-e world" without interfering with the process.

TIA.
_________________
.
Stage 1/3 | Jackass! | Rockhopper! | Thanks | Google Sucks
Back to top
View user's profile Send private message
timmfin
Guru
Guru


Joined: 04 Sep 2002
Posts: 336
Location: Maryland, USA

PostPosted: Wed Jan 05, 2005 5:29 pm    Post subject: Reply with quote

The time command? From the time manpage

Code:

The  time  command  runs  the  specified program command with the given arguments.  When command finishes, time writes a  message  to  standard output  giving timing statistics about this program run.  These statistics consist of (i) the elapsed real time between invocation and termination, (ii) the user CPU time (the sum of the tms_utime and tms_cutime values in a struct tms as returned by times(2)), and (iii)  the  system CPU  time  (the  sum of the ms_stime and tms_cstime values in a structtms as returned by times(2)).
Back to top
View user's profile Send private message
Bob P
Advocate
Advocate


Joined: 20 Oct 2004
Posts: 3355
Location: Jackass! Development Labs

PostPosted: Wed Jan 05, 2005 8:12 pm    Post subject: Reply with quote

yeah. i've tried using time, but emerge -e system doesn't fare well when executed under time. i've had it crash under time, where it works just fine without time.

times... maybe i need to try that. i could emerge -e system from a fresh shell and use times after the fact.
_________________
.
Stage 1/3 | Jackass! | Rockhopper! | Thanks | Google Sucks
Back to top
View user's profile Send private message
Leffe
Tux's lil' helper
Tux's lil' helper


Joined: 07 Apr 2004
Posts: 145
Location: Sweden

PostPosted: Wed Jan 05, 2005 8:53 pm    Post subject: Reply with quote

Just check the log (/var/log/emerge.log) if time doesn't work :)

Hmm, times are stored using timestamps :/
Back to top
View user's profile Send private message
slam_head
Guru
Guru


Joined: 06 Jan 2003
Posts: 449
Location: New York City

PostPosted: Wed Jan 05, 2005 8:59 pm    Post subject: Reply with quote

this might not be the most ellegant solution, but it should give you a good idea.
Code:
date;emerge -e system;date
Back to top
View user's profile Send private message
Bob P
Advocate
Advocate


Joined: 20 Oct 2004
Posts: 3355
Location: Jackass! Development Labs

PostPosted: Wed Jan 05, 2005 10:49 pm    Post subject: Reply with quote

Leffe wrote:
Hmm, times are stored using timestamps :/

yeah, they're a PITA. i was hoping for a method that would just give me the elapsed time, so i wouldn't have to do date arithmetic. i'd really like to avoid using the log timestamps if i can get away with it.

maybe that idea of stacking a "date" command after "emerge -e system" isn't such a bad idea. it will write the date/time to screen as soon as the emerge finishes, and i won't miss anything if i'm not there to see it happen.
_________________
.
Stage 1/3 | Jackass! | Rockhopper! | Thanks | Google Sucks
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo 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