Skip to content

Commit bc83573

Browse files
authored
Better timing benchmarking
1 parent ddb9fd4 commit bc83573

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

src/modules/ObjectDetectionCoral/segment_and_test.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import subprocess
33
import time
44
import shutil
5+
import re
56

67
#'''
78
fn_list = [
@@ -313,15 +314,12 @@ def seg_exists(filename, segment_type, segment_count):
313314
seg_list + ["--labels","coral/pycoral/test_data/coco_labels.txt","--input","/home/seth/coral/pycoral/test_data/grace_hopper.bmp",
314315
"--count","1000","--num-tpus",str(num_tpus)]
315316
print(cmd)
316-
start_time = time.perf_counter()
317-
subprocess.run(cmd)
318-
timings.append(((time.perf_counter() - start_time), num_tpus, fn, seg_type, sn))
317+
c = subprocess.run(cmd, capture_output=True)
318+
print(c.stdout)
319+
print(c.stderr)
320+
ms_time = float(re.compile(r'threads; ([\d\.]+)ms ea').findall(c.stdout)[0])
321+
timings.append((ms_time, num_tpus, fn, seg_type, sn))
319322

320-
# Find segment pipeline efficencies
321-
#cmd = ["/home/seth/libcoral/out/k8/tools/model_pipelining_performance_analysis","--data_dir",seg_dir+seg_type,
322-
# "--model_list",fn,"--num_segments_list",','.join([str(i) for i in range(1,max_seg+1)])]
323-
#print(cmd)
324-
#subprocess.run(cmd)
325323
timings = sorted(timings, key=lambda t: t[0])
326324

327325
# Print the top three

0 commit comments

Comments
 (0)