[Rd] profiling C code

Prof Brian Ripley ripley at stats.ox.ac.uk
Wed Feb 22 12:56:45 CET 2006


On Wed, 22 Feb 2006, Torsten Hothorn wrote:

>
>>
>> If you are running Linux, Torsten's suggestion of oprofile is a good one,
>> provided you have root access (it seems to need it).  So I used in a root
>> terminal (running the same example in another window in the middle)
>>
>> % opcontrol --no-vmlinux
>> % opcontrol --start
>> .... run things ...
>
> opcontrol --dump
>
> doesn't require root privileges on my system and

Yes, true, but not much use unless you can start a daemon.

>> % opreport -l /users/ripley/R/R-devel/bin/exec/R
>> % opreport -l /users/ripley/R/R-devel/library/stats/libs/stats.so
>
> should be allowed for `normal users', too.

Interesting.  It seems to be allowed unless the daemon is running and has 
undumped data on the file.  So the advice seems to need to be to dump and 
then run opreport.

>> ...
>> (No unit mask) count 100000
>> samples  %        symbol name
>> 6        31.5789  bvalue_
>> 4        21.0526  bsplvb_
>> 3        15.7895  bsplvd_
>> 2        10.5263  sbart_
>> 2        10.5263  sslvrg_
>> 1         5.2632  anonymous symbol from section .plt
>> 1         5.2632  stxwx_
>> % opannotate -s /users/ripley/R/R-devel/library/stats/libs/stats.so
>> [Problem, root cannot read my source files]
>
> for me, opannotate did not ask about running as `root'.

The issue is that that my source files are on a private file server to 
which the root account has no access.  That should be common for any 
secure system with remote-mounted file systems.  However, once I dump the 
data I can run opannotate as a normal user.

>
>> % opcontrol --shutdown
>>
>> If there is a way to use this without root access I would like to know it,
>> as only a few very privileged users get that here, and I am not going to
>> open up root access to my private file server.
>
> root needs to start the daemon via
>
> opcontrol --start-daemon
>
> and normal users can dump the output. But I don't know how a normal user
> would clean up and start new.

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-devel mailing list