mirror of
https://github.com/2OOP/pism.git
synced 2026-02-04 10:54:51 +00:00
Estimate for how much RAM used in loading assets.
This commit is contained in:
@@ -60,8 +60,23 @@ public class AssetLoader {
|
||||
List<File> foundFiles = new ArrayList<>();
|
||||
fileSearcher(rootFolder, foundFiles);
|
||||
this.totalCount = foundFiles.size();
|
||||
|
||||
// measure memory before loading
|
||||
long before = getUsedMemory();
|
||||
|
||||
loader(foundFiles);
|
||||
logger.info("Total files loaded: " + this.totalCount);
|
||||
|
||||
// ~measure memory after loading
|
||||
long after = getUsedMemory();
|
||||
long used = after - before;
|
||||
|
||||
logger.info("Total files loaded: {}", this.totalCount);
|
||||
logger.info("Memory used by assets: ~{} MB", used / (1024 * 1024));
|
||||
}
|
||||
|
||||
private static long getUsedMemory() {
|
||||
Runtime runtime = Runtime.getRuntime();
|
||||
return runtime.totalMemory() - runtime.freeMemory();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user