Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Profiling/Tracing library for riker #134

Open
hardliner66 opened this issue Sep 8, 2020 · 4 comments
Open

Profiling/Tracing library for riker #134

hardliner66 opened this issue Sep 8, 2020 · 4 comments

Comments

@hardliner66
Copy link
Contributor

After doing some basic performance testing with hyperfine, I wanted to get a deeper understanding of the performance characteristics of riker.

So I integrated two tracing/profiling libraries. optick-rs and tracing.

I prepared three branches, but wanted to get community feedback before I create a pull request.

Optick

Riker + Optick

Optick is a profiler written for games, which just got it's rust bindings a few months ago.
After annotating all functions with the proc-macro for optick (you can create spans manually if you like), you only need to specify where the logs should go and optick creates a file with all the profiling data inside, which can than be inspected with the Optick profiler gui.

Pros:

  • Ease of use
  • Easy to integrate (thanks to the proc macro)
  • Uses a file (tracing can be used on a server)

Cons:

  • The rust version currently only supports windows (linux and macos support in progress)
  • You can't just plug another profiler

Tracing

Riker + Tracing

Tracing on the other hand, is an instrumentation framework for which it's possible to write a custom Subscriber, in order to use whatever profiler you want.

Pros:

  • Flexible (it's possible to plug your own profiler)
  • Easy to integrate (thanks to the proc macro)
  • Can generate text/json trace files out of the box

Cons:

  • No gui
  • You need to tell the proc macro to skip function arguments which can't automatically be logged
  • You have to plug your own profiler

Both

Riker + Tracing + Optick

Adds both to riker, with optick as the default.

Pros:

  • Defaults to a profiler which already provides a gui
  • All of the pros above, depending on the feature you pick

Cons:

  • It's a bit harder to annotate functions, because you need to do the annotation for both libraries

Final thoughts

I currently am in favor of the last variant, wich includes the tracing library and a specific profiling library. This way all contributors would have a standard profiler to use, but everyone can plug their own profilere if the profiler we chose doesn't fit their needs.

I picked Optick as the default profiler because it was easy to integrate, provides a nice gui und is built for use in games (or similar applications where performance matters), but I'm open for other profilers to use as a default.

@hardliner66 hardliner66 changed the title Tracing in riker Profiling/Tracing library for riker Sep 8, 2020
@olexiyb
Copy link
Contributor

olexiyb commented Sep 9, 2020

@hardliner66
Have you tried to use native tools like callgrind that is a tool of valgrind
There is a GUI
This tool does not need to change the code, just need some compiler options to add debug information.

@hardliner66
Copy link
Contributor Author

@olexiyb Valgrind is linux only. And an integrated profiling/tracing library can provide addtional information on top of a call-graph.

@leenozara
Copy link
Contributor

@hardliner66 I'll take a look at your suggestions and provide feedback - I've been unavailable for the past couple of weeks - hopefully this week.

Thanks!

@nothingismagick
Copy link
Contributor

nothingismagick commented Nov 30, 2020

I like the idea of the third version (profiling && tracing), but since this issue was opened it still seems (superficially at least) that optick does not yet support OSX and linux:

image

Edit: checked the rs repo and still no public availability on MacOS / Linux :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants