ATLAS Offline Software
Classes | Functions | Variables
dso-stats Namespace Reference

Classes

class  Data
 

Functions

def getstatus (cmd)
 
def getoutput (cmd)
 
def _getpagesz ()
 
def parse_lib (lib)
 
def _frag (sz)
 
def _cleanname (name)
 
def _form (x)
 
def main ()
 

Variables

 PAGESIZE
 
 pat
 
 format
 

Function Documentation

◆ _cleanname()

def dso-stats._cleanname (   name)
private

Definition at line 57 of file dso-stats.py.

57 def _cleanname (name):
58  if name == 'None':
59  return 'None'
60  name = os.path.basename (name)
61  name = os.path.splitext(name)[0]
62  if name.startswith ('lib'):
63  name = name[3:]
64  return name
65 
66 

◆ _form()

def dso-stats._form (   x)
private

Definition at line 67 of file dso-stats.py.

67 def _form (x):
68  return int ((x+512) / 1024)
69 

◆ _frag()

def dso-stats._frag (   sz)
private

Definition at line 53 of file dso-stats.py.

53 def _frag (sz):
54  return ((sz + PAGESIZE-1) & (~(PAGESIZE-1))) - sz
55 
56 

◆ _getpagesz()

def dso-stats._getpagesz ( )
private

Definition at line 30 of file dso-stats.py.

30 def _getpagesz():
31  import resource
32  sz = resource.getpagesize()
33  del resource
34  return sz

◆ getoutput()

def dso-stats.getoutput (   cmd)

Definition at line 22 of file dso-stats.py.

22 def getoutput(cmd):
23  _,out = subprocess.getstatusoutput(cmd)
24  return out
25 subprocess.getoutput = getoutput

◆ getstatus()

def dso-stats.getstatus (   cmd)

Definition at line 16 of file dso-stats.py.

16 def getstatus(cmd):
17  sc,_ = subprocess.getstatusoutput(cmd)
18  return sc
19 subprocess.getstatus = getstatus

◆ main()

def dso-stats.main ( )

Definition at line 190 of file dso-stats.py.

190 def main():
191 
192  import optparse
193  parser = optparse.OptionParser(description="compile size statistics for shared libraries",
194  usage="%prog LIB [LIB...]")
195 
196  (opt, args) = parser.parse_args()
197  if len(args)==0:
198  parser.error("Invalid number of arguments specified")
199 
200  libs = []
201  total = Data(name = 'Total')
202  for lib in args:
203  secs = parse_lib(lib)
204  data = Data (secs, name = lib)
205  libs.append (data)
206  total += data
207  libs.sort (key = lambda x: x.total(), reverse=True)
208  kw = {'name' : 'Name',
209  'dso' : 'DSO',
210  'code' : 'Code',
211  'puredata': 'Pure',
212  'cpp' : 'C++',
213  'java' : 'Java',
214  'initdata': 'data',
215  'bss' : 'BSS',
216  'tbss' : 'TBSS',
217  'frag' : 'Frag',
218  'total': 'Total'}
219  print (format % kw, file=sys.stdout)
220  for l in libs:
221  l.dump (sys.stdout)
222  total.dump (sys.stdout)
223 
224  return 0
225 
226 

◆ parse_lib()

def dso-stats.parse_lib (   lib)

Definition at line 43 of file dso-stats.py.

43 def parse_lib (lib):
44  out = subprocess.getoutput ("objdump -h " + lib)
45  secs = []
46  for l in out.split ('\n'):
47  m = pat.match (l)
48  if m:
49  secs.append ((m.group(1), int(m.group(2), 16)))
50  return secs
51 
52 

Variable Documentation

◆ format

dso-stats.format

Definition at line 41 of file dso-stats.py.

◆ PAGESIZE

dso-stats.PAGESIZE

Definition at line 35 of file dso-stats.py.

◆ pat

dso-stats.pat

Definition at line 39 of file dso-stats.py.

dso-stats.getoutput
def getoutput(cmd)
Definition: dso-stats.py:22
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
dso-stats._form
def _form(x)
Definition: dso-stats.py:67
Data
@ Data
Definition: BaseObject.h:11
dso-stats.parse_lib
def parse_lib(lib)
Definition: dso-stats.py:43
dso-stats._getpagesz
def _getpagesz()
Definition: dso-stats.py:30
dso-stats.getstatus
def getstatus(cmd)
Definition: dso-stats.py:16
dso-stats._cleanname
def _cleanname(name)
Definition: dso-stats.py:57
dso-stats._frag
def _frag(sz)
Definition: dso-stats.py:53
dso-stats.main
def main()
Definition: dso-stats.py:190