Re: [R] how to obtain the CPU time of my program

From: Christian Kohler <Christian.Kohler_at_klinik.uni-regensburg.de>
Date: Wed, 12 Dec 2007 12:31:51 +0100

Hi,

first of all 'sorry' for my rather late post on this topic...

Did you already came across the R command 'Rprof' ? This might help you to find answers to your problem in terms of CPU time/command. I use 'Rprof' like this:

>Rprof()
>source("yourCode.R")
>Rprof(NULL)

This produces a file called Rprof.out in your working directory. Quit R and type 'R CMD Rprof Rprof.out'.

I am too new in using those profiling methods of R but I think they are pretty handy.

Try out ?Rprof for detailed information.

Cheers,
Christian

gang xu wrote:
> Dear R users and experts,
>
> I am current running a program (a series of commands) in R. such as:
>
> A <- as.matrix(read.table("C:/LP.txt"));
>
> a=which(memb==q); b=a; B=as.matrix(A[a,b])
>
> LS=sum(B)/2;
>
> TL=sum(A)/2
>
> i<-c(1:NN);
>
> D=sum(A[a,i]);
>
> how can i obtain the CPU time used for these commands ?
>
> I have seen the system.time function but i am not sure how to use it. Could anyone help me ?
>
> ****** If we have a number of commands, how can we know the CPU for these commands *******
>
>
> Thanks a lot for your time and help
>
> Have a nice day!
>
> Warm Regards
>
> Marshall
>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> 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.
>

-- 

Christian Kohler
Institute of Functional Genomics
Computational Diagnostics
University of Regensburg (BioPark I)
D-93147 Regensburg (Germany)

Tel. +49 941 943 5055
Fax  +49 941 943 5020
christian.kohler_at_klinik.uni-regensburg.de

______________________________________________
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.
Received on Wed 12 Dec 2007 - 11:36:39 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 12 Dec 2007 - 12:30:18 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.