Skip to content

Commit

Permalink
Update region_size.py
Browse files Browse the repository at this point in the history
Added plotly graphing for eden, survivor and heap size
  • Loading branch information
bschoening authored Dec 22, 2021
1 parent 4f1858f commit 263165c
Showing 1 changed file with 48 additions and 1 deletion.
49 changes: 48 additions & 1 deletion region_size.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,40 @@
allocations = []
total = 0

timeUser=[]
timeSys=[]
timeReal=[]

szEden=[]
szSurvivors=[]
szHeap=[]

maxheap=None
units= { 'K' : 1_000, 'M' : 1_000_000, 'G' : 1_000_000_000 }
def parseTimes(line):
pass

def plotTimes(line):
pass

def parseGenerations(line):
"""
Parses an input line from gc.log into a set of tokens and returns them
"""
generations = re.match(".*Eden:\s(\d+.\d+)(\w).*Survivors:\s(\d+.\d+)(\w).*Heap:\s(\d+.\d+)(\w)", line)
if generations:
eden, survivors, heap = round(float(generations.group(1))), round(float(generations.group(3))),
round(float(generations.group(5)))
print(eden, survivors, heap)
return eden*units[generations.group(2)], survivors*units[generations.group(4)], heap**units[generations.group(6)]

def plotGenerations(eden, survivors, heap):
import plotly.express as px
import pandas as pd
df = pd.DataFrame.from_dict({"eden" : eden, "survivors" : survivors, "total_heap" : heap})
fig = px.line(df, x=df.index, y=[df.eden, df.survivors, df.total_heap], title='Generation Size')
fig.show()

for line in f.read().splitlines():
if (maxheap == None and re.search("CommandLine flags",line) != None):
maxheap = re.search("-XX:MaxHeapSize=[0-9]+", line).group()
Expand All @@ -31,6 +65,20 @@
req = re.search("allocation request: [0-9]+", line).group()
allocations.append(int(re.search(r"[0-9]+", req).group()))

time = parseTimes(line)
if time:
user, sys, real = time
timeUser.append(user)
timeSys.append(sys)
timeReal.append(real)

generations = parseGenerations(line)
if generations:
eden, survivors, heap = generations
szEden.append(eden)
szSurvivors.append(survivors)
szHeap.append(heap)

print(f"found {total} humongous objects in {log}")


Expand All @@ -56,4 +104,3 @@
#Total promoted bytes n/a
#Avg creation rate 4.33 mb/sec
#Avg promotion rate n/a

0 comments on commit 263165c

Please sign in to comment.