mirror of
https://github.com/2OOP/pism.git
synced 2026-02-04 19:04:49 +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<>();
|
List<File> foundFiles = new ArrayList<>();
|
||||||
fileSearcher(rootFolder, foundFiles);
|
fileSearcher(rootFolder, foundFiles);
|
||||||
this.totalCount = foundFiles.size();
|
this.totalCount = foundFiles.size();
|
||||||
|
|
||||||
|
// measure memory before loading
|
||||||
|
long before = getUsedMemory();
|
||||||
|
|
||||||
loader(foundFiles);
|
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