Show More
@@ -532,10 +532,16 b' DEFAULTLIMITS = (' | |||
|
532 | 532 | ) |
|
533 | 533 | |
|
534 | 534 | |
|
535 | @contextlib.contextmanager | |
|
536 | def noop_context(): | |
|
537 | yield | |
|
538 | ||
|
539 | ||
|
535 | 540 | def _timer( |
|
536 | 541 | fm, |
|
537 | 542 | func, |
|
538 | 543 | setup=None, |
|
544 | context=noop_context, | |
|
539 | 545 | title=None, |
|
540 | 546 | displayall=False, |
|
541 | 547 | limits=DEFAULTLIMITS, |
@@ -551,14 +557,16 b' def _timer(' | |||
|
551 | 557 | for i in range(prerun): |
|
552 | 558 | if setup is not None: |
|
553 | 559 | setup() |
|
554 | func() | |
|
560 | with context(): | |
|
561 | func() | |
|
555 | 562 | keepgoing = True |
|
556 | 563 | while keepgoing: |
|
557 | 564 | if setup is not None: |
|
558 | 565 | setup() |
|
559 |
with |
|
|
560 |
with |
|
|
561 |
|
|
|
566 | with context(): | |
|
567 | with profiler: | |
|
568 | with timeone() as item: | |
|
569 | r = func() | |
|
562 | 570 | profiler = NOOPCTX |
|
563 | 571 | count += 1 |
|
564 | 572 | results.append(item[0]) |
General Comments 0
You need to be logged in to leave comments.
Login now