/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/lsprof.py

  • Committer: Ian Clatworthy
  • Date: 2007-09-10 02:40:07 UTC
  • mto: (2818.1.1 ianc-integration)
  • mto: This revision was merged to the branch mainline in revision 2819.
  • Revision ID: ian.clatworthy@internode.on.net-20070910024007-qeqapxc91bqwhe0q
Dump profiling data even when exceptions are encountered

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
    p = Profiler()
32
32
    p.enable(subcalls=True)
33
33
    threading.setprofile(_thread_profile)
 
34
    # Note: The except clause is needed below so that profiling data still
 
35
    # gets dumped even when exceptions are encountered. The except clause code
 
36
    # is taken straight from run_bzr_catch_errrors() in commands.py and ought
 
37
    # to be kept in sync with it.
34
38
    try:
35
39
        ret = f(*args, **kwds)
 
40
    except (KeyboardInterrupt, Exception), e:
 
41
        import bzrlib.trace
 
42
        bzrlib.trace.report_exception(sys.exc_info(), sys.stderr)
 
43
        ret = 3
36
44
    finally:
37
45
        p.disable()
38
46
        for pp in _g_threadmap.values():