We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 71f5b39 commit 2f22d99Copy full SHA for 2f22d99
Week04/decorators_busra_pehlivanlar.py
@@ -0,0 +1,21 @@
1
+import time
2
+import sys
3
+
4
+def performance(func):
5
+ def wrapper(*args, **kwargs):
6
+ start_t = time.perf_counter()
7
8
+ result = func(*args, **kwargs)
9
10
+ end_t = time.perf_counter()
11
12
+ performance.counter += 1
13
+ performance.total_time += (end_t - start_t)
14
+ performance.total_mem += sys.getsizeof(result)
15
16
+ return result
17
+ return wrapper
18
19
+performance.counter = 0
20
+performance.total_time = 0.0
21
+performance.total_mem = 0
0 commit comments