Skip to content

Commit 4425247

Browse files
committed
Reduce the runtime and overhead of the PGO benchmark run to make it work with the constrained resources in the AArch64 docker/qemu build.
1 parent e1068f0 commit 4425247

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ wheel_%: dist/$(PACKAGENAME)-$(VERSION).tar.gz
5757
$$PYBIN/pip install -U pip setuptools; \
5858
make clean; rm -fr $$PROFDIR; \
5959
CFLAGS="$$CFLAGS -fprofile-generate -fprofile-dir=$$PROFDIR" $$PYBIN/python setup.py build_ext -i; \
60-
$$PYBIN/python lockbench.py flock; \
60+
$$PYBIN/python lockbench.py flock quick; \
6161
CFLAGS="$$CFLAGS -fprofile-use -fprofile-correction -fprofile-dir=$$PROFDIR" $$PYBIN/python setup.py build_ext -i -f; \
6262
$$PYBIN/python lockbench.py rlock flock; \
6363
CFLAGS="$$CFLAGS -fprofile-use -fprofile-correction -fprofile-dir=$$PROFDIR" $$PYBIN/python setup.py bdist_wheel; \

lockbench.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,9 @@ def threaded(l, test_func, tcount=10):
9898
from timeit import Timer
9999
from functools import partial
100100

101+
repeat_count = 100000
102+
repeat_count_t = 1000
103+
101104
rlock, flock = ('RLock', RLock()), ('FLock', FLock())
102105
locks = []
103106
args = sys.argv[1:]
@@ -108,18 +111,19 @@ def threaded(l, test_func, tcount=10):
108111
locks.append(rlock)
109112
if 'flock' in args:
110113
locks.append(flock)
114+
for _ in range(args.count('quick')):
115+
repeat_count = max(10, repeat_count // 100)
116+
repeat_count_t = max(5, repeat_count_t // 10)
111117
assert locks, args
112118

113119
for name, lock in locks:
114120
print('Testing %s' % name)
115-
repeat_count = 100000
116121
print("sequential (x%d):" % repeat_count)
117122
for function in functions:
118123
timer = Timer(partial(function, lock))
119124
print('%-25s: %.3f sec' % (function.__name__, max(timer.repeat(repeat=4, number=repeat_count))))
120125

121-
repeat_count = 1000
122-
print("threaded 10T (x%d):" % repeat_count)
126+
print("threaded 10T (x%d):" % repeat_count_t)
123127
for function in functions:
124128
timer = Timer(partial(threaded, lock, function))
125-
print('%-25s: %.3f sec' % (function.__name__, max(timer.repeat(repeat=4, number=repeat_count))))
129+
print('%-25s: %.3f sec' % (function.__name__, max(timer.repeat(repeat=4, number=repeat_count_t))))

0 commit comments

Comments
 (0)