Skip to content

total CPU time in Matlab - what is the equivalent in R?

4 messages · Gopi Goteti, Jeff Newmiller, William Dunlap +1 more

#
Google is your friend

http://www.ats.ucla.edu/stat/r/faq/timing_code.htm

http://r.research.att.com/benchmarks/
---------------------------------------------------------------------------
Jeff Newmiller                        The     .....       .....  Go Live...
DCN:<jdnewmil at dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live Go...
                                      Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
/Software/Embedded Controllers)               .OO#.       .OO#.  rocks...1k
--------------------------------------------------------------------------- 
Sent from my phone. Please excuse my brevity.
Gopi Goteti <gopi.goteti at gmail.com> wrote:

            
#
I didn't notice a discussion of what system or user time meant in
those two articles.  (The first correctly says that system.time() is
a more convenient way to time things, as it calls proc.time() before
and after your expression and subtracts.  It also does garbage
collection before the timing, so you get more consistent results.)

CPU time is essentially user time plus system time.   User time is time spent
in R itself.  System time is time spent by the kernel of the operating
system doing things that R asked it to do (e.g., finding a file, reading
a file, perhaps getting the time).  What is considered system time
depends on your operating system.  There is some time spent switching
between user and kernel mode and I don't know who gets charged for
that time.  Elapsed time is usually what counts in the end.

Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com
#
Maybe the unix time command comes in handy (provided you work with linux)?
http://en.wikipedia.org/wiki/Time_(Unix)
Best
Jan


-----Urspr?ngliche Nachricht-----
Von: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] Im Auftrag von William Dunlap
Gesendet: Montag, 27. August 2012 16:38
An: Jeff Newmiller; Gopi Goteti; r-help at r-project.org
Betreff: Re: [R] total CPU time in Matlab - what is the equivalent in R?

I didn't notice a discussion of what system or user time meant in those two articles.  (The first correctly says that system.time() is a more convenient way to time things, as it calls proc.time() before and after your expression and subtracts.  It also does garbage collection before the timing, so you get more consistent results.)

CPU time is essentially user time plus system time.   User time is time spent
in R itself.  System time is time spent by the kernel of the operating system doing things that R asked it to do (e.g., finding a file, reading a file, perhaps getting the time).  What is considered system time depends on your operating system.  There is some time spent switching between user and kernel mode and I don't know who gets charged for that time.  Elapsed time is usually what counts in the end.

Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com
______________________________________________
R-help at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.