summaryrefslogtreecommitdiffstats
path: root/src/tools/rust-analyzer/crates/profile
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/rust-analyzer/crates/profile')
-rw-r--r--src/tools/rust-analyzer/crates/profile/Cargo.toml2
-rw-r--r--src/tools/rust-analyzer/crates/profile/src/memory_usage.rs6
2 files changed, 7 insertions, 1 deletions
diff --git a/src/tools/rust-analyzer/crates/profile/Cargo.toml b/src/tools/rust-analyzer/crates/profile/Cargo.toml
index 6273ea51d..602e74275 100644
--- a/src/tools/rust-analyzer/crates/profile/Cargo.toml
+++ b/src/tools/rust-analyzer/crates/profile/Cargo.toml
@@ -20,7 +20,7 @@ countme = { version = "3.0.1", features = ["enable"] }
jemalloc-ctl = { version = "0.5.0", package = "tikv-jemalloc-ctl", optional = true }
[target.'cfg(target_os = "linux")'.dependencies]
-perf-event = "0.4.7"
+perf-event = "=0.4.7"
[target.'cfg(windows)'.dependencies]
winapi = { version = "0.3.9", features = ["processthreadsapi", "psapi"] }
diff --git a/src/tools/rust-analyzer/crates/profile/src/memory_usage.rs b/src/tools/rust-analyzer/crates/profile/src/memory_usage.rs
index 8017f8657..f089c78e0 100644
--- a/src/tools/rust-analyzer/crates/profile/src/memory_usage.rs
+++ b/src/tools/rust-analyzer/crates/profile/src/memory_usage.rs
@@ -91,6 +91,12 @@ fn memusage_linux() -> MemoryUsage {
pub struct Bytes(isize);
impl Bytes {
+ pub fn new(bytes: isize) -> Bytes {
+ Bytes(bytes)
+ }
+}
+
+impl Bytes {
pub fn megabytes(self) -> isize {
self.0 / 1024 / 1024
}