DOKK / manpages / debian 12 / xrprof / xrprof.1.en
XRPROF(1) General Commands Manual XRPROF(1)

xrprof - profile R programs

xrprof [-h] [-m] [-F FREQ] [-d DURATION] [-o FILE] -p PID

A sampling profiler for R(1) programs. xrprof writes to standard output the Rprof.out format widely used by existing R-based tools.

Malformed arguments will fall back on the defaults, if possible.

Print usage and exit.
Specify the pid of the target R program.
Set the sampling frequency, in Hertz. The default is 1 Hz, i.e. one sample per second, and the maximum is 1000 Hz (though far fewer samples are usually required).
Set the duration for xrprof to take samples before exiting (provided the target program runs that long). The default is to last up to one hour.
Write output to FILE instead of standard output.
Run in “mixed mode”, where samples are drawn from both the R-level and native C/C++ stacks and collated together.

Sample from an existing R program for 5 seconds at a useful frequency:


$ xrprof -F 50 -d 5 -p `pidof R`

Start a new R program in the background and then start the profiler, writing samples to the file Rprof.out in the current directory:


$ Rscript myprogram.R &
$ xrprof -F 50 -p $! > Rprof.out

0
Successful program execution.
1
A fatal error ocurred during sampling.

xrprof was written by Aaron Jacobs.

R(1), Rscript(1)

2020-01-11