From: Peter Dalgaard <p.dalgaard_at_biostat.ku.dk>

Date: Mon 26 Jul 2004 - 02:22:04 EST

Date: Mon 26 Jul 2004 - 02:22:04 EST

Kasper Daniel Hansen <k.hansen@biostat.ku.dk> writes:

> I have some trouble interpreting the output from profiling. I have

*> read the help pages Rprof, summaryRprof and consult the R extensions
**> manual, but I still have problems understanding the output.
**>
**> Basically the output consist of self.time and total.time. I have the
**> understanding that total.time is the time spent in a given function
**> including any subcalls or child functions or whatever the technical
**> term for that activity is. In contrasts self.time is the time spent in
**> the function excluding subcalls.
**>
**> Now, in my understanding basically everything in R is functions. I
**> would then guess that for almost any function (except the "atomic
**> ones") the self.time would be very small as it would spend most of its
**> time calling other functions (again, since almost everything is a
**> function). So how do R determine when a subfunction is called?
*

...brutal snippage...

> I guess some of the answers would be clear if I had a firm grasp of

*> the inner workings of R :)
*

In a word, yes...

The profiling keeps track of R's *context stack* which is not quite the same as function calls. Essentially, it only counts R functions that are actually written in R, but not .Internal, .Primitive, etc. So "self" counts the amount of time that a function was at the top of the stack. This is done by a periodic poll which dumps out the context stack at regular intervals. Seeing cases where the self percentages don't add to 100% is, I believe, simply due to truncation of the tails -- that is, there is a large number of different functions which each are counted a few times, and these are not shown in the summary output.

[Sorry about the late reply, but I was out of town, and noone seems to have answered this.]

-- O__ ---- Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk) FAX: (+45) 35327907 ______________________________________________ R-help@stat.math.ethz.ch mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.htmlReceived on Mon Jul 26 02:34:40 2004

*
This archive was generated by hypermail 2.1.8
: Fri 18 Mar 2005 - 02:38:00 EST
*