use of org.nextprot.api.core.service.ExperimentalContextDictionaryService in project nextprot-api by calipho-sib.
the class ExperimentalContextDictAnalyserTask method execute.
@Override
protected void execute() throws IOException {
ExperimentalContextDictionaryService bean = getBean(ExperimentalContextDictionaryService.class);
Map<Long, ExperimentalContext> dict = bean.getAllExperimentalContexts();
/* If instrumentation is available, use it, otherwise guess the size using sun.misc.Unsafe; if that is unavailable,
* guess using predefined specifications -> setting jamm as -javaagent is now optional */
MemoryMeter memMeter = new MemoryMeter().withGuessing(MemoryMeter.Guess.FALLBACK_BEST);
if (getCommandLineParser().isDebugMode()) {
memMeter = memMeter.enableDebug();
}
long shallowMemory = memMeter.measure(dict);
long deepMemory = memMeter.measureDeep(dict);
long childrenCount = memMeter.countChildren(dict);
StringBuilder sb = new StringBuilder("experimental-context-dictionary memory allocation: ");
sb.append("shallow=").append(shallowMemory).append("B").append(", deep=").append((int) Math.ceil(deepMemory / 1024.)).append("KB").append(", children#=").append(childrenCount).append("\n");
System.out.printf(sb.toString());
}
Aggregations