Sections
Timeline
View Tickets
New Ticket
Sub-Sections
Download
Unified Diff
Zip Archive
Metanav
Preferences
About Trac
Links
Slowchop Studios
Gerald Kaszuba
Advertisement

Changeset 9

Show
Ignore:
Timestamp:
10/02/07 03:10:26 (22 months ago)
Author:
gak
Message:
 
Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/pycallgraph.py

    r8 r9  
    4444} 
    4545settings = { 
     46   'node_attributes': { 
     47       'label': r'%(func)s\ncalls: %(hits)i', 
     48       'color': '%(col)s', 
     49    }, 
    4650    'node_color': lambda calls, : '%f %f %f' % (calls / 2 + .5, calls, 0.9), 
    4751    'edge_color': lambda calls, : '%f %f %f' % (calls / 2 + .5, calls, 0.7), 
     
    98102            else: 
    99103                if class_name in settings['exclude_class']: 
    100                     print 'exclude_class', class_name 
    101104                    dont_keep = True 
    102105            class_name += '.' 
     
    155158        frac = float(hits) / func_count_max  
    156159        col = settings['node_color'](frac) 
    157         grp = func.split('.', 1)[0] 
    158         #ret.append('"%(func)s" [label="%(func)s\\n%(hits)i calls", color = "%(col)s", group = "%(grp)s"]' % locals()) 
    159         ret.append('"%(func)s" [label="%(func)s\\ncalls: %(hits)i", color = "%(col)s"]' % locals()) 
     160        attribs = ['%s="%s"' % a for a in settings['node_attributes'].items()] 
     161        node_str = '"%s" [%s];' % (func, ','.join(attribs)) 
     162        ret.append(node_str % locals()) 
    160163    for fr_key, fr_val in call_dict.items(): 
    161164        if fr_key == '': 
     
    167170            ret.append('"%s"->"%s" %s' % (fr_key, to_key, edge)) 
    168171    ret.append('}') 
    169     print '\n'.join(ret) 
    170172    return '\n'.join(ret) 
    171173