Skip to content

Commit 37f5887

Browse files
committed
Multiprocessing\S01-Process\S01-01-sequential-example
1 parent 8395d24 commit 37f5887

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import time
2+
3+
4+
def some_task(name):
5+
print(f"Process {name} Started.")
6+
for i in range(0, 100000000):
7+
pass
8+
print(f"Process {name} Finished.")
9+
10+
11+
start = time.perf_counter()
12+
some_task("One")
13+
some_task("Two")
14+
some_task("Three")
15+
some_task("Four")
16+
end = time.perf_counter()
17+
exe_time = end - start
18+
print(f"Execution Time: {exe_time} sec")
19+
20+
# for example: Execution Time: 14.556302800003323 sec

0 commit comments

Comments
 (0)