added better metric for utilisation
This commit is contained in:
@@ -83,7 +83,47 @@ def trans_with_max_response_latency(connection):
|
||||
return result[0]
|
||||
|
||||
@metric
|
||||
def memory_utilisation_percent(connection):
|
||||
def memory_active(connection):
|
||||
cursor = connection.cursor()
|
||||
cursor.execute(""" SELECT sum(DataStrobeEnd - DataStrobeBegin) FROM transactions """)
|
||||
active = cursor.fetchone()
|
||||
cursor = connection.cursor()
|
||||
cursor.execute(""" SELECT clk FROM GeneralInfo """)
|
||||
clk = cursor.fetchone()
|
||||
return (active[0]/clk[0])
|
||||
|
||||
@metric
|
||||
def memory_total(connection):
|
||||
cursor = connection.cursor()
|
||||
cursor.execute(""" SELECT max(DataStrobeEnd) FROM Transactions """)
|
||||
total = cursor.fetchone()
|
||||
cursor = connection.cursor()
|
||||
cursor.execute(""" SELECT clk FROM GeneralInfo """)
|
||||
clk = cursor.fetchone()
|
||||
return (total[0]/clk[0])
|
||||
|
||||
@metric
|
||||
def memory_idle(connection):
|
||||
cursor = connection.cursor()
|
||||
cursor.execute(""" SELECT sum(p1.PhaseEnd - p2.PhaseBegin) FROM Phases p1, Phases p2 Where p1.PhaseName = "REQ" and p2.PhaseName = "RESP" and ((p1.Transact-1) = (p2.Transact)) and (p1.PhaseEnd > p2.PhaseBegin) """)
|
||||
idle = cursor.fetchone()
|
||||
cursor = connection.cursor()
|
||||
cursor.execute(""" SELECT clk FROM GeneralInfo """)
|
||||
clk = cursor.fetchone()
|
||||
if idle[0] == None:
|
||||
return 0;
|
||||
else:
|
||||
return (idle[0]/clk[0])
|
||||
|
||||
@metric
|
||||
def memory_utilisation_percent_new(connection):
|
||||
total = memory_total(connection)
|
||||
active = memory_active(connection)
|
||||
idle = memory_idle(connection)
|
||||
return (active/(total-idle))*100
|
||||
|
||||
@metric
|
||||
def memory_utilisation_percent_old(connection):
|
||||
cursor = connection.cursor()
|
||||
cursor.execute(""" SELECT sum(DataStrobeEnd - DataStrobeBegin) FROM transactions """)
|
||||
active = cursor.fetchone()
|
||||
@@ -93,6 +133,7 @@ def memory_utilisation_percent(connection):
|
||||
return (active[0]/total[0])*100
|
||||
|
||||
|
||||
|
||||
def refreshMissDecision(connection,calculatedMetrics):
|
||||
cursor = connection.cursor()
|
||||
cursor.execute("""SELECT phases.ID,PhaseBegin,PhaseEnd,TBank FROM Phases INNER JOIN transactions on transactions.id = phases.transact WHERE PhaseName='AUTO_REFRESH' """)
|
||||
|
||||
Reference in New Issue
Block a user