~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to profile_imports.py

  • Committer: John Arbash Meinel
  • Date: 2006-10-13 07:22:23 UTC
  • mfrom: (2076 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2077.
  • Revision ID: john@arbash-meinel.com-20061013072223-9d1320456e7df776
[merge] bzr.dev 2076

Show diffs side-by-side

added added

removed removed

Lines of Context:
82
82
        # scope_name, frame_name, frame_lineno
83
83
        out_file.write('%5.1f %5.1f %s %-35s\t@ %s:%d\n'
84
84
            % (info[-1]*1000., mod_time*1000., '+'*info[0], 
85
 
               cur[1][:40], info[1], info[2]))
 
85
               cur[1][:35], info[1], info[2]))
86
86
 
87
87
        if sorted:
88
88
            c_times.sort()
117
117
    extra = ''
118
118
    if frame_name.endswith('demandload'):
119
119
        # If this was demandloaded, we have 3 frames to ignore
120
 
        extra = ' (demandload)'
 
120
        extra = '(demandload) '
121
121
        frame = sys._getframe(4)
122
122
        frame_name = frame.f_globals.get('__name__', '<unknown>')
123
123
    elif frame_name.endswith('lazy_import'):
124
124
        # If this was lazily imported, we have 3 frames to ignore
125
 
        extra = ' (lazy)'
 
125
        extra = '[l] '
126
126
        frame = sys._getframe(4)
127
127
        frame_name = frame.f_globals.get('__name__', '<unknown>')
 
128
    if fromlist:
 
129
        extra += ' [%s]' % (', '.join(map(str, fromlist)),)
128
130
    frame_lineno = frame.f_lineno
129
131
 
130
 
    this = stack_add(name+extra, frame_name, frame_lineno, scope_name)
 
132
    this = stack_add(extra + name, frame_name, frame_lineno, scope_name)
131
133
 
132
134
    tstart = time.time()
133
135
    try:
148
150
    # And who is requesting this?
149
151
    frame = sys._getframe(2)
150
152
    frame_name = frame.f_globals.get('__name__', '<unknown>')
 
153
 
 
154
    extra = ''
 
155
    if frame_name.endswith('lazy_regex'):
 
156
        # If this was lazily compiled, we have 3 more frames to ignore
 
157
        extra = '[l] '
 
158
        frame = sys._getframe(5)
 
159
        frame_name = frame.f_globals.get('__name__', '<unknown>')
151
160
    frame_lineno = frame.f_lineno
152
 
 
153
 
    this = stack_add(repr(args[0]), frame_name, frame_lineno)
 
161
    this = stack_add(extra+repr(args[0]), frame_name, frame_lineno)
154
162
 
155
163
    tstart = time.time()
156
164
    try: