crosvm/crosvm_plugin
Slava Malyugin 5622f12584 plugin: measure max/avg latencies of all plugin API
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>
2018-05-04 03:02:39 -07:00
..
src plugin: measure max/avg latencies of all plugin API 2018-05-04 03:02:39 -07:00
Cargo.toml plugin: allow retrieving and setting VM and VCPU states 2018-03-30 00:07:07 -07:00
crosvm.h plugin: allow retrieving and setting VM and VCPU states 2018-03-30 00:07:07 -07:00