| 552 | return None |
| 553 | |
| 554 | def localtrace_trace_and_count(self, frame, why, arg): |
| 555 | if why == "line": |
| 556 | # record the file name and line number of every trace |
| 557 | filename = frame.f_code.co_filename |
| 558 | lineno = frame.f_lineno |
| 559 | key = filename, lineno |
| 560 | self.counts[key] = self.counts.get(key, 0) + 1 |
| 561 | |
| 562 | if self.start_time: |
| 563 | print('%.2f' % (_time() - self.start_time), end=' ') |
| 564 | bname = os.path.basename(filename) |
| 565 | line = linecache.getline(filename, lineno) |
| 566 | print("%s(%d)" % (bname, lineno), end='') |
| 567 | if line: |
| 568 | print(": ", line, end='') |
| 569 | else: |
| 570 | print() |
| 571 | return self.localtrace |
| 572 | |
| 573 | def localtrace_trace(self, frame, why, arg): |
| 574 | if why == "line": |