The 2024 Wheel Reinvention Jam is in 16 days. September 23-29, 2024. More info

Profiler WIP

Here is a short video of a profiler I'm working on.

Edited by Simon Anciaux on Reason: Initial post
sweet !
Thanks.
Looks fantastic, couldn't expect anything less from you Simon! Is that a custom GUI library of yours?
Thanks. The GUI is custom code, but I wouldn't call it a library.
Awesome! If you're planning to make it publicly available at some point, do you expect you'll ever document the file format?

I find it frustrating that every profiler comes with its own application-side header/code/library and would be interested in a setup where a default is provided but the format is also documented so I can write my own. This would be useful if (for example) I'm using an unsupported language, have a different environment or requirements or have some existing profiling infrastructure in place in my code and I want to try out your profiler for visualisation.

I suppose it'd be similar to how people have started using chrome's performance visualisation tools for all sorts of things that are unrelated to chrome just because it has a simple data format and you can give it whatever data you want.

On the other hand maybe this is just me being lazy and not wanting to figure out the format of other tools from their application-side libraries/headers!
I'm not sure if or when I'll be releasing it. I would like to release it but I'm kind of afraid of having to provide support for it. We'll see.

The idea at first was to only return memory to the user so that they could write it to a file the way they wanted (there was only the header at that time, the GUI came later). But it was annoying having to write the "write to file" code when I wanted to quickly profile something, so I added a default write to file function in the header while still keeping the other method available. But yes, I will provide documentation for the "file format".

Note that the header file provides some functions to create the "event trees" out of the "event streams" and functions to iterate over them.
Here is a first version of the profiler header file and id generator. There is some documentation in the source. The header itself allow to record profile, create a text printout, write it to disk and create a profiler_tool_t to help you create visualization tools.

I tested it on Windows 7 (msvc, clang), Windows 10 (msvc) and linux Manjaro (clang, gcc). It's only for x64 processor.

If you try to use it, I would be interested on feedback about how easy/hard it was to incorporate in your codebase and if it was helpful or not. Any other feedback is also welcomed.

Here is a preview of the UI. It's only for Windows, and quite frankly not really ready for users (no configuration, panel don't interact correctly with each other, somewhat confusing UI...). It more intended to see if it runs at all on other's computer and to at least give one way to visualize a recorded profile. The top and left panel have some options if you press 'O' while the mouse is over them.

Let me know if it works at all for you.

Any feedback is welcomed.

Thanks