aclysma / profiling

Provides a very thin abstraction over instrumented profiling crates like puffin, optick, tracy, and superluminal-perf.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Allow manual management of scope guards

Imberflur opened this issue · comments

In some cases it's useful to be able to manually drop the scope guards. For instance, if you want to profile a portion of a function without adding additional indentation. Another case is having scopes that cover portions of time where control is passed back to winit.

I think this is a helpful thing to be able to do if we can find a simple solution that supports all backends and potentially multiple guard objects being involved. I want to stay sensitive to the fact that some people aren't going to want to take this crate as a dependency unless it stays small and simple, and I think some of the value this crate could provide is that it is small enough that some upstream crates might be more willing to add profiling instrumentation that we as downstream users can benefit from. Also, since end-users can interface directly with their profiling crate of choice I think it takes a little pressure off this library needing to support every case. Again though, if we find a clean and simple way to do it that supports every backend, I'm in favor of adding the feature. :)

That makes sense to me 👍. This could always be in a separate crate for those that want more precise control in exchange for more complexity. I might try to whip a PR to see what it would look like, but I wouldn't have any issues if it ultimately is left out.

Will close for now, but happy to look if you have more ideas on how to do it! :)