def extlosSpace(nPath, rAddr): [heapPath, offset] = extHeap(nPath, rAddr) largeObjectSpace = readPointer(heapPath, offset, 52) disContinousSpace = readPointer(heapPath, offset, 12) allocSpace = readPointer(heapPath, offset, 24) print "Large object Space Offset " + largeObjectSpace print "Discontinous Space offset " + disContinousSpace [losPath, offset] = art.extOffset(largeObjectSpace, memList) num_bytes_allocated = readInt(losPath, offset, 32) num_objects_allocated = readInt(losPath, offset, 40) total_bytes_allocated = readInt(losPath, offset, 48) total_objects_allocated = readInt(losPath, offset, 56) losBegin = readPointer(losPath, offset, 64) losEnd = readPointer(losPath, offset, 68) lock_ = readPointer(losPath, offset, 72) large_object_ = hex(int(largeObjectSpace, 16) + 112) large_objects_ = readPointer(losPath, offset, 112) #Allocationtracker,stdmap-rbtree print "Number of bytes allocated " + str(num_bytes_allocated) print "Number of objects allocated " + str(num_objects_allocated) print "Total bytes allocated " + str(total_bytes_allocated) print "Total objects allocated " + str(total_objects_allocated) print "Large object Space Begin " + losBegin print "Large object space End " + losEnd print " Lock " + lock_ print " Large objects " + large_objects_ return large_objects_
def extLOSObject(addr1, jvm2): K = sys.argv[4] [losPath, offset] = art.extOffset(K, mapList) print "lospath" + losPath addr = art.extFhandle(losPath) ofile = hex(struct.unpack("<I", addr.read(4))[0]) photo = artrecover(addr, mapList)
def extObject(addrStart, jvm2): [start, end] = art.extSE(lstList) [aPath, offset] = art.extOffset(addrStart, mapList) addr = art.extFhandle(aPath) print "addr" print addr print offset addr.seek(offset) oClass = hex(struct.unpack("<I", addr.read(4))[0]) if (art.validateAddr(int(oClass, 16), start, end)): #jvm2.searchRef(oClass) off = addr.tell() - 4 objSize = jvm2.dumpRefs(oClass, addr, off, start)
def extLosObjects(nodes_dict, mapList, memList): name = "" print "********Allocation Tracking Actual Data Location*****" for K, V in nodes_dict.items(): K = hex(int(K, 16) + 16) [losPath, offset] = art.extOffset(K, memList) addr = art.extFhandle(losPath) #print addr #print offset addr.seek(offset) objPointer = hex(struct.unpack("<I", addr.read(4))[0]) #print "object pointer" #print objPointer [klass, monitor, refFile, refOff] = extOKlass(objPointer, mapList) name = resolveName(klass, mapList) print "Klass " + name + " " + "array" + " " + objPointer
def extHeap(nPath, rAddr): index = art.extIndex('Runtime', 'heap_') heapAddr = readPointer(nPath, rAddr, index) print "Heap Offset " + heapAddr [heapPath, offset] = art.extOffset(heapAddr, memList) return [heapPath, offset]