瀏覽代碼

Kernel: Show module memory size in /proc/modules

Note that this only shows the size of the loaded module sections,
and does not include any memory allocated *by* the module.
Andreas Kling 5 年之前
父節點
當前提交
3ad0e6e198
共有 1 個文件被更改,包括 5 次插入0 次删除
  1. 5 0
      Kernel/FileSystem/ProcFS.cpp

+ 5 - 0
Kernel/FileSystem/ProcFS.cpp

@@ -337,6 +337,11 @@ Optional<KBuffer> procfs$modules(InodeIdentifier)
         obj.add("name", it.value->name);
         obj.add("module_init", (u32)it.value->module_init);
         obj.add("module_fini", (u32)it.value->module_fini);
+        u32 size = 0;
+        for (auto& section : it.value->sections) {
+            size += section.capacity();
+        }
+        obj.add("size", size);
     }
     array.finish();
     return builder.build();