From 451edcc09866d43def7db88d5d9c139a96ead58e Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sat, 25 Jul 2020 10:35:45 +0200 Subject: Add rustc-perf to metrics --- crates/ra_prof/src/memory_usage.rs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'crates/ra_prof') diff --git a/crates/ra_prof/src/memory_usage.rs b/crates/ra_prof/src/memory_usage.rs index ee79ec3ee..745345fac 100644 --- a/crates/ra_prof/src/memory_usage.rs +++ b/crates/ra_prof/src/memory_usage.rs @@ -31,6 +31,12 @@ impl fmt::Display for MemoryUsage { #[derive(Default, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Copy)] pub struct Bytes(usize); +impl Bytes { + pub fn megabytes(self) -> usize { + self.0 / 1024 / 1024 + } +} + impl fmt::Display for Bytes { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { let bytes = self.0; -- cgit v1.2.3