(bench, log, data, hasBulk = True)
| 11 | |
| 12 | |
| 13 | def extract(bench, log, data, hasBulk = True): |
| 14 | # data = { thread_count: [ locked, boost, tbb, moodycamel, moodycamel_tok, moodycamel_bulk ], ... } |
| 15 | |
| 16 | def do_extract(bench, queue_header): |
| 17 | block = re.search(r'^' + bench + r':.*?' + queue_header + r'\s*(.*?)\s*^\s*Operations per second', log, re.S | re.M | re.I).group(1) |
| 18 | for threads, opsst in re.findall(r'^\s*(\d+)\s+thread.*?([0-9\.]+[kMG]?\s*$)', block, re.M | re.I): |
| 19 | threads = int(threads) |
| 20 | multiplier = 1 |
| 21 | if opsst[-1] in 'kMG': |
| 22 | multiplier = { 'k': 1000, 'M': 1000000, 'G': 1000000000 }[opsst[-1]] |
| 23 | opsst = opsst[:-1] |
| 24 | opsst = int(float(opsst) * multiplier) |
| 25 | if threads not in data: |
| 26 | data[threads] = [] |
| 27 | data[threads].append(opsst) |
| 28 | |
| 29 | do_extract(bench, 'LockBasedQueue') |
| 30 | do_extract(bench, 'boost::lockfree::queue') |
| 31 | do_extract(bench, 'tbb::concurrent_queue') |
| 32 | do_extract(bench, 'Without tokens') |
| 33 | do_extract(bench, 'With tokens') |
| 34 | if hasBulk: |
| 35 | do_extract(bench + ' bulk', 'With tokens') |
| 36 | |
| 37 | |
| 38 | def write_csv(data, path, hasBulk = True): |
no test coverage detected