MCPcopy Create free account
hub / github.com/cameron314/concurrentqueue / extract

Function extract

benchmarks/extract_graph_data.py:13–35  ·  view source on GitHub ↗
(bench, log, data, hasBulk = True)

Source from the content-addressed store, hash-verified

11
12
13def 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
38def write_csv(data, path, hasBulk = True):

Callers 1

Calls 1

do_extractFunction · 0.85

Tested by

no test coverage detected