From c9a01d9a33890261034107b2e090f8ac11ac8b87 Mon Sep 17 00:00:00 2001 From: Matthias Jung Date: Tue, 17 Feb 2015 21:50:15 +0100 Subject: [PATCH 1/2] added better metric for utilisation --- analyzer/analyzer/scripts/metrics.py | 43 +++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/analyzer/analyzer/scripts/metrics.py b/analyzer/analyzer/scripts/metrics.py index b5c20047..674c8bbf 100644 --- a/analyzer/analyzer/scripts/metrics.py +++ b/analyzer/analyzer/scripts/metrics.py @@ -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' """) From 51f9a7f53f8db82facbe67903e62008b96a2106d Mon Sep 17 00:00:00 2001 From: Matthias Jung Date: Tue, 17 Feb 2015 22:45:20 +0100 Subject: [PATCH 2/2] test for in order check --- analyzer/analyzer/scripts/tests.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/analyzer/analyzer/scripts/tests.py b/analyzer/analyzer/scripts/tests.py index c42617c2..955f455b 100644 --- a/analyzer/analyzer/scripts/tests.py +++ b/analyzer/analyzer/scripts/tests.py @@ -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