|
|
@ -4,12 +4,26 @@ Put the machine's CPUs under pressure to increase the likelihood of scheduling
|
|
|
|
weirdness. Useful for exposing otherwise difficult to hit races in the library.
|
|
|
|
weirdness. Useful for exposing otherwise difficult to hit races in the library.
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import ctypes
|
|
|
|
import multiprocessing
|
|
|
|
import multiprocessing
|
|
|
|
|
|
|
|
import os
|
|
|
|
|
|
|
|
import time
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
LIBC = ctypes.CDLL('libc.so.6')
|
|
|
|
|
|
|
|
sched_yield = LIBC.sched_yield
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def burn():
|
|
|
|
def burn():
|
|
|
|
while 1: pass
|
|
|
|
while 1:
|
|
|
|
|
|
|
|
a, b, c = os.urandom(3)
|
|
|
|
|
|
|
|
n = int(((ord(a) << 16) |
|
|
|
|
|
|
|
|
(ord(b) << 8) |
|
|
|
|
|
|
|
|
(ord(c) << 0)) / 1.6)
|
|
|
|
|
|
|
|
print(n)
|
|
|
|
|
|
|
|
for x in xrange(n): pass
|
|
|
|
|
|
|
|
sched_yield()
|
|
|
|
|
|
|
|
|
|
|
|
mul = 2
|
|
|
|
mul = 1.5
|
|
|
|
count = int(mul * multiprocessing.cpu_count())
|
|
|
|
count = int(mul * multiprocessing.cpu_count())
|
|
|
|
print count
|
|
|
|
print count
|
|
|
|
|
|
|
|
|
|
|
|