File tree Expand file tree Collapse file tree 1 file changed +12
-11
lines changed
Expand file tree Collapse file tree 1 file changed +12
-11
lines changed Original file line number Diff line number Diff line change 44def performance (func ):
55 def wrapper (* args , ** kwargs ):
66 tracemalloc .start ()
7- start = time .perf_counter ()
7+ t1 = time .perf_counter ()
88
99 result = func (* args , ** kwargs )
1010
11- end = time .perf_counter ()
12- current , peak = tracemalloc .get_traced_memory ()
11+ t2 = time .perf_counter ()
12+ _ , peak = tracemalloc .get_traced_memory ()
1313 tracemalloc .stop ()
1414
15- wrapper .counter += 1
16- wrapper .total_time += (end - start )
17- wrapper .total_mem += peak
15+ # Hata buradaydı: Sayaçları wrapper'a değil, performance fonksiyonuna ekliyoruz
16+ performance .counter += 1
17+ performance .total_time += (t2 - t1 )
18+ performance .total_mem += peak
1819
1920 return result
21+ return wrapper
2022
21- wrapper .counter = 0
22- wrapper .total_time = 0
23- wrapper .total_mem = 0
24-
25- return wrapper
23+ # Testin beklediği özellikler (Attributes) ana fonksiyona atanmalı
24+ performance .counter = 0
25+ performance .total_time = 0
26+ performance .total_mem = 0
You can’t perform that action at this time.
0 commit comments