| 11 | from pycgraph import GAspect, CStatus |
| 12 | |
| 13 | class MyTimerAspect(GAspect): |
| 14 | _start_time = None |
| 15 | |
| 16 | def beginRun(self): |
| 17 | self._start_time = time.time() |
| 18 | return CStatus() |
| 19 | |
| 20 | def finishRun(self, curStatus: CStatus): |
| 21 | span = time.time() - self._start_time |
| 22 | print('----> [MyTimerAspect] {0} time cost is : {1}s'.format(self.getName(), round(span, 2))) |
| 23 | return |