This commit is contained in:
root
2015-02-17 22:48:10 +01:00
2 changed files with 58 additions and 1 deletions

View File

@@ -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' """)

View File

@@ -550,6 +550,22 @@ def read_holds_dll_constraint_after_sref(connection):
lastRow = currentRow
return TestSuceeded()
@test
def strict_transaction_order(connection):
"""Checks that all transactions are processed in the right order"""
cursor = connection.cursor()
query = """SELECT distinct t2.ID FROM Transactions t1, Transactions t2 where t2.ID > t1.ID and t2.DataStrobeBegin < t1.DataStrobeBegin and t1.DataStrobeBegin != 0 and t2.DataStrobeBegin !=0;"""
cursor.execute(query)
transactions = ""
for currentRow in cursor:
transactions += str(currentRow[0]) + ","
if(transactions != ""):
return TestFailed("Transactions {0} is/are not in Order ".format(transactions))
return TestSuceeded()
# ----------- powerdown checks ---------------------------------------
# @test