source: doc/theses/mike_brooks_MMath/benchmarks/string/qanal.py

Last change on this file was 10ef475, checked in by Michael Brooks <mlbrooks@…>, 5 months ago

Move string benchmark programs into thesis

  • Property mode set to 100755
File size: 1.4 KB
Line 
1#! /usr/bin/python3
2
3import glob
4import os
5import re
6
7print("corpuslen", "expansion", "elapsed_whole_test", "elapsed_last_alloc", "seclast_req_mem", sep=",")
8
9thepath = "preload_dump--qrun1*"
10
11for mypath in glob.glob(thepath):
12 pathparsed=re.match(r'preload_dump--qrun1--corpus-1-(\d+)-1.txt--expansion-(0\.\d+).txt', mypath)
13 corpuslen=pathparsed.group(1)
14 expansion=pathparsed.group(2)
15
16 with open(mypath) as file:
17 lines = file.readlines()
18
19 nAllocs = len(lines)
20
21 epoch_timestamp_bp = lines[0].find("epoch_timestamp(ms)")
22 epoch_timestamp_ep = epoch_timestamp_bp + len("epoch_timestamp(ms)")
23 current_req_mem_bp = lines[0].find("current_req_mem(B)")
24 current_req_mem_ep = current_req_mem_bp + len("current_req_mem(B)")
25
26 first_timestamp = lines[ 1][epoch_timestamp_bp:epoch_timestamp_ep].strip()
27 seclast_req_mem = lines[nAllocs-2][current_req_mem_bp:current_req_mem_ep].strip()
28 seclast_timestamp = lines[nAllocs-2][epoch_timestamp_bp:epoch_timestamp_ep].strip()
29 last_timestamp = lines[nAllocs-1][epoch_timestamp_bp:epoch_timestamp_ep].strip()
30
31 elapsed_whole_test = int(last_timestamp) - int(first_timestamp)
32 elapsed_last_alloc = int(last_timestamp) - int(seclast_timestamp)
33
34 print(corpuslen, expansion, elapsed_whole_test, elapsed_last_alloc, seclast_req_mem, sep=",")
Note: See TracBrowser for help on using the repository browser.