upload android base code part6
This commit is contained in:
parent
421e214c7d
commit
4e516ec6ed
35396 changed files with 9188716 additions and 0 deletions
35
android/system/extras/tests/workloads/atrace-uncompress.py
Normal file
35
android/system/extras/tests/workloads/atrace-uncompress.py
Normal file
|
@ -0,0 +1,35 @@
|
|||
#
|
||||
# Uncompress a file generated via atrace -z
|
||||
#
|
||||
# Usage: python atrace-uncompress.py infile > outfile
|
||||
#
|
||||
import sys, zlib
|
||||
|
||||
def main():
|
||||
|
||||
if len(sys.argv) != 2:
|
||||
print >> sys.stderr, ('Usage: %s inputfile' % sys.argv[0])
|
||||
sys.exit(1)
|
||||
|
||||
infile = open(sys.argv[1], "rb")
|
||||
out = infile.read()
|
||||
parts = out.split('\nTRACE:', 1)
|
||||
|
||||
data = ''.join(parts[1])
|
||||
|
||||
# Remove CR characters
|
||||
if data.startswith('\r\n'):
|
||||
data = data.replace('\r\n', '\n')
|
||||
|
||||
# Skip the initial newline.
|
||||
data = data[1:]
|
||||
|
||||
if not data:
|
||||
print >> sys.stderr, ('No trace data found')
|
||||
sys.exit(1)
|
||||
|
||||
out = zlib.decompress(data)
|
||||
print(out)
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
Loading…
Add table
Add a link
Reference in a new issue