Advertisement
Guest User

Untitled

a guest
Mar 19th, 2019
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. roboRIO-5893-FRC:~$ # on a 2017 roboRIO image
  2. roboRIO-5893-FRC:~$ cat test.py
  3. import hal
  4. import sys
  5. import time
  6. import timeit
  7. import threading
  8.  
  9. def timer(): return timeit.timeit(hal.observeUserProgramTest)
  10.  
  11. def main():
  12. threads = [threading.Thread(target=timer) for _ in range(10)]
  13.  
  14. for t in threads: t.start()
  15.  
  16. for t in threads: t.join()
  17.  
  18. if 'once' in sys.argv:
  19. print(timer())
  20. else:
  21. main()
  22. roboRIO-5893-FRC:~$ time python3 test.py
  23.  
  24. real 9m31.739s
  25. user 3m40.460s
  26. sys 7m40.210s
  27. roboRIO-5893-FRC:~$ time python3 test.py once
  28. 35.66481052600011
  29.  
  30. real 0m37.715s
  31. user 0m12.780s
  32. sys 0m13.260s
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement