Last active
September 3, 2021 10:26
-
-
Save rainyman2012/cd1f1b2c45be81a935af91aec1a992a9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import threading | |
import time | |
def blocking_io(): | |
print("thread start") | |
time.sleep(10) | |
print("thread finished") | |
def main(): | |
t1 = threading.Thread(target=blocking_io, name="blocking_task") | |
t1.start() | |
t1.join() | |
start_time = time.perf_counter() | |
main() | |
print("process exited") | |
end_time = time.perf_counter() | |
execution_time = end_time - start_time | |
print(f"\nExecuting - {__file__}\nExecution Starts: {start_time}\nExecutions Ends: {end_time}\nTotals Execution Time:{execution_time:0.2f} seconds.") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment