New metric: bank usage ratio
This commit is contained in:
@@ -219,6 +219,19 @@ def number_of_accesses(connection):
|
||||
return result[0]
|
||||
|
||||
|
||||
@metric
|
||||
def bank_usage_ratio(connection):
|
||||
bankAccess = []
|
||||
cursor = connection.cursor()
|
||||
total = number_of_accesses(connection)
|
||||
for bank in range(getNumberOfBanks(connection)):
|
||||
cursor.execute("SELECT COUNT(*) FROM Transactions where TBank = {}".format(bank))
|
||||
r = cursor.fetchone()
|
||||
bankAccess.append(round((float(r[0]) / float(total)) * 100.0, 2))
|
||||
|
||||
return ",".join(format(x, "6.2f") for x in bankAccess)
|
||||
|
||||
|
||||
# @metric
|
||||
# def number_of_precharges(connection):
|
||||
# cursor = connection.cursor()
|
||||
|
||||
Reference in New Issue
Block a user