new metric for parallel banks
This commit is contained in:
@@ -2,6 +2,7 @@ import sys
|
||||
import sqlite3
|
||||
from memUtil import *
|
||||
from math import *
|
||||
from intervaltree import Interval, IntervalTree
|
||||
|
||||
metrics = []
|
||||
threadMetrics = []
|
||||
@@ -221,8 +222,9 @@ def number_of_accesses(connection):
|
||||
|
||||
@metric
|
||||
def bank_usage_ratio(connection):
|
||||
bankAccess = []
|
||||
# Calculates how many percent of the accesses go to which bank...
|
||||
cursor = connection.cursor()
|
||||
bankAccess = []
|
||||
total = number_of_accesses(connection)
|
||||
for bank in range(getNumberOfBanks(connection)):
|
||||
cursor.execute("SELECT COUNT(*) FROM Transactions where TBank = {}".format(bank))
|
||||
@@ -231,6 +233,64 @@ def bank_usage_ratio(connection):
|
||||
|
||||
return ",".join(format(x, "6.2f") for x in bankAccess)
|
||||
|
||||
@metric
|
||||
def bank_overlap_ratio(connection):
|
||||
# Calculates how many banks are open in parallel
|
||||
cursor = connection.cursor()
|
||||
cursor.execute("SELECT clk FROM GeneralInfo ")
|
||||
clk = cursor.fetchone()
|
||||
|
||||
cursor.execute("select TraceEnd from GeneralInfo")
|
||||
traceEndTMP = cursor.fetchone()
|
||||
traceEnd = int(traceEndTMP[0]/clk[0])
|
||||
|
||||
trace = []
|
||||
|
||||
cursor.execute("""
|
||||
select p1.PhaseBegin, p1.PhaseName from Phases p1
|
||||
where
|
||||
(p1.PhaseName = "ACT" or p1.PhaseName = "PRE_ALL" or p1.PhaseName = "PRE")
|
||||
order by PhaseBegin
|
||||
""")
|
||||
prevPhase = "PRE_ALL"
|
||||
prevTime = 0
|
||||
|
||||
for c in cursor:
|
||||
trace.append([(int(c[0]/clk[0])),c[1]])
|
||||
|
||||
#Insert a pseudo precharge all to mark the end of the trace
|
||||
trace.append([traceEnd,"PRE_ALL"])
|
||||
|
||||
bankCounter = 0
|
||||
bankTime = []
|
||||
|
||||
for i in range(0, getNumberOfBanks(connection)+1):
|
||||
bankTime.append(0)
|
||||
|
||||
currentTime = 0
|
||||
|
||||
for t in trace:
|
||||
|
||||
interval = t[0] - currentTime
|
||||
bankTime[bankCounter] += interval
|
||||
currentTime = t[0]
|
||||
|
||||
if(t[1] == "ACT"):
|
||||
bankCounter += 1
|
||||
elif(t[1] == "PRE_ALL"):
|
||||
bankCounter = 0
|
||||
elif(t[1] == "PRE"):
|
||||
bankCounter -= 1
|
||||
else:
|
||||
print ("ERROR")
|
||||
return 0
|
||||
|
||||
|
||||
for i in range(0, getNumberOfBanks(connection)+1):
|
||||
bankTime[i] = round(bankTime[i]/traceEnd * 100,2)
|
||||
|
||||
return ",".join(format(x, "6.2f") for x in bankTime)
|
||||
|
||||
|
||||
# @metric
|
||||
# def number_of_precharges(connection):
|
||||
|
||||
Reference in New Issue
Block a user