Java Code Examples for sun.jvm.hotspot.oops.Oop#getObjectSize()
The following examples show how to use
sun.jvm.hotspot.oops.Oop#getObjectSize() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HeapHistogramVisitor.java From vjtools with Apache License 2.0 | 6 votes |
@Override public boolean doObj(Oop obj) { Klass klass = obj.getKlass(); ClassStats classStats = HeapUtils.getClassStats(klass, classStatsMap); Place place = isCms ? getCmsLocation(obj) : getParLocation(obj); long objSize = obj.getObjectSize(); updateWith(classStats, objSize, place); // 每完成1% 打印一个.,每完成10% 打印百分比提示 progressNodifier.processingSize += objSize; if (progressNodifier.processingSize > progressNodifier.nextNotificationSize) { progressNodifier.printProgress(); } return false; }
Example 2
Source File: HeapHistogramVisitor.java From vjtools with Apache License 2.0 | 6 votes |
private void updateWith(ClassStats classStats, Oop obj, Place place) { long objSize = obj.getObjectSize(); classStats.count++; classStats.size += objSize; switch (place) { case InEden: classStats.edenCount++; classStats.edenSize += objSize; break; case InSurvivor: classStats.survivorCount++; classStats.survivorSize += objSize; break; case InOld: classStats.oldCount++; classStats.oldSize += objSize; break; case Unknown: break; } }
Example 3
Source File: OldgenAccessor.java From vjtools with Apache License 2.0 | 4 votes |
public void caculateHistogram() { ObjectHeap objectHeap = HeapUtils.getObjectHeap(); CollectedHeap heap = checkHeapType(); ConcurrentMarkSweepGeneration cmsGen = HeapUtils.getOldGenForCMS(heap); CompactibleFreeListSpace cmsSpace = cmsGen.cmsSpace(); CMSCollector cmsCollector = cmsSpace.collector(); cur = cmsSpace.bottom(); regionStart = cur; Address limit = cmsSpace.end(); printGenSummary(cmsGen); ProgressNotifier progressNotifier = new ProgressNotifier(cmsGen.used()); progressNotifier.printHead(); final long addressSize = VM.getVM().getAddressSize(); for (; cur.lessThan(limit);) { Address k = cur.getAddressAt(addressSize); if (FreeChunk.indicatesFreeChunk(cur)) { skipFreeChunk(addressSize); } else if (k != null) { Oop obj = null; try { obj = objectHeap.newOop(cur.addOffsetToAsOopHandle(0)); } catch (UnknownOopException ignored) { // ignored } if (obj == null) { continueNextAddress(cmsCollector); continue; } long objectSize = obj.getObjectSize(); ClassStats stats = HeapUtils.getClassStats(obj.getKlass(), classStatsMap); stats.oldCount++; stats.oldSize += objectSize; progressNotifier.processingSize += objectSize; if (progressNotifier.processingSize > progressNotifier.nextNotificationSize) { progressNotifier.printProgress(); } cur = cur.addOffsetTo(CompactibleFreeListSpace.adjustObjectSizeInBytes(objectSize)); } else { continueNextAddress(cmsCollector); } } tty.println("\ntotal live regions:" + liveRegions); }