diff --git a/Cargo.lock b/Cargo.lock index 30a3dbfd68..ad605e18ae 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -25,7 +25,6 @@ dependencies = [ "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 1.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "procfs 0.7.8 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", "rand_xorshift 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "scoped_threadpool 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1286,11 +1285,6 @@ dependencies = [ "libc 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "hex" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "histogram" version = "0.6.9" @@ -1623,17 +1617,6 @@ name = "libc" version = "0.2.68" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "libflate" -version = "0.1.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "adler32 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "crc32fast 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rle-decode-fast 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "take_mut 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "libloading" version = "0.5.2" @@ -2308,20 +2291,6 @@ dependencies = [ "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "procfs" -version = "0.7.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "chrono 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", - "hex 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)", - "libflate 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "quick-xml" version = "0.18.1" @@ -2614,11 +2583,6 @@ dependencies = [ "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "rle-decode-fast" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "robust" version = "0.1.2" @@ -3108,11 +3072,6 @@ dependencies = [ "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "take_mut" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "tempfile" version = "3.1.0" @@ -3974,7 +3933,6 @@ dependencies = [ "checksum hashbrown 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8e6073d0ca812575946eb5f35ff68dbe519907b25c42530389ff946dc84c6ead" "checksum heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205" "checksum hermit-abi 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "725cf19794cf90aa94e65050cb4191ff5d8fa87a498383774c47b332e3af952e" -"checksum hex 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "644f9158b2f133fd50f5fb3242878846d9eb792e445c893805ff0e3824006e35" "checksum histogram 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)" = "12cb882ccb290b8646e554b157ab0b71e64e8d5bef775cd66b6531e52d302669" "checksum html2runes 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3c63600dd0709cc75da234e89e48f096c249f8197276f0a7ad6437ff49297559" "checksum html5ever 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d60508177ec4e5774a112efcf4d4d5f123cb00a43476fa5940b7da568371a165" @@ -4009,7 +3967,6 @@ dependencies = [ "checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" "checksum lazycell 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b294d6fa9ee409a054354afc4352b0b9ef7ca222c69b8812cbea9e7d2bf3783f" "checksum libc 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)" = "dea0c0405123bba743ee3f91f49b1c7cfb684eef0da0a50110f758ccf24cdff0" -"checksum libflate 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)" = "d9135df43b1f5d0e333385cb6e7897ecd1a43d7d11b91ac003f4d2c2d2401fdd" "checksum libloading 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f2b111a074963af1d37a139918ac6d49ad1d0d5e47f72fd55388619691a7d753" "checksum libm 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "7fc7aa29613bd6a620df431842069224d8bc9011086b1db4c0e0cd47fa03ec9a" "checksum libm 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c7d73b3f436185384286bd8098d17ec07c9a7d2388a6599f824d8502b529702a" @@ -4091,7 +4048,6 @@ dependencies = [ "checksum proc-macro-nested 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "eba180dafb9038b050a4c280019bbedf9f2467b61e5d892dcad585bb57aadc5a" "checksum proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)" = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759" "checksum proc-macro2 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)" = "df246d292ff63439fea9bc8c0a270bed0e390d5ebd4db4ba15aba81111b5abe3" -"checksum procfs 0.7.8 (registry+https://github.com/rust-lang/crates.io-index)" = "fe50036aa1b71e553a4a0c48ab7baabf8aa8c7a5a61aae06bf38c2eab7430475" "checksum quick-xml 0.18.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3cc440ee4802a86e357165021e3e255a9143724da31db1e2ea540214c96a0f82" "checksum quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a" "checksum quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)" = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1" @@ -4123,7 +4079,6 @@ dependencies = [ "checksum remove_dir_all 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4a83fa3702a688b9359eccba92d153ac33fd2e8462f9e0e3fdf155239ea7792e" "checksum reqwest 0.10.6 (registry+https://github.com/rust-lang/crates.io-index)" = "3b82c9238b305f26f53443e3a4bc8528d64b8d0bee408ec949eb7bf5635ec680" "checksum ring 0.16.12 (registry+https://github.com/rust-lang/crates.io-index)" = "1ba5a8ec64ee89a76c98c549af81ff14813df09c3e6dc4766c3856da48597a0c" -"checksum rle-decode-fast 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cabe4fa914dec5870285fa7f71f602645da47c486e68486d2b4ceb4a343e90ac" "checksum robust 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "222155e5550abd9100afdcdefbd08aa1b856d226b60e327044ec21b1ece2f78e" "checksum roxmltree 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "17dfc6c39f846bfc7d2ec442ad12055d79608d501380789b965d22f9354451f2" "checksum rstar 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0650eaaa56cbd1726fd671150fce8ac6ed9d9a25d1624430d7ee9d196052f6b6" @@ -4180,7 +4135,6 @@ dependencies = [ "checksum syn 1.0.17 (registry+https://github.com/rust-lang/crates.io-index)" = "0df0eb663f387145cab623dea85b09c2c5b4b0aef44e945d928e682fce71bb03" "checksum synom 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a393066ed9010ebaed60b9eafa373d4b1baac186dd7e008555b0f702b51945b6" "checksum synstructure 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)" = "67656ea1dc1b41b1451851562ea232ec2e5a80242139f7e679ceccfb5d61f545" -"checksum take_mut 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f764005d11ee5f36500a149ace24e00e3da98b0158b3e2d53a7495660d3f4d60" "checksum tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9" "checksum tendril 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "4ce04c250d202db8004921e3d3bc95eaa4f2126c6937a428ae39d12d0e38df62" "checksum term 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "fa63644f74ce96fbeb9b794f66aff2a52d601cbd5e80f4b97123e3899f4570f1" diff --git a/abstutil/Cargo.toml b/abstutil/Cargo.toml index e65eb52113..7b725f3222 100644 --- a/abstutil/Cargo.toml +++ b/abstutil/Cargo.toml @@ -21,9 +21,6 @@ scoped_threadpool = "0.1.9" serde = "1.0.110" serde_json = "1.0.40" -[target.'cfg(target_os = "linux")'.dependencies] -procfs = "0.7.8" - [target.'cfg(unix)'.dependencies] termion = "1.5.1" diff --git a/abstutil/src/lib.rs b/abstutil/src/lib.rs index 7190d6e02c..ebcfa2690d 100644 --- a/abstutil/src/lib.rs +++ b/abstutil/src/lib.rs @@ -18,8 +18,8 @@ pub use crate::io::{ }; pub use crate::random::{fork_rng, WeightedUsizeChoice}; pub use crate::time::{ - elapsed_seconds, prettyprint_usize, start_profiler, stop_profiler, MeasureMemory, Parallelism, - Profiler, Timer, TimerSink, + elapsed_seconds, prettyprint_usize, start_profiler, stop_profiler, Parallelism, Profiler, + Timer, TimerSink, }; use std::collections::BTreeSet; use std::fmt::Write; diff --git a/abstutil/src/time.rs b/abstutil/src/time.rs index 2b267af2cc..0d4330bee3 100644 --- a/abstutil/src/time.rs +++ b/abstutil/src/time.rs @@ -578,47 +578,6 @@ pub fn prettyprint_time(seconds: f64) -> String { format!("{:.4}s", seconds) } -// TODO This is an awful way to measure memory usage, but I can't find anything else that works. -pub struct MeasureMemory { - before_mb: usize, -} - -impl MeasureMemory { - pub fn new() -> MeasureMemory { - MeasureMemory { - before_mb: process_used_memory_mb(), - } - } - - pub fn reset(&mut self, section: &str, timer: &mut Timer) { - let now_mb = process_used_memory_mb(); - if now_mb >= self.before_mb { - timer.note(format!( - "{} cost ~{} MB", - section, - prettyprint_usize(now_mb - self.before_mb) - )); - } else { - timer.note(format!( - "WEIRD! {} freed up ~{} MB", - section, - prettyprint_usize(self.before_mb - now_mb) - )); - } - self.before_mb = now_mb; - } -} - -#[cfg(target_os = "linux")] -fn process_used_memory_mb() -> usize { - (procfs::process::Process::myself().unwrap().stat.vsize / 1024 / 1024) as usize -} - -#[cfg(not(target_os = "linux"))] -fn process_used_memory_mb() -> usize { - 0 -} - #[cfg(unix)] pub(crate) fn clear_current_line() { // Fails in the test runner. diff --git a/game/src/app.rs b/game/src/app.rs index 41848be48d..88c7200b57 100644 --- a/game/src/app.rs +++ b/game/src/app.rs @@ -5,7 +5,7 @@ use crate::layer::Layer; use crate::options::Options; use crate::render::{AgentCache, DrawMap, DrawOptions, Renderable, UnzoomedAgents}; use crate::sandbox::{GameplayMode, TutorialState}; -use abstutil::{MeasureMemory, Timer}; +use abstutil::Timer; use geom::{Bounds, Circle, Distance, Duration, Pt2D, Time}; use map_model::{IntersectionID, Map, Traversable}; use maplit::btreemap; @@ -536,14 +536,11 @@ pub struct PerMap { impl PerMap { pub fn new(flags: Flags, cs: &ColorScheme, ctx: &mut EventCtx, timer: &mut Timer) -> PerMap { - let mut mem = MeasureMemory::new(); let (map, sim, _) = flags.sim_flags.load(timer); - mem.reset("Map and Sim", timer); timer.start("draw_map"); let draw_map = DrawMap::new(&map, cs, ctx, timer); timer.stop("draw_map"); - mem.reset("DrawMap", timer); let mut low_z = 0; let mut high_z = 0;