---
name: "xrprof"
section: "1"
platform: "linux"
package: "xrprof"
version: "0.3.1-3+b1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/xrprof"
---

# xrprof(1)

profile R programs

## NAME

xrprof - profile R programs

## SYNOPSIS

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

## DESCRIPTION

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

## OPTIONS

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

- **-h**

  Print usage and exit.

- **-p** ***PID***

  Specify the pid of the target R program.

- **-F** ***FREQ***

  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).

- **-d** ***DURATION***

  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.

- **-o** ***FILE***

  Write output to *FILE* instead of standard output.

- **-m**

  Run in “mixed mode”, where samples are drawn from both the R-level and native C/C++ stacks and collated together.

## EXAMPLES

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
```

## EXIT STATUS

- **0**

  Successful program execution.

- **1**

  A fatal error ocurred during sampling.

## AUTHORS

**xrprof** was written by Aaron Jacobs.

## SEE ALSO

[**R**(1)](/R/1.md), [**Rscript**(1)](/Rscript/1.md)
