diff options
| author | The Android Open Source Project <initial-contribution@android.com> | 2009-03-03 18:28:16 -0800 |
|---|---|---|
| committer | The Android Open Source Project <initial-contribution@android.com> | 2009-03-03 18:28:16 -0800 |
| commit | d4aee0c0caa00aa02d4c50ed28151591ac0456b5 (patch) | |
| tree | 4b825dc642cb6eb9a060e54bf8d69288fbee4904 /tools/axl/chewperf.py | |
| parent | d2f2b1d7b77d06bce8cf9340171cf6c25cd720c4 (diff) | |
auto import from //depot/cupcake/@135843
Diffstat (limited to 'tools/axl/chewperf.py')
| -rwxr-xr-x | tools/axl/chewperf.py | 87 |
1 files changed, 0 insertions, 87 deletions
diff --git a/tools/axl/chewperf.py b/tools/axl/chewperf.py deleted file mode 100755 index 582bdb5ac..000000000 --- a/tools/axl/chewperf.py +++ /dev/null @@ -1,87 +0,0 @@ -#!/usr/bin/env python - -""" - chewperf.py: Chew an http perf log - bucketize - -""" - -import sys, time - -def resets(): - f = open(sys.argv[1]).read() - rawLines = f.split('\n') - - times = [] - for x in range(len(rawLines)): - line = rawLines[x].split() - try: - if line[-1] == "SIGNAL_STRENGTH": - ts = int(rawLines[x - 1].split()[-1]) - times.append(ts) - except: - pass - - return times - -def augment(): - f = open(sys.argv[1]).read() - rawLines = f.split('\r\n') - - out = [] - t0 = None - last = 0 - for line in rawLines: - if "Pulled" in line: - chewed = [int(line.split()[5]), int(line.split()[7])] - if not t0: t0 = chewed[1] - tm = chewed[1] - t0 - out.append("%s %d" % (line, (tm - last))) - last = tm - else: - out.append(line) - print "\n".join(out) - -def chew(): - f = open(sys.argv[1]).read() - rawLines = f.split('\n') - lines = [x for x in rawLines if "Pulled" in x] - - sidx = lines[0].split().index("Pulled") - print "sidx", sidx - chewed = [[int(x.split()[sidx + 2]), int(x.split()[sidx + 4])] for x in lines] - - t0 = chewed[0][1] - tLast = chewed[-1][1] - chewed = [[x[1] - t0, x[0]] for x in chewed] - - totalTime = tLast - t0 - bytes = sum(x[1] for x in chewed) - print "total time", totalTime, "bytes", bytes, "rate", bytes * 1000 / totalTime - - buckets = {} - for x in chewed: - bucket = x[0] / 1000 - bytes = x[1] - if bucket in buckets: - buckets[bucket] += bytes - else: - buckets[bucket] = bytes - - top = max(buckets.keys()) - for x in range(top): - if x not in buckets.keys(): - buckets[x] = 0 - - # smooth - window = [0 for x in range(5)] - - for x in range(len(buckets.items())): - window[x % len(window)] = buckets.items()[x][1] - print "%s\t%s" % (buckets.items()[x][0], sum(window) / len(window)) - -def main(): - chew() - -if __name__ == '__main__': - main() |
