coriolis/bootstrap/sprof.py

38 lines
989 B
Python
Raw Normal View History

Anabatic transient commit 8. More Dijkstra bugs correcteds. * Bug: In Anabatic: - In _propagate(), on reaching a target, forgot to remove it from the queue before pushing it back with the new distance. It also simplificate the core algorithm as target as treated normal nodes. * New: In Anabatic: - Update cdebug to use the fastest macro version. - More readable drawings of GCells and Edges. - Added timer support. - The distance is now computed in DbU::Unit (aka long) and not in normalized float. - The distance function is now a callback (std::function<>) that can be changed (a default is provided at initialization). - New concept of branch in the agglomerated connex component. Each trace back part create a "branch" (tagged with a "branchId"). When a node is reached with the same distance, but from two different branches, choose the the branch that was lastly created. This create a slightly different tree which grows outward from the newest branches. - Makes the horizontal edges *slightly* longer than the vertical ones to skew the tree to use vertical edges, as it is usually less congested than the horiontal one (due to metal1 cell terminals). It is also my understanding that it is useful to reduce the number of vias, whithout introducing a via cost. * New: In Bootstrap: - Script sprof.py to perform sprof & demangle libraries execution profile. * ToDo: In Anabatic: - Corner optimization. Sometimes when two corners are possible, the wrong one is choosen. That is, one of it's edge cannot be used for further grow of the tree.
2016-06-17 06:09:34 -05:00
#!/usr/bin/env python
import sys
import os.path
import subprocess
import re
reSymbol = re.compile(r'(?P<head>.*)(?P<symbol>_Z\w+)(?P<tail>.*)')
soPathName = sys.argv[1]
soFileName = os.path.basename( soPathName )
profName = soFileName + '.profile'
if not os.path.isfile(profName):
print '[ERROR] No profile datas <%s>.' % profName
sys.exit( 1 )
sprof = subprocess.Popen ( ['sprof'
, soPathName
, profName ]
, stdout=subprocess.PIPE )
for line in sprof.stdout.readlines():
m = reSymbol.match( line[:-1] )
if m:
cppfilt = subprocess.Popen ( ['c++filt'
, '--no-verbose'
, '--no-params'
, m.group('symbol')]
, stdout=subprocess.PIPE )
symbol = cppfilt.stdout.readlines()[0][:-1]
print m.group('head'), symbol
else:
print line[:-1]
sys.exit( 0 )