Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import subprocess
- import os
- from timeit import Timer
- args = ("cat", "/sys/bus/iio/devices/iio:device1/in_temp_raw")
- def timing():
- res = subprocess.run(args, capture_output=True)
- if res.returncode:
- os.exit(-1)
- if __name__ == "__main__":
- # Warmup
- for i in range(5):
- timing()
- print("Warmup done")
- while True:
- t = Timer(timing).timeit(100) / 100
- print(f"Time {t}")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement