Fix a bug where plotting failed with more than 1 thread

This commit is contained in:
2023-11-07 09:50:10 +01:00
parent 1050019db6
commit 3481703e6e

View File

@@ -91,11 +91,14 @@ def memory_utilisation_window_thread(connection, tracePath, steps, thread_ID):
SELECT
SUM(DataStrobeEnd - DataStrobeBegin)
FROM
transactions
PHASES
INNER JOIN
Transactions
ON Phases.Transact = Transactions.ID
WHERE
DataStrobeBegin >= ?
AND DataStrobeEnd <= ?
AND TThread = {0}
AND Thread = {0}
"""
# Only the end of the data transfer is inside the time window
@@ -103,12 +106,15 @@ def memory_utilisation_window_thread(connection, tracePath, steps, thread_ID):
SELECT
SUM(DataStrobeEnd - ? )
FROM
transactions
PHASES
INNER JOIN
Transactions
ON Phases.Transact = Transactions.ID
WHERE
DataStrobeBegin < ?
AND DataStrobeEnd > ?
AND DataStrobeEnd <=?
AND TThread = {0}
AND Thread = {0}
"""
# Only the beginning of the data transfer is inside the time window
@@ -116,12 +122,15 @@ def memory_utilisation_window_thread(connection, tracePath, steps, thread_ID):
SELECT
SUM( ? - DataStrobeBegin)
FROM
transactions
PHASES
INNER JOIN
Transactions
ON Phases.Transact = Transactions.ID
WHERE
DataStrobeBegin >= ?
AND DataStrobeBegin < ?
AND DataStrobeEnd > ?
AND TThread = {0}
AND Thread = {0}
"""
# The data transfer occupies all the time window
@@ -129,11 +138,14 @@ def memory_utilisation_window_thread(connection, tracePath, steps, thread_ID):
SELECT
DataStrobeBegin
FROM
transactions
PHASES
INNER JOIN
Transactions
ON Phases.Transact = Transactions.ID
WHERE
DataStrobeBegin <= ?
AND DataStrobeEnd >= ?
AND TThread = {0}
AND Thread = {0}
"""
queryFull = queryFull.format(thread_ID)
@@ -255,6 +267,9 @@ def memory_utilisation_window(connection, tracePath, steps):
threads = getThreads(connection)
if (len(threads) > 1):
for thread in threads:
if thread == -1:
continue
threadStr = "Thread " + str(thread)
bandwidthPercentage, bandwidth, outputFileNameBWMatlab = memory_utilisation_window_thread(connection, tracePath, steps, thread)
BWPercentageFigurePlot.plot(time, bandwidthPercentage, label=threadStr)