Hysen Labs
Library / SDK
RudjiGames/rprof avatar
RudjiGames

rprof

CPU scope based profiling library and browser based profile inspector with ImGui visualization

100 stars9 forksCBSD-2-Clause
01
DEEP OPEN-SOURCE ANALYSIS

rprof: a scope based profiler that catches slow frames

A CPU profiling library built around a time threshold, with ImGui visualization and a browser based inspector for frames that run too long.

02
DEEP OPEN-SOURCE ANALYSIS

The core idea

rprof is a scope based CPU profiling library with ImGui visualization and a browser profile inspector. The core concept is a time threshold, which can be used to catch functions or entire frames that exceed a certain time value. The README says optimization work can then focus first on frames and functions that are only occasionally slow, and iterate toward more consistent performance. The library is written in C and released under a BSD style license.

03
DEEP OPEN-SOURCE ANALYSIS

How the threshold works

The profiler always runs when used, but it displays only those frames that exceed the given threshold. The default value of zero means every frame is displayed. The level value refers to hierarchical scope depth, where a value of zero represents an entire frame. This focuses attention on the slowest scopes rather than drowning in every measurement.

04
DEEP OPEN-SOURCE ANALYSIS

Building it

A GENie script can generate a Microsoft Visual Studio solution or makefiles for a GCC based compiler or cross compiler. Generating an MSVC solution is shown as a command example. All generated solutions and makefiles provide Debug, Release, and Retail configurations in both 32bit and 64bit versions, though some platforms support only one word size, such as OSX working with 64 bit builds only. Batch files in a scripts directory fetch dependencies for the demo and generate project files.

05
DEEP OPEN-SOURCE ANALYSIS

The browser inspector

Captured frame profiles can be saved to binary files for offline inspection. The browser based inspector is built using Emscripten and is based on ImGui, offering interactive zooming and panning as well as a statistical overview of the frame. The README says the viewer is browser based so it can be used as part of a QA pipeline during development.

07
DEEP OPEN-SOURCE ANALYSIS

Official sources

08
Community notes

Community notes