COPYING: Everything I've done is CC0
[cpython-extension.git] / grab-cores.py
1 #!/usr/bin/env python
2
3 import threading
4
5 import spam
6
7
8 def grab_cores(threads=1, count=int(1e9)):
9     _threads = []
10     for i in range(threads):
11         thread = threading.Thread(target=spam.busy, args=(count,))
12         _threads.append(thread)
13         thread.start()
14     for thread in _threads:
15         thread.join()
16
17
18 if __name__ == '__main__':
19     import sys
20
21     grab_cores(threads=int(sys.argv[1]))