asomers / ztop

Display ZFS datasets' I/O in real time
BSD 2-Clause "Simplified" License
69 stars 7 forks source link

Benchmarks for the backend #16

Open asomers opened 3 years ago

asomers commented 3 years ago

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 https://github.com/asomers/ztop/issues/13#issuecomment-957069977

asomers commented 3 years ago

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.

guygastineau commented 3 years ago

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?