log the time of some heavy callbacks
(self)
| 31 | self.add(name, timer() - s) |
| 32 | |
| 33 | def log(self): |
| 34 | |
| 35 | """ log the time of some heavy callbacks """ |
| 36 | if self.tot < 2: |
| 37 | return |
| 38 | msgs = [] |
| 39 | for name, t in self.times: |
| 40 | if t / self.tot > 0.3 and t > 1: |
| 41 | msgs.append(name + ": " + humanize_time_delta(t)) |
| 42 | logger.info( |
| 43 | "Callbacks took {:.3f} sec in total. {}".format( |
| 44 | self.tot, '; '.join(msgs))) |
| 45 | |
| 46 | |
| 47 | class Callbacks(Callback): |
no test coverage detected