From ripley at stats.ox.ac.uk  Wed Feb 22 12:56:45 2006
From: ripley at stats.ox.ac.uk (Prof Brian Ripley)
Date: Wed, 22 Feb 2006 11:56:45 +0000 (GMT)
Subject: [Rd] profiling C code
In-Reply-To: <Pine.LNX.4.64.0602221135290.23956@artemis.imbe.med.uni-erlangen.de>
References: <39B6DDB9048D0F4DAD42CB26AAFF0AFAFED82C@usctmx1106.merck.com>
	<Pine.LNX.4.64.0602210720001.30643@gannet.stats.ox.ac.uk>
	<Pine.LNX.4.64.0602211551440.11480@gannet.stats.ox.ac.uk>
	<Pine.LNX.4.64.0602221135290.23956@artemis.imbe.med.uni-erlangen.de>
Message-ID: <Pine.LNX.4.64.0602221130020.28960@gannet.stats.ox.ac.uk>

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



[Rd] profiling C code
Prof Brian Ripley