PATCH: lsprof.py RuntimeError

Matt Mackall mpm at selenic.com
Wed Jul 29 21:41:11 UTC 2009


On Wed, 2009-07-29 at 18:20 -0300, Alejandro Santos wrote:
> On Wed, Jul 29, 2009 at 5:57 PM, Matt Mackall<mpm at selenic.com> wrote:
> > On Wed, 2009-07-29 at 17:33 -0300, Alejandro Santos wrote:
> >> diff -r 1eed391889f4 -r d1d8947179b7 mercurial/lsprof.py
> >> --- a/mercurial/lsprof.py     Wed Jul 29 00:20:28 2009 -0300
> >> +++ b/mercurial/lsprof.py     Wed Jul 29 17:29:52 2009 -0300
> >> @@ -85,7 +85,20 @@
> >>      try:
> >>          mname = _fn2mod[code.co_filename]
> >>      except KeyError:
> >> -        for k, v in sys.modules.iteritems():
> >> +        # Force the complete load of all the lazy and on demand modules by
> >> +        # querying one of the module's attribute.
> >
> > Why is this necessary? If we didn't load it already, why is it
> > interesting to the profiler?
> 
> Let's assume that module a imports b, b imports c and c imports d.
> 
> If module b or c are loaded lazily or on demand, the profiler will
> have no knowledge about the last module d.

Obviously. But if that's the case, that also means that none of the code
in d was ever executed. So again, why does the profiler care?

-- 
http://selenic.com : development and support for Mercurial and Linux





More information about the Mercurial-devel mailing list