[R] Profiling a C/C++ library from R

Charles Novaes de Santana charles.santana at gmail.com
Sat Dec 6 00:20:50 CET 2014


Thank you very much for the tips, Martin and Duncan! Rprof and operf are
helping me a lot!!

Also, I am now in R-dev maillist and I see there seems to be more
appropriate to this kind of question.

Best,

Charles

On Wed, Dec 3, 2014 at 12:03 AM, Duncan Murdoch <murdoch.duncan em gmail.com>
wrote:

> On 02/12/2014, 4:43 PM, Charles Novaes de Santana wrote:
> > Dear all,
> >
> > I am running a c++ library (a .so file) from a R code. I am using the
> > function dyn.load("lib.so") to load the library. Do you know a way to
> > profile my C library from R? Or should I compile my C library as an
> > executable and profile it using the typical C-profilers?
> >
> > Thanks in advance for any help!
>
> If you want line-level profiling of your C++ code, you'll certainly need
> to use something that's not built in to R.  You can probably do it
> without recompiling your C++ code, just by profiling the R process.  But
> the details certainly depend on the profiler you choose to use.
>
> If you just want to know how much time is being spent in each C++
> function called from R, Rprof() should be able to tell you.  (It might
> give misleading information if your C++ code takes too long to execute,
> and some timer ticks get lost; I'm not sure if the underlying code takes
> account of that.)
>
> Duncan Murdoch
>



-- 
Um axé! :)

--
Charles Novaes de Santana, PhD
http://www.imedea.uib-csic.es/~charles

	[[alternative HTML version deleted]]



More information about the R-help mailing list