Created
September 6, 2017 23:54
-
-
Save luser/99cbcb8c68bdd3d606e827f40321668a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import fileinput | |
import re | |
r = re.compile('^\s*\d+\s*([^\s]+)') | |
rsp_r = re.compile('rsp\s=\s(0x[a-f0-9]+)') | |
prev_fn = None | |
this_fn = None | |
prev_rsp = None | |
for line in fileinput.input(): | |
m = r.match(line) | |
if m: | |
prev_fn = this_fn | |
this_fn = m.group(1) | |
else: | |
m = rsp_r.search(line) | |
if m: | |
rsp = int(m.group(1), 16) | |
if prev_rsp is not None: | |
size = rsp - prev_rsp | |
print '%d %s' % (size, prev_fn) | |
prev_fn = this_fn | |
prev_rsp = rsp |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment