Ash Profiler
A downloadable profiler library for Windows
RAD game tools' Telemetry does not sell indie licenses, so during World Of Squares' development, I made a pretty rad profiler in just 1,000 lines including the drawing code (no unnecessary complexity!).
This is multi-threaded serializable profiler with a viewer to not lag the main process. Your purchase comes with a module and examples.
There is a simple profiling API, and a separate-process viewer that launches itself in just one function call draw_profile()
Copy "profiler_viewer.exe" next to your game's executable (or compile "modules/AshProfiler/profiler_viewer.jai" to its own exe). The exe must be named "profiler_viewer.exe".
#import "AshProfiler" in your project.
To draw the profile, simply call draw_profile() every frame, and it will automatically start the viewer by itself.
draw_profile :: (profile : *ProfileContainer = *GLOBAL_PROFILE, name : string = "profile")
draw_profile :: (serialized_profile : []u8, name : string = "imported profile")
To profile, you may use any of these functions
profile_block :: inline (); // Does procedure name
profile_block :: inline ($name : string);
profile_frame_boundary :: inline ($name : string = "Frame Boundary");
profile_marker :: inline ($name : string);
profile_begin :: inline ($name : string);
profile_section :: inline ($name : string, $debug_print := false);
profile_end :: inline ($name : string);
// profile_begin and profile_end are paired, give the same name like this:
// EntityUpdate :: "Entity update";
// profile_begin(EntityUpdate);
// ...
// profile_end(EntityUpdate);
If you want to send data over a server or something like I did in my MMO, you may use the serializer functions (they use the context's allocator)
profile_alloc_serial_export :: () -> []u8;
profile_alloc_serial_import :: (result : *ProfileContainer, data_ : *u8);
profile_free_from_import :: (container : ProfileContainer);
If you want to view multiple threads, use "initialize_thread_ordinal()" at the start of every thread (including after main :: ()) so the viewer can draw them separate. Otherwise, everything will be overlapped into "thread 0" in the viewer.
Report bugs to me at ashroodev@gmail.com or in the comments.
NOTE: The viewer only works in windows for one running at a time (you can add the shared memory API of your OS), but I did use this to profile an MMO server running on Linux, then serialize the data and send it to my client to draw the data.
This is only for the Jai programming language right now. I could a compatible version for C++ or C if people really want it.
Purchase
In order to download this profiler library you must purchase it at or above the minimum price of $3.99 USD. You will get access to the following files:
Leave a comment
Log in with itch.io to leave a comment.