Skip to content

Easy profiling disabling #31

@mfr-itr

Description

@mfr-itr

Since your lib requires modifications to the source code, it's not easy to disable it for a true release. I see two ways to fix this:

  • Add a compile time feature which prevents data collection. I'm thinking global const with a compile time value, and a if !STATIC_ENABLED { return } in every function. Since the condition is known at compile time, it should be inlined and removed by rustc.
  • Add a runtime switch, like flame::disable() for example. It could set an AtomicBool. It would be a bit slower but would allow the activation without recompiling. Now that I thing of it, it would be a very nice feature to have!

These two options could be implemented at the same time, like if !STATIC_ENABLED || !DYNAMIC_ENABLED ....

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions