Created
November 21, 2019 15:24
-
-
Save justinas/31c7aa1265098a3fcdfee7def69bc4ee to your computer and use it in GitHub Desktop.
Conditionally apply funtime::timed
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[package] | |
name = "sandbox" | |
version = "0.1.0" | |
authors = ["User Name <foo@bar>"] | |
edition = "2018" | |
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | |
[features] | |
profiling = ["funtime"] | |
[dependencies] | |
funtime = { version = "0.3", optional = true } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[cfg_attr(feature = "profiling", funtime::timed)] | |
fn foo() { | |
std::thread::sleep(std::time::Duration::new(1, 0)); | |
} | |
fn main() { | |
foo(); | |
} |
Author
justinas
commented
Nov 21, 2019
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment