use of com.ibm.j9ddr.vm29.pointer.generated.OMRMemCategoryPointer in project openj9 by eclipse.
the class MemoryCategoryIterator method iterateCategoryRootSet.
public static Iterator<? extends OMRMemCategoryPointer> iterateCategoryRootSet(J9PortLibraryPointer portLibrary) throws CorruptDataException {
Map<U32, OMRMemCategoryPointer> rootSetMap = new HashMap<U32, OMRMemCategoryPointer>();
Iterator<? extends OMRMemCategoryPointer> categoryIt = iterateAllCategories(portLibrary);
/* Store all categories in a map */
while (categoryIt.hasNext()) {
OMRMemCategoryPointer thisCategory = categoryIt.next();
rootSetMap.put(thisCategory.categoryCode(), thisCategory);
}
/* Remove any categories that are listed as children of any other category */
categoryIt = iterateAllCategories(portLibrary);
while (categoryIt.hasNext()) {
OMRMemCategoryPointer thisCategory = categoryIt.next();
final int numberOfChildren = thisCategory.numberOfChildren().intValue();
for (int i = 0; i < numberOfChildren; i++) {
U32 childCode = thisCategory.children().at(i);
rootSetMap.remove(childCode);
}
}
return Collections.unmodifiableCollection(rootSetMap.values()).iterator();
}
use of com.ibm.j9ddr.vm29.pointer.generated.OMRMemCategoryPointer in project openj9 by eclipse.
the class MemoryCategoryIterator method iterateAllCategories.
@SuppressWarnings("unchecked")
public static Iterator<OMRMemCategoryPointer> iterateAllCategories(J9PortLibraryPointer portLibrary) throws CorruptDataException {
OMRMemCategorySetPointer omr_categories = portLibrary.omrPortLibrary().portGlobals().control().omr_memory_categories();
OMRMemCategorySetPointer language_categories = portLibrary.omrPortLibrary().portGlobals().control().language_memory_categories();
if (omr_categories.notNull() && language_categories.notNull()) {
return IteratorHelpers.combineIterators(new MemoryCategorySetIterator(omr_categories), new MemoryCategorySetIterator(language_categories));
} else if (omr_categories.notNull()) {
return new MemoryCategorySetIterator(omr_categories);
} else if (language_categories.notNull()) {
return new MemoryCategorySetIterator(language_categories);
} else {
return new PortLibraryCategoryIterator(portLibrary);
}
}
use of com.ibm.j9ddr.vm29.pointer.generated.OMRMemCategoryPointer in project openj9 by eclipse.
the class NativeMemInfoCommand method printSections.
/**
* @param next
* @param level
* @return size in bytes
* @throws CorruptDataException
*/
void printSections(OMRMemCategoryPointer next, int level) throws CorruptDataException {
ComponentSizeAllocation csa = computeSize(next);
if (csa.size == 0) {
return;
}
printLine(level, next.name().getCStringAtOffset(0), csa.size, csa.allocations);
final int numberOfChildren = next.numberOfChildren().intValue();
for (int i = 0; i < numberOfChildren; i++) {
U32 childCode = next.children().at(i);
OMRMemCategoryPointer child = OMRMemCategoryHelper.getMemoryCategory(childCode);
printSections(child, level + 1);
}
final long liveBytes = next.liveBytes().longValue();
if (liveBytes < csa.size && liveBytes != 0) {
printLine(level + 1, "Other", liveBytes, next.liveAllocations().longValue());
}
}
use of com.ibm.j9ddr.vm29.pointer.generated.OMRMemCategoryPointer in project openj9 by eclipse.
the class NativeMemInfoCommand method run.
public void run(String command, String[] args, Context context, PrintStream out) throws DDRInteractiveCommandException {
this.out = out;
try {
Iterator<? extends OMRMemCategoryPointer> categories = MemoryCategoryIterator.iterateCategoryRootSet(DTFJContext.getVm().portLibrary());
while (categories.hasNext()) {
OMRMemCategoryPointer next = categories.next();
printSections(next, 0);
}
} catch (CorruptDataException e) {
throw new DDRInteractiveCommandException(e);
}
}
use of com.ibm.j9ddr.vm29.pointer.generated.OMRMemCategoryPointer in project openj9 by eclipse.
the class NativeMemInfoCommand method computeSize.
private ComponentSizeAllocation computeSize(OMRMemCategoryPointer mcp) throws CorruptDataException {
ComponentSizeAllocation csa = new ComponentSizeAllocation();
csa.size += mcp.liveBytes().longValue();
csa.allocations += mcp.liveAllocations().longValue();
final int numberOfChildren = mcp.numberOfChildren().intValue();
for (int i = 0; i < numberOfChildren; i++) {
U32 childCode = mcp.children().at(i);
OMRMemCategoryPointer child = OMRMemCategoryHelper.getMemoryCategory(childCode);
csa.add(computeSize(child));
}
return csa;
}
Aggregations