diff options
author | Slava Malyugin <slavamn@google.com> | 2018-04-30 15:39:26 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2018-05-04 03:02:39 -0700 |
commit | 5622f125847cc4c478020897cf7c9d5a45e185eb (patch) | |
tree | 4ad9d9413b9a22c030cfb7dc6b4423d7cfaa835a /devices/src/virtio/block.rs | |
parent | b749af91fee341af25b643df4b54e91c96f91c53 (diff) | |
download | crosvm-5622f125847cc4c478020897cf7c9d5a45e185eb.tar crosvm-5622f125847cc4c478020897cf7c9d5a45e185eb.tar.gz crosvm-5622f125847cc4c478020897cf7c9d5a45e185eb.tar.bz2 crosvm-5622f125847cc4c478020897cf7c9d5a45e185eb.tar.lz crosvm-5622f125847cc4c478020897cf7c9d5a45e185eb.tar.xz crosvm-5622f125847cc4c478020897cf7c9d5a45e185eb.tar.zst crosvm-5622f125847cc4c478020897cf7c9d5a45e185eb.zip |
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>
Diffstat (limited to 'devices/src/virtio/block.rs')
0 files changed, 0 insertions, 0 deletions