Skip to content

Commit

Permalink
Add summary of throughput for the set of rows
Browse files Browse the repository at this point in the history
Signed-off-by: Gavin Halliday <[email protected]>
  • Loading branch information
ghalliday committed Oct 24, 2024
1 parent 9a9cd12 commit 1c4e2c8
Showing 1 changed file with 30 additions and 4 deletions.
34 changes: 30 additions & 4 deletions tools/roxie/extract-roxie-timings.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import sys
import re
import argparse
import datetime

def calculateDerivedStats(curRow):

Expand Down Expand Up @@ -91,18 +92,19 @@ def calculateSummaryStats(curRow, numCpus, numRows):
timeQueryResponseSeconds = float(curRow.get("elapsed", 0.0)) / 1000
avgTimeQueryResponseSeconds = timeQueryResponseSeconds / numRows if numRows else 0

maxPerCpuTransactionsPerSecond = 1000 * numRows / timeTotalCpu if timeTotalCpu else 0
maxTransactionsPerSecond = numCpus * maxPerCpuTransactionsPerSecond
perCpuTransactionsPerSecond = 1000 * numRows / timeTotalCpu if timeTotalCpu else 0
maxTransactionsPerSecond = numCpus * perCpuTransactionsPerSecond
maxWorkerThreads = numCpus / workerCpuLoad if workerCpuLoad else 0
maxFarmers = maxTransactionsPerSecond * avgTimeQueryResponseSeconds

curRow["perCpuTransactionsPerSecond"] = perCpuTransactionsPerSecond # recorded but not reported
curRow["MaxTransactionsPerSecond"] = maxTransactionsPerSecond
curRow["MaxWorkerThreads"] = maxWorkerThreads
curRow["MaxFarmers"] = maxFarmers

#Expected cpu load for 10 transactions per second per node
if maxPerCpuTransactionsPerSecond:
curRow["ExpectedCpuLoad10"] = 10 / maxPerCpuTransactionsPerSecond
if perCpuTransactionsPerSecond:
curRow["ExpectedCpuLoad10"] = 10 / perCpuTransactionsPerSecond

def printRow(curRow):

Expand Down Expand Up @@ -184,6 +186,11 @@ def printRow(curRow):
curRow["time"] = row[i+1]
break

if minTimeStamp == '' or timestamp < minTimeStamp:
minTimeStamp = timestamp
if maxTimeStamp == '' or timestamp > maxTimeStamp:
maxTimeStamp = timestamp

nesting = list()
prefix = ''
suppress = 0
Expand Down Expand Up @@ -275,6 +282,16 @@ def printRow(curRow):
allStats["MaxFarmers"] = 1
allStats["ExpectedCpuLoad10"] = 1

elapsed = 0
try:
minTime = datetime.datetime.strptime(minTimeStamp, '%Y-%m-%d %H:%M:%S.%f')
maxTime = datetime.datetime.strptime(maxTimeStamp, '%Y-%m-%d %H:%M:%S.%f')
elapsed = (maxTime - minTime).seconds
print(f"Time range: ['{minTimeStamp}'..'{maxTimeStamp}'] = {elapsed}s")

except:
pass

# Create a string containing all the stats that were found in the file.
headings = 'id'
for statName in allStats:
Expand Down Expand Up @@ -352,3 +369,12 @@ def sortFunc(cur):
printRow(centileRows[centile])

print()
#These stats are only really revelant if it is including all the transactions from all services
#they may need rethinking a little.
if elapsed and numRows > 1:
perCpuTransactionsPerSecond = totalRow["perCpuTransactionsPerSecond"]
#elapsed is time from end of 1st transaction to end of last transaction - so subtract 1 from number of rows
actualTransationsPerSecond = (numRows - 1) / elapsed
expectedCpuLoad = actualTransationsPerSecond / perCpuTransactionsPerSecond if perCpuTransactionsPerSecond else 0
print(f"Transactions: Throughput={actualTransationsPerSecond}/s Time={1/actualTransationsPerSecond}s ExpectedCpuLoad={expectedCpuLoad}")
print()

0 comments on commit 1c4e2c8

Please sign in to comment.