File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -130,12 +130,17 @@ def cprofile_wrapper(func):
130130 @wraps (func )
131131 def profile_wrapper (* args , ** kwargs ):
132132 global timer_counter
133- profile_path = Path (func .__name__ + f"{ next (timer_counter )} .profile" )
133+ profile_cnt = next (timer_counter )
134+ profile_path = Path (func .__name__ + f"{ profile_cnt } .profile" )
134135 prof = cProfile .Profile ()
135136 prof .enable ()
137+ start_ts = time .time ()
136138 retval = prof .runcall (func , * args , ** kwargs )
139+ profile_latency = time .time () - start_ts
137140 prof .disable ()
138- print (f"### Cprofile for { func .__name__ } iter { next (timer_counter )} ###" )
141+ print (
142+ f"### Cprofile for { func .__name__ } iter { profile_cnt } took { profile_latency :.3f} seconds ###"
143+ )
139144 ps = pstats .Stats (prof )
140145 prof .dump_stats (profile_path )
141146 svg_path = profile_path .with_suffix (".svg" )
You can’t perform that action at this time.
0 commit comments