Преглед изворни кода

ResourceGraph: Handle more than 4 GiB of memory

Tom пре 4 година
родитељ
комит
c144d358ae
1 измењених фајлова са 6 додато и 6 уклоњено
  1. 6 6
      Userland/Applets/ResourceGraph/main.cpp

+ 6 - 6
Userland/Applets/ResourceGraph/main.cpp

@@ -159,14 +159,14 @@ private:
         auto& obj = json.value().as_object();
         auto& obj = json.value().as_object();
         unsigned kmalloc_allocated = obj.get("kmalloc_allocated").to_u32();
         unsigned kmalloc_allocated = obj.get("kmalloc_allocated").to_u32();
         unsigned kmalloc_available = obj.get("kmalloc_available").to_u32();
         unsigned kmalloc_available = obj.get("kmalloc_available").to_u32();
-        unsigned user_physical_allocated = obj.get("user_physical_allocated").to_u32();
-        unsigned user_physical_committed = obj.get("user_physical_committed").to_u32();
-        unsigned user_physical_uncommitted = obj.get("user_physical_uncommitted").to_u32();
+        auto user_physical_allocated = obj.get("user_physical_allocated").to_u64();
+        auto user_physical_committed = obj.get("user_physical_committed").to_u64();
+        auto user_physical_uncommitted = obj.get("user_physical_uncommitted").to_u64();
         unsigned kmalloc_bytes_total = kmalloc_allocated + kmalloc_available;
         unsigned kmalloc_bytes_total = kmalloc_allocated + kmalloc_available;
         unsigned kmalloc_pages_total = (kmalloc_bytes_total + PAGE_SIZE - 1) / PAGE_SIZE;
         unsigned kmalloc_pages_total = (kmalloc_bytes_total + PAGE_SIZE - 1) / PAGE_SIZE;
-        unsigned total_userphysical_and_swappable_pages = kmalloc_pages_total + user_physical_allocated + user_physical_committed + user_physical_uncommitted;
-        allocated = kmalloc_allocated + ((u64)(user_physical_allocated + user_physical_committed) * PAGE_SIZE);
-        available = (u64)(total_userphysical_and_swappable_pages * PAGE_SIZE) - allocated;
+        u64 total_userphysical_and_swappable_pages = kmalloc_pages_total + user_physical_allocated + user_physical_committed + user_physical_uncommitted;
+        allocated = kmalloc_allocated + ((user_physical_allocated + user_physical_committed) * PAGE_SIZE);
+        available = (total_userphysical_and_swappable_pages * PAGE_SIZE) - allocated;
         return true;
         return true;
     }
     }