##// END OF EJS Templates
perf: add a new "context" argument to timer...
marmoute -
r51569:28620be8 default
parent child Browse files
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,11 +557,13 b' def _timer('
551 557 for i in range(prerun):
552 558 if setup is not None:
553 559 setup()
560 with context():
554 561 func()
555 562 keepgoing = True
556 563 while keepgoing:
557 564 if setup is not None:
558 565 setup()
566 with context():
559 567 with profiler:
560 568 with timeone() as item:
561 569 r = func()
General Comments 0
You need to be logged in to leave comments. Login now