3个版本

使用旧Rust 2015

0.1.6 2017年11月2日
0.1.5 2017年9月13日
0.1.4 2017年7月17日

294性能分析 中排名

每月 23 次下载

Apache-2.0

7KB
83

一个插件,用于插入适当的 flame::start_guard(_) 调用(用于与 flame 一起使用)

Build Status Current Version Docs

这需要一个nightly rustc! 因为flamer是一个编译器插件,它使用不稳定API,这些API在稳定或beta版本中不可用。也许可以扩展flamer以允许与syntex一起使用,但这还没有尝试过。

用法

在你的Cargo.toml中将 flameflamer 添加到依赖中

[dependencies]
flame = "^0.1.9"
flamer = "^0.1.4"

然后在你的crate根目录下,添加以下内容

#![feature(plugin, custom_attribute)]
#![plugin(flamer)]

extern crate flame;

你也可以选择一个 可选依赖。在这种情况下,你的Cargo.toml应该有

[dependencies]
flame = { version = "^0.1.9", optional = true }
flamer = { version = "^0.1.4", optional = true }

[features]
default = []
flame_it = ["flame", "flamer"]

然后你的crate根目录应该包含

#![cfg_attr(feature="flame_it", feature(plugin, custom_attribute))]
#![cfg_attr(feature="flame_it", plugin(flamer))]

#[cfg(feature="flame_it")]
extern crate flame;

// as well as the following instead of `#[flame]`
#[cfg_attr(feature="flame_it", flame)];

然后你应该能够使用 #[flame] 注释来注释每个项目(甚至整个crate)。你也可以使用 #[noflame] 注释来禁用 #[flame] 项的子项的仪器化。请注意,这仅针对注释的方法进行仪器化,不会打印出结果。

有关输出工作方式,请参阅flame的文档。

许可证:Apache 2.0

无运行时依赖