def ex(cmd):
    return subprocess.Popen(['bash', '-c', cmd],
                            stdout=subprocess.PIPE).communicate()[0]


if len(sys.argv) > 1:
    if sys.argv[1] == '-':
        data = sys.stdin.readlines()
    else:
        data = file(sys.argv[1]).readlines()
else:
    data = file('sim_timers.out').readlines()

addr2line.set_rdtsc(long(data[0]))

data = [
    map(long,
        line.split()[:4]) +
    [map(long,
         line.split()[4:10]),
     line.split(' ', 10)[10].strip()] for line in data[1:]
]
data.sort(key=lambda line: line[0], reverse=True)

height, width = ex('stty size').split()
width = int(width)
if width < 120:
    width = 2 * width  # if we're line-wrapping anyway: use 2 full lines
Example #2
0
#!/usr/bin/env python

import sys, os, subprocess, addr2line

def ex(cmd):
  return subprocess.Popen([ 'bash', '-c', cmd ], stdout = subprocess.PIPE).communicate()[0]

if len(sys.argv) > 1:
  if sys.argv[1] == '-':
    data = sys.stdin.readlines()
  else:
    data = file(sys.argv[1]).readlines()
else:
  data = file('sim_timers.out').readlines()

addr2line.set_rdtsc(long(data[0]))

data = [ map(long, line.split()[:4]) + [ map(long, line.split()[4:10]), line.split(' ', 10)[10].strip() ] for line in data[1:] ]
data.sort(key = lambda line: line[0], reverse = True)

height, width = ex('stty size').split()
width = int(width)
if width < 120:
  width = 2*width # if we're line-wrapping anyway: use 2 full lines

for line in data[:15]:
  total, n, max, n_switched, trace, name = line
  result = '%6.1f s, %8u calls, avg %5.0f us/call, max %5.1f ms, switched = %.3f%% (%3u) ' % \
      (total / 1e9, n, total / (n or 1) / 1e3, max / 1e6, 100. * n_switched / (n or 1), n_switched)
  print '%-85s %s' % (result, name)
  for a in trace[1:6]:
Example #3
0
import sys, addr2line, subprocess

def ex(cmd):
  return subprocess.Popen([ 'bash', '-c', cmd ], stdout = subprocess.PIPE).communicate()[0]


if len(sys.argv) > 1:
  if sys.argv[1] == '-':
    data = sys.stdin.readlines()
  else:
    data = file(sys.argv[1]).xreadlines()
else:
  data = file('allocations.out').xreadlines()

addr2line.set_rdtsc(long(data.next()))

allocations = {}
for line in data:
  l = line.split()
  site, size, count = tuple(map(long, l[:-2])), long(l[-2]), long(l[-1])
  if site not in allocations:
    allocations[site] = [0, 0]
  allocations[site][0] += size
  allocations[site][1] += count

allocations = allocations.items()
allocations.sort(key = lambda (site, (size, count)): size, reverse = True)


height, width = ex('stty size').split()
Example #4
0

def ex(cmd):
    return subprocess.Popen(['bash', '-c', cmd],
                            stdout=subprocess.PIPE).communicate()[0]


if len(sys.argv) > 1:
    if sys.argv[1] == '-':
        data = sys.stdin.readlines()
    else:
        data = file(sys.argv[1]).xreadlines()
else:
    data = file('allocations.out').xreadlines()

addr2line.set_rdtsc(long(data.next()))

allocations = {}
for line in data:
    l = line.split()
    site, size, count = tuple(map(long, l[:-2])), long(l[-2]), long(l[-1])
    if site not in allocations:
        allocations[site] = [0, 0]
    allocations[site][0] += size
    allocations[site][1] += count

allocations = allocations.items()
allocations.sort(key=lambda (site, (size, count)): size, reverse=True)

height, width = ex('stty size').split()
width = int(width)