Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@auscompgeek
Created March 14, 2019 09:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save auscompgeek/cf1075c72bec2383712ec49c0400327f to your computer and use it in GitHub Desktop.
Save auscompgeek/cf1075c72bec2383712ec49c0400327f to your computer and use it in GitHub Desktop.
roboRIO-5893-FRC:~$ # on a 2017 roboRIO image
roboRIO-5893-FRC:~$ cat test.py
import hal
import sys
import time
import timeit
import threading
def timer(): return timeit.timeit(hal.observeUserProgramTest)
def main():
threads = [threading.Thread(target=timer) for _ in range(10)]
for t in threads: t.start()
for t in threads: t.join()
if 'once' in sys.argv:
print(timer())
else:
main()
roboRIO-5893-FRC:~$ time python3 test.py
real 9m31.739s
user 3m40.460s
sys 7m40.210s
roboRIO-5893-FRC:~$ time python3 test.py once
35.66481052600011
real 0m37.715s
user 0m12.780s
sys 0m13.260s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment