asomers/ztop

Benchmarks for the backend

Opened this issue · 2 comments

I spent a little time this evening to explore benchmarks for the backend, but this being a binary only crate I cannot figure out how to call any code from the linux module outside of the binary crate itself :/

Originally posted by @guygastineau in #13 (comment)

One option is to create a #[bench] function within a #[cfg(test)] module directly within the binary itself. There's no rule that benchmarks must live in a "benches" directory.

I did try that (after adding the appropriate feature flag to the crate root), but there were some strange errors. The bench functions didn't have access to the code in my module. I'll have to try again. I think I put the bench functions in the test module. Should the be in the top level of the module where they want to access definitions?