# rprof: a C profiler that only shows you the frames that ran long

> rprof is a C library for CPU profiling built around one idea: set a time threshold and a scope level, and only frames that cross that line are ever displayed. It pairs an ImGui overlay with a browser based inspector built through Emscripten, and it is generated into Visual Studio or GCC projects by GENie. Useful for engine code where occasional stalls matter more than averages.

**RudjiGames/rprof** — CPU scope based profiling library and browser based profile inspector with ImGui visualization

- Repository: https://github.com/RudjiGames/rprof
- Stars: 102 · Forks: 9
- Language: C
- License: BSD-2-Clause
- Published: 2026-08-17 · Updated: 2026-08-18 · Language: en
- Canonical page: https://hysenlabs.com/projects/rudjigames-rprof

## One threshold decides which frames ever reach the screen

The design hangs off two numbers. The first is a time threshold: a frame or a function that stays under it is not displayed at all. The second is the level, which names a depth in the hierarchical scope tree, where a level of 0 means an entire frame. Set the threshold to 0 and every frame is displayed, which is the default and also the way to get an unfiltered picture before deciding what a slow frame is worth to you. The profiler runs continuously once enabled. Filtering happens at display time rather than at capture time, so nothing is discarded that you might want after lowering the threshold. That split is what makes the setting cheap to retune mid session instead of something you have to commit to before a capture.

## Scoping the occasional stall rather than the average

The stated purpose of the threshold is to catch functions or entire frames that exceed a given time value, so optimization can start with the ones that are only occasionally slow and then move towards more consistent performance. That makes rprof a tool for outliers rather than for averages: a frame that is fine most of the time and blows the budget once a second is exactly the case it is built to surface, and a uniformly slow frame is the case you would find without any profiler. The trade-off is that the same threshold applies everywhere a scope is opened, so a fast frame containing one slow function will not appear at level 0 until that frame crosses the line as a whole. The README does not document any statistical aggregation, percentiles or per call counters, so read the output as a spike finder rather than a distribution analyser.

## GENie writes the project files, so the clone is step one

There is no packaged build and no package manager step. The source is fetched from GitHub with a plain clone, which is the only setup instruction given:

```bash
git clone https://github.com/RudjiGames/rprof.git
```

The top level of the tree carries a `makefile` but no Visual Studio solution, which is why project generation is a step you run yourself. The GENie script from the bkaradzic repository writes either a Microsoft Visual Studio solution or makefiles for a GCC based compiler or cross compiler, so the same source tree produces a Windows solution, a native makefile or a console cross compile without editing the library.

## Toolchain chosen by flag, output parked under .build

One command generates the Visual Studio solution, and GENie drops it in a predictable folder rather than next to the sources:

```bash
genie vs2022
```

The result sits in `.build/projects/vs2022`. For a GCC toolchain the same script is given a compiler flag, which is how the two named targets are produced:

```bash
OSX   :   genie --gcc=oxc gmake
PS4   :   genie --gcc=ps4 gmake
```

Those makefiles land in `.build/projects/gmake/$(GCC_TOOLCHAIN)`, so the OSX and PS4 outputs are kept apart by toolchain name instead of overwriting each other. Any compiler GENie knows about can be requested the same way, which is what makes the cross compiler case work without a second build script.

## Debug, Release and Retail in 32 and 64 bit

Every generated solution and makefile set offers three configurations, Debug, Release and Retail, in both 32 bit and 64 bit variants, picked at build time with a config argument rather than a separate target:

```bash
Debug, 32bit   :  make -R config=debug32
Release, 64bit :  make -R config=release64
```

Word size support is not uniform across platforms, and one case is named explicitly: OSX is 64 bit only, so a 32 bit configuration for that toolchain is not a supported combination. Because the configuration name is spelled out in the make invocation, a build matrix across word sizes and optimisation levels is a matter of looping the same command, not of editing project files.

## Captured frames leave the process as binary files

The in application view is not the only output. Captured frame profiles can be saved to binary files for offline inspection, so the analysis happens without the profiled program running. The inspector for those files is built with Emscripten, with a makefile included for convenience, and it renders through ImGui with zooming, panning and a statistical overview of the frame. Being browser based is a deliberate choice: the file can be handed to someone in a QA pipeline who does not have the game build or the toolchain installed. A live demo loads a capture file named `capture.rprofm` from the project's own site, which is the fastest way to see what the inspector puts on screen before wiring it to your own captures.

## Submodules, one sample and a Windows flavoured helper script

The layout is a plain C library tree: `src/` and `inc/` for code and headers, `3rd/` with a `.gitmodules` file for third-party code, `tools/` for tooling, `img/` for images, and a `makefile` at the root. There is a single sample, `samples/01_demo/`, and a `scripts/` directory whose batch files fetch the demo's dependencies and generate the project files. Those helpers are batch files, so on any shell other than Windows the two steps are manual: pull the submodules, then run GENie. A `.appveyor.yml` at the root, matching the AppVeyor badge in the README, points at continuous integration on that service, and `.editorconfig` and `.gitattributes` are present for formatting and line ending control. Licence is BSD 2-clause, copyright 2025 Milos Tosic, which covers redistribution in source and binary form provided the notice and disclaimer travel with it.

## Conclusion

rprof earns a look if you are chasing occasional slow frames in C or C++ engine code and want the profiler to stay quiet until a frame crosses a threshold you chose, and if you are willing to drive the build through GENie yourself. It is a poor fit for continuous statistical profiling, since no percentile or aggregate reporting is described, and the sample project leans on batch files in scripts/ to fetch its dependencies. Before adopting it, confirm that a GENie target exists for your compiler, that one of the 32 bit or 64 bit configurations fits your platform, and whether the BSD 2-clause terms cover the third-party code under 3rd/. The repository has no GitHub releases, so pinning means tracking master, where the last push was on 2026-05-31.

## FAQ

### What does rprof profile and how does it filter results?

rprof is a CPU scope based profiling library. A time threshold decides what gets displayed, a level value selects a depth in the hierarchical scope tree where 0 is a whole frame, and a threshold of 0 displays every frame.

### How do I build rprof from source?

Clone it with git clone https://github.com/RudjiGames/rprof.git, then run genie vs2022 for a Visual Studio solution or genie --gcc=oxc gmake and genie --gcc=ps4 gmake for GCC makefiles. Generated project files land under .build/projects.

### Which build configurations does rprof provide?

Every generated solution and makefile set offers Debug, Release and Retail configurations in 32 bit and 64 bit, selected with make -R config=debug32 or make -R config=release64. Some platforms support only one word size, and OSX is 64 bit only.

### What is the browser based inspector in rprof?

It is an ImGui viewer built with Emscripten for inspecting captured frame profiles saved to binary files, offering zooming, panning and a statistical overview of the frame. It runs in a browser so it can sit inside a QA pipeline.

### What licence is rprof released under?

rprof is under the BSD 2-clause licence, copyright 2025 Milos Tosic. Redistribution in source and binary form is permitted provided the copyright notice, the conditions and the disclaimer are retained.

## Sources

- [Official README](https://github.com/RudjiGames/rprof#readme)
- [Project repository](https://github.com/RudjiGames/rprof)
- [README](https://github.com/RudjiGames/rprof/blob/master/README.md)
- [Releases](https://github.com/RudjiGames/rprof/releases)

---

Hysen Labs editorial analysis, written from the project's own repository and release notes. Cite the canonical page: https://hysenlabs.com/projects/rudjigames-rprof
