Skip to content

Commit e8b7697

Browse files
committed
ENH: Profile at constant interval
1 parent a15e086 commit e8b7697

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

nipype/utils/profiler.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,12 @@ def _sample(self, cpu_interval=None):
100100

101101
def run(self):
102102
"""Core monitoring function, called by start()"""
103+
start_time = time()
104+
wait_til = start_time
103105
while not self._event.is_set():
104106
self._sample()
105-
self._event.wait(self._freq)
107+
wait_til += self._freq
108+
self._event.wait(max(0, wait_til - time()))
106109

107110

108111
# Log node stats function

0 commit comments

Comments
 (0)