mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2024-11-24 12:34:31 +00:00
5622f12584
A simple stat collecting. Uses RAII to gather latency on all exit paths from function/block. The underscore in "let _u = STATS.u(...)" is to pacify "unused variable" warning. Using "let _ = " makes compiler optimize out the call. Rust makes it particularly hard to convert enums from integers, so I had to add a hack that stores Enum on every invocation of the STATS.u. Looking at disassembly, it added one move of constant to the field of STATS.entries; no heap operations or cloning. A clever alternative using macros was suggested by semenzato@, but I decided saving an instruction was not worth the complexity. The output is currently printed on the destruction of crosvm, so tests print out stats on exit. We probably should find a better place for it though. BUG=None TEST=cargo test --release --features plugin Change-Id: I78a8920e9896b717af3aaea14f8ed6013be6b94f Reviewed-on: https://chromium-review.googlesource.com/1036473 Commit-Ready: Slava Malyugin <slavamn@chromium.org> Tested-by: Slava Malyugin <slavamn@chromium.org> Reviewed-by: Zach Reizner <zachr@chromium.org> |
||
---|---|---|
.. | ||
src | ||
Cargo.toml | ||
crosvm.h |