From 1c4e2c8e5051a079ea15ce398f39f2acaf34d0df Mon Sep 17 00:00:00 2001 From: Gavin Halliday Date: Thu, 24 Oct 2024 13:09:03 +0100 Subject: [PATCH] Add summary of throughput for the set of rows Signed-off-by: Gavin Halliday --- tools/roxie/extract-roxie-timings.py | 34 ++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/tools/roxie/extract-roxie-timings.py b/tools/roxie/extract-roxie-timings.py index b781fc815b8..b6a4e75d537 100755 --- a/tools/roxie/extract-roxie-timings.py +++ b/tools/roxie/extract-roxie-timings.py @@ -23,6 +23,7 @@ import sys import re import argparse +import datetime def calculateDerivedStats(curRow): @@ -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): @@ -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 @@ -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: @@ -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()