#!/usr/bin/env python3 import sys, os, re TEST_MAP = { 'Sequential LIFO': 'lifo', 'Sequential FIFO': 'fifo', 'Random Order Free': 'random', 'Interleaved': 'interleave', 'Long-lived vs Short-lived': 'longshort', 'Mixed Sizes': 'mixed', } def parse_file(path, allocator): size = None cur_test = None results = [] with open(path,'r',errors='ignore') as f: for line in f: m = re.search(r'^SIZE CLASS:\s*(\d+) Bytes', line) if m: size = int(m.group(1)) cur_test = None continue # Detect tests for key, short in TEST_MAP.items(): if key != 'Mixed Sizes' and key in line: cur_test = short break if 'Mixed Sizes ---' in line or 'Test 5: Mixed Sizes' in line: size = 'mixed' cur_test = 'mixed' m2 = re.search(r'^Throughput:\s*([0-9.]+) M ops/sec', line) if m2: thr = float(m2.group(1)) results.append((allocator, size, cur_test, thr)) return results def main(): if len(sys.argv) != 2: print('usage: parse_comprehensive_logs.py