3 stable releases
1.2.0 |
|
---|---|
1.1.0 |
|
1.0.4 | Jan 4, 2025 |
1.0.3 | Jan 3, 2025 |
#121 in Profiling
389 downloads per month
4KB
MacroTime
This crate implements macros that can be used to time arbitrary snippets of code. See the Rust docs to learn how to implement MacroTime
into your existing code.
Docs.rs
If you'd like to see more examples or learn more about MacroTime
, take a look at the documentation. All information listed there should be up to date and tested for the most recent version of the package.
lib.rs
:
MacroTime
MacroTime
is very easy to use. To time the execution of a block of code:
use macrotime::*;
let time = time!({
// do some stuff...
});
println!("This operation took {} ms!", time.as_millis());
You can also have MacroTime
print the time taken to perform a task on its own. To do this:
use macrotime::*;
dbg_time!({
// do some stuff...
});
In this scenario, the time will printed in the most relevant unit, so no need for formatting.