source: tests/zombies/string-perf/qanal.py

Last change on this file was 08ed947, checked in by Michael Brooks <mlbrooks@…>, 2 years ago

Roll up of string changes for performance testing/improvement, and a couple API features supporting them.

String API changes:
Defining a tuning knob to control the heap growth policy (relapaces former 10% hardcode, downgraded to a default)
Implementing findFrom (allowing find-non-first); leaving find as find-first.

String implementation perf improvements:
Calling C-malloc directly instead of via CFA-alloc.
Replacings loops that copy with memmove calls.
Replacings loops that search for a value with memchr calls.

String perf testing realized:
Makefile supporting several prog-*.cfa, chosen by OPERATION value (implies prog.cfa changes to support the adjusted protocol)
Adjusting the starter/accumulater declarations in PEQ and PTA to behave consistently in cfa v cpp.
Adding tests: allocation, find, normalize, pass-by-val, pass-by-x.
Adding helper shell scripts for: generating flame graphs, collecting/crunching allocation stats using Mubeen's malloc wrappers

  • 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.