From d656ec4f644744d866e39794b444ef7bbbac7286 Mon Sep 17 00:00:00 2001 From: Acrimon Date: Wed, 24 Jul 2019 01:43:27 +0200 Subject: [PATCH 1/6] Hook the tracking allocator into binaries. Doesn't do any monitoring/logging. Just provides the data when you want it. --- voxygen/Cargo.toml | 1 + voxygen/src/main.rs | 3 +++ 2 files changed, 4 insertions(+) diff --git a/voxygen/Cargo.toml b/voxygen/Cargo.toml index 40a4b51ca7..cada942e50 100644 --- a/voxygen/Cargo.toml +++ b/voxygen/Cargo.toml @@ -58,3 +58,4 @@ frustum_query = "0.1.2" rodio = { git = "https://github.com/desttinghim/rodio.git", rev = "dd93f905c1afefaac03c496a666ecab27d3e391b" } crossbeam = "^0.7.1" fxhash = "0.2" +heaptrack = "0.3.0" diff --git a/voxygen/src/main.rs b/voxygen/src/main.rs index 5aeb53c7bc..8ddf9dce07 100644 --- a/voxygen/src/main.rs +++ b/voxygen/src/main.rs @@ -34,11 +34,14 @@ use crate::{ audio::base::Genre, audio::AudioFrontend, menu::main::MainMenuState, settings::Settings, window::Window, }; +use heaptrack::track_mem; use log::{self, debug, error, info, warn}; use simplelog::{CombinedLogger, Config, TermLogger, WriteLogger}; use std::{fs::File, mem, panic, str::FromStr}; +track_mem!(); + /// A type used to store state that is shared between all play states. pub struct GlobalState { settings: Settings, From 5394c574d9d8eb5b6b2a83facf940d521f14535e Mon Sep 17 00:00:00 2001 From: Acrimon Date: Wed, 24 Jul 2019 01:44:33 +0200 Subject: [PATCH 2/6] Some other stuff I missed to commit. (Hooked into server-cli) --- Cargo.lock | 8 ++++++++ server-cli/Cargo.toml | 1 + server-cli/src/main.rs | 3 +++ 3 files changed, 12 insertions(+) diff --git a/Cargo.lock b/Cargo.lock index 463af2c31a..cabbc1a6c5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1214,6 +1214,11 @@ dependencies = [ "svg_fmt 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "heaptrack" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "hibitset" version = "0.5.4" @@ -2778,6 +2783,7 @@ dependencies = [ name = "veloren-server-cli" version = "0.2.0" dependencies = [ + "heaptrack 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", "pretty_env_logger 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "veloren-common 0.2.0", @@ -2806,6 +2812,7 @@ dependencies = [ "glsl-include 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "glutin 0.19.0 (registry+https://github.com/rust-lang/crates.io-index)", "guillotiere 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "heaptrack 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "image 0.21.2 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3159,6 +3166,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum gtk 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d695d6be4110618a97c19cd068e8a00e53e33b87e3c65cdc5397667498b1bc24" "checksum gtk-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3d9554cf5b3a85a13fb39258c65b04b262989c1d7a758f8f555b77a478621a91" "checksum guillotiere 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "182af928b4435d8fbef910535586ecdca95ab4068493769c090e6573477f5e35" +"checksum heaptrack 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8a5f3c2341045ae29cc6d1004caf4c043addd7b658f9d11464fd6914dff6609b" "checksum hibitset 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)" = "6527bc88f32e0d3926c7572874b2bf17a19b36978aacd0aacf75f7d27a5992d0" "checksum hound 3.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8a164bb2ceaeff4f42542bdb847c41517c78a60f5649671b2a07312b6e117549" "checksum humantime 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3ca7e5f2e110db35f93b837c81797f3714500b81d517bf20c431b16d3ca4f114" diff --git a/server-cli/Cargo.toml b/server-cli/Cargo.toml index 62ad0c6368..0fa0113076 100644 --- a/server-cli/Cargo.toml +++ b/server-cli/Cargo.toml @@ -10,3 +10,4 @@ common = { package = "veloren-common", path = "../common" } log = "0.4" pretty_env_logger = "0.3" +heaptrack = "0.3.0" diff --git a/server-cli/src/main.rs b/server-cli/src/main.rs index d53aca5d91..a07fc22b9f 100644 --- a/server-cli/src/main.rs +++ b/server-cli/src/main.rs @@ -1,8 +1,11 @@ use common::clock::Clock; +use heaptrack::track_mem; use log::info; use server::{Event, Input, Server}; use std::time::Duration; +track_mem!(); + const TPS: u64 = 30; fn main() { From 07ce7e064ee8a7c2cb90554dfba50bf68e1aebc6 Mon Sep 17 00:00:00 2001 From: Acrimon Date: Wed, 24 Jul 2019 02:02:22 +0200 Subject: [PATCH 3/6] Hopefully fix conflict. --- server-cli/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server-cli/Cargo.toml b/server-cli/Cargo.toml index 0fa0113076..fa7f23696e 100644 --- a/server-cli/Cargo.toml +++ b/server-cli/Cargo.toml @@ -9,5 +9,5 @@ server = { package = "veloren-server", path = "../server" } common = { package = "veloren-common", path = "../common" } log = "0.4" -pretty_env_logger = "0.3" heaptrack = "0.3.0" +pretty_env_logger = "0.3" From 551433f03a59b6abaa79e5a873aad7f7ae5d5e6b Mon Sep 17 00:00:00 2001 From: Acrimon Date: Wed, 24 Jul 2019 01:43:27 +0200 Subject: [PATCH 4/6] Hook the tracking allocator into binaries. Doesn't do any monitoring/logging. Just provides the data when you want it. --- voxygen/Cargo.toml | 1 + voxygen/src/main.rs | 3 +++ 2 files changed, 4 insertions(+) diff --git a/voxygen/Cargo.toml b/voxygen/Cargo.toml index 40a4b51ca7..cada942e50 100644 --- a/voxygen/Cargo.toml +++ b/voxygen/Cargo.toml @@ -58,3 +58,4 @@ frustum_query = "0.1.2" rodio = { git = "https://github.com/desttinghim/rodio.git", rev = "dd93f905c1afefaac03c496a666ecab27d3e391b" } crossbeam = "^0.7.1" fxhash = "0.2" +heaptrack = "0.3.0" diff --git a/voxygen/src/main.rs b/voxygen/src/main.rs index 5aeb53c7bc..8ddf9dce07 100644 --- a/voxygen/src/main.rs +++ b/voxygen/src/main.rs @@ -34,11 +34,14 @@ use crate::{ audio::base::Genre, audio::AudioFrontend, menu::main::MainMenuState, settings::Settings, window::Window, }; +use heaptrack::track_mem; use log::{self, debug, error, info, warn}; use simplelog::{CombinedLogger, Config, TermLogger, WriteLogger}; use std::{fs::File, mem, panic, str::FromStr}; +track_mem!(); + /// A type used to store state that is shared between all play states. pub struct GlobalState { settings: Settings, From deb6c6adef51de6bfa9e8aea865d80a1517f9882 Mon Sep 17 00:00:00 2001 From: Acrimon Date: Wed, 24 Jul 2019 01:44:33 +0200 Subject: [PATCH 5/6] Some other stuff I missed to commit. (Hooked into server-cli) --- Cargo.lock | 8 ++++++++ server-cli/Cargo.toml | 3 ++- server-cli/src/main.rs | 3 +++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index 71b818287a..d538c5eb2b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1214,6 +1214,11 @@ dependencies = [ "svg_fmt 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "heaptrack" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "hibitset" version = "0.5.4" @@ -2782,6 +2787,7 @@ dependencies = [ name = "veloren-server-cli" version = "0.2.0" dependencies = [ + "heaptrack 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", "pretty_env_logger 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "veloren-common 0.2.0", @@ -2810,6 +2816,7 @@ dependencies = [ "glsl-include 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "glutin 0.19.0 (registry+https://github.com/rust-lang/crates.io-index)", "guillotiere 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "heaptrack 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "image 0.21.2 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3163,6 +3170,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum gtk 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d695d6be4110618a97c19cd068e8a00e53e33b87e3c65cdc5397667498b1bc24" "checksum gtk-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3d9554cf5b3a85a13fb39258c65b04b262989c1d7a758f8f555b77a478621a91" "checksum guillotiere 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "182af928b4435d8fbef910535586ecdca95ab4068493769c090e6573477f5e35" +"checksum heaptrack 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8a5f3c2341045ae29cc6d1004caf4c043addd7b658f9d11464fd6914dff6609b" "checksum hibitset 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)" = "6527bc88f32e0d3926c7572874b2bf17a19b36978aacd0aacf75f7d27a5992d0" "checksum hound 3.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8a164bb2ceaeff4f42542bdb847c41517c78a60f5649671b2a07312b6e117549" "checksum humantime 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3ca7e5f2e110db35f93b837c81797f3714500b81d517bf20c431b16d3ca4f114" diff --git a/server-cli/Cargo.toml b/server-cli/Cargo.toml index 7e32d07f5f..0fa0113076 100644 --- a/server-cli/Cargo.toml +++ b/server-cli/Cargo.toml @@ -9,4 +9,5 @@ server = { package = "veloren-server", path = "../server" } common = { package = "veloren-common", path = "../common" } log = "0.4" -pretty_env_logger = "0.3" \ No newline at end of file +pretty_env_logger = "0.3" +heaptrack = "0.3.0" diff --git a/server-cli/src/main.rs b/server-cli/src/main.rs index 952c7c3152..8f3cec9130 100644 --- a/server-cli/src/main.rs +++ b/server-cli/src/main.rs @@ -1,8 +1,11 @@ use common::clock::Clock; +use heaptrack::track_mem; use log::info; use server::{Event, Input, Server, ServerSettings}; use std::time::Duration; +track_mem!(); + const TPS: u64 = 30; fn main() { From b1e1cb0f00a7335b5f89df9dc88e48011cd31f84 Mon Sep 17 00:00:00 2001 From: Acrimon Date: Wed, 24 Jul 2019 02:02:22 +0200 Subject: [PATCH 6/6] Hopefully fix conflict. --- server-cli/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server-cli/Cargo.toml b/server-cli/Cargo.toml index 0fa0113076..fa7f23696e 100644 --- a/server-cli/Cargo.toml +++ b/server-cli/Cargo.toml @@ -9,5 +9,5 @@ server = { package = "veloren-server", path = "../server" } common = { package = "veloren-common", path = "../common" } log = "0.4" -pretty_env_logger = "0.3" heaptrack = "0.3.0" +pretty_env_logger = "0.3"