From 23ce2b90889cf067130fd5644250d6e6bb9ad066 Mon Sep 17 00:00:00 2001 From: Daniel Schick Date: Fri, 15 Mar 2024 17:17:30 +0100 Subject: [PATCH] refined evaluation script --- LogFileEvaluation/evaluate.py | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/LogFileEvaluation/evaluate.py b/LogFileEvaluation/evaluate.py index 69ec84e4..bae24a1b 100644 --- a/LogFileEvaluation/evaluate.py +++ b/LogFileEvaluation/evaluate.py @@ -12,20 +12,23 @@ from collections import deque abspath = os.path.abspath(__file__) dname = os.path.dirname(abspath) -outputFileName = dname + "\\" + 'output.csv' +outputFileNameDBH = dname + "\\" + 'output_dbh.csv' +outputFileNameHISNORD = dname + "\\" + 'output_hisnord.csv' -# open the output file -outputFile = open(outputFileName, 'w') +# open the output files +outputFileDBH = open(outputFileNameDBH, 'w') +outputFileHISNORD = open(outputFileNameHISNORD, 'w') # write the header -outputFile.write('Receive time, Duration\n') +outputFileDBH.write('Receive time, Duration, Message class, Attempts\n') +outputFileHISNORD.write('Receive time, Duration, message class, Attemps\n') # open the log files q = deque() -for i in range(0, 10): +for i in range(1, -1, -1): logFileName = dname + "\\" + 'log-NSWMessageService.txt.' + str(i) logFile = open(logFileName, 'r') @@ -38,6 +41,8 @@ for i in range(0, 10): # get substring of the date dateString = line[0:19] + + # kept old code for reference, but it does nothing if "Upload of" in line: # add the dateString to the queue q.appendleft(dateString) @@ -54,9 +59,21 @@ for i in range(0, 10): # calculate the duration duration = currentdate - lastdate - outputFile.write(dateString + "," + str(duration.seconds) + "\n") + + # outputFile.write(dateString + "," + str(duration.seconds) + "\n") + + if "MessageTelemetry" in line: + his = line[72:81].strip() + msg_class = line[83:91].strip() + duration = line[93:98] + tries = line[100:102] + if his == 'DUDR': + outputFileHISNORD.write(dateString + "," + duration + "," + msg_class + "," + tries + "\n") + elif his == 'DBH': + outputFileDBH.write(dateString + "," + duration + "," + msg_class + "," + tries + "\n") # close the log file logFile.close() -outputFile.close() \ No newline at end of file +outputFileDBH.close() +outputFileHISNORD.close() \ No newline at end of file