Forgot to divide the memory by 3...
[minecraft_web.git] / backend / src / minecraft_controller.rs
index be58549..4a9d754 100644 (file)
@@ -4,7 +4,7 @@ use chrono::{ DateTime, offset::Local };
 \r
 #[derive(Clone, Debug)]\r
 pub struct MinecraftExe {\r
-    memory: u64, // [kB].\r
+    memory: u64, // [B].\r
     load_average_5min: f64, // [%].\r
     uptime: u64, // [s].\r
     world_size: u64, // [B].\r
@@ -15,7 +15,7 @@ pub struct MinecraftExe {
 \r
 impl MinecraftExe {\r
     pub fn format_memory(&self) -> String {\r
-        format_byte_size(self.memory * 1024, 2)\r
+        format_byte_size(self.memory, 2)\r
     }\r
 \r
     pub fn format_load_average(&self) -> String {\r
@@ -146,7 +146,7 @@ pub fn get_minecraft_executable_information(world_path: &str, backup_path: &str,
         Some(\r
             MinecraftExe {\r
                 memory: process.memory() / 3, // Because the Java garbage collector ZGC reports three times more the real memory usage: https://stackoverflow.com/a/62934057/212675\r
-                load_average_5min: system.load_average().five / system.processors().len() as f64 * 100.,\r
+                load_average_5min: system.load_average().five / system.cpus().len() as f64 * 100.,\r
                 uptime: std::time::SystemTime::now().duration_since(std::time::UNIX_EPOCH).unwrap().as_secs() - process.start_time(),\r
                 world_size,\r
                 active_players: status_from_rcon.players,\r