-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.py
More file actions
45 lines (36 loc) · 791 Bytes
/
Copy pathtest.py
File metadata and controls
45 lines (36 loc) · 791 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
"""
Test case for func_parallelizer
"""
import time
import func_parallelizer
class Calculate:
"""
"""
def __init__(self, a, b):
self.a = a
self.b = b
def add(self):
"""
Function to add 2 numbers
"""
s = self.a + self.b
return s
def mul(self):
"""
Function to multiply 2 numbers
"""
p = self.a * self.b
return p
if __name__ == '__main__':
calculation = Calculate(10, 20)
tasks = [
calculation.add,
calculation.mul,
]
print('start')
start = time.time()
print(func_parallelizer.all_cores)
results = func_parallelizer.parallel_runner(tasks, cpu_cores=2)
print(results)
end = time.time()
print('Time', end - start)