PEP8
This commit is contained in:
@@ -212,7 +212,7 @@ def paralellism(connection, thread):
|
||||
|
||||
|
||||
@threadMetric
|
||||
def thread_conclusion_in_ns(connection,thread):
|
||||
def thread_conclusion_in_ns(connection, thread):
|
||||
cursor = connection.cursor()
|
||||
query = """ SELECT max(PhaseEnd)/1000 FROM Phases INNER JOIN Transactions on Phases.transact=Transactions.id WHERE TThread = :Thread """
|
||||
cursor.execute(query, {"Thread": thread})
|
||||
@@ -267,10 +267,10 @@ def bank_overlap_ratio(connection):
|
||||
prevTime = 0
|
||||
|
||||
for c in cursor:
|
||||
trace.append([(int(c[0]/clk[0])),c[1]])
|
||||
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"])
|
||||
# Insert a pseudo precharge all to mark the end of the trace
|
||||
trace.append([traceEnd, "PRE_ALL"])
|
||||
|
||||
bankCounter = 0
|
||||
bankTime = []
|
||||
@@ -297,12 +297,11 @@ def bank_overlap_ratio(connection):
|
||||
elif(t[1] == "RDA"):
|
||||
bankCounter -= 1
|
||||
else:
|
||||
print ("ERROR")
|
||||
print("ERROR")
|
||||
return 0
|
||||
|
||||
|
||||
for i in range(0, getNumberOfBanks(connection)+1):
|
||||
bankTime[i] = round(bankTime[i]/traceEnd * 100,2)
|
||||
bankTime[i] = round(bankTime[i]/traceEnd * 100, 2)
|
||||
|
||||
return ",".join(format(x, "6.2f") for x in bankTime)
|
||||
|
||||
@@ -483,8 +482,8 @@ def getMetrics(pathToTrace):
|
||||
if (len(getThreads(connection)) > 1):
|
||||
for thread in getThreads(connection):
|
||||
for threadMetric in threadMetrics:
|
||||
res = "Thread {0}: {1}".format(thread,threadMetric.__name__.replace("_"," "))
|
||||
selectedMetrics.append(res)
|
||||
res = "Thread {0}: {1}".format(thread, threadMetric.__name__.replace("_", " "))
|
||||
selectedMetrics.append(res)
|
||||
res = "pass ratio"
|
||||
selectedMetrics.append(res)
|
||||
|
||||
@@ -492,7 +491,7 @@ def getMetrics(pathToTrace):
|
||||
return selectedMetrics
|
||||
|
||||
|
||||
def calculateMetrics(pathToTrace, selectedMetrics = []):
|
||||
def calculateMetrics(pathToTrace, selectedMetrics=[]):
|
||||
|
||||
calculatedMetrics = []
|
||||
connection = sqlite3.connect(pathToTrace)
|
||||
@@ -501,9 +500,13 @@ def calculateMetrics(pathToTrace, selectedMetrics = []):
|
||||
bankwiseLogic = mcconfig.getValue("BankwiseLogic")
|
||||
|
||||
if bankwiseLogic == "0":
|
||||
pdnMetrics = [time_in_PDNA_in_ns, time_in_PDNA_percent, time_in_PDNP_in_ns, time_in_PDNP_percent, time_in_SREF_in_ns, time_in_SREF_percent]
|
||||
pdnMetrics = [time_in_PDNA_in_ns, time_in_PDNA_percent,
|
||||
time_in_PDNP_in_ns, time_in_PDNP_percent,
|
||||
time_in_SREF_in_ns, time_in_SREF_percent]
|
||||
else:
|
||||
pdnMetrics = [time_in_PDNAB_in_ns, time_in_PDNAB_percent, time_in_PDNPB_in_ns, time_in_PDNPB_percent, time_in_SREFB_in_ns, time_in_SREFB_percent]
|
||||
pdnMetrics = [time_in_PDNAB_in_ns, time_in_PDNAB_percent,
|
||||
time_in_PDNPB_in_ns, time_in_PDNPB_percent,
|
||||
time_in_SREFB_in_ns, time_in_SREFB_percent]
|
||||
|
||||
for m in pdnMetrics:
|
||||
if m not in metrics:
|
||||
@@ -544,12 +547,12 @@ def calculateMetrics(pathToTrace, selectedMetrics = []):
|
||||
for metric in threadMetrics:
|
||||
if(selectedMetrics[len(metrics) + len(threadMetrics)*(thread-1) + threadMetrics.index(metric)]):
|
||||
mres = metric(connection, thread)
|
||||
mname = "Thread {0} - {1}".format(thread,metric.__name__.replace("_"," "))
|
||||
mname = "Thread {0} - {1}".format(thread, metric.__name__.replace("_", " "))
|
||||
res = (mname, mres)
|
||||
calculatedMetrics.append(res)
|
||||
print("{0}: {1}".format(res[0], res[1]))
|
||||
|
||||
if(selectedMetrics[len(selectedMetrics) -1]):
|
||||
if (selectedMetrics[len(selectedMetrics) - 1]):
|
||||
calculatedMetrics.extend(passRatio(connection))
|
||||
# refreshMissDecision(connection, calculatedMetrics)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user