summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Smith <jules@op59.net>2020-02-24 11:21:53 +0000
committerChris Liddell <chris.liddell@artifex.com>2020-02-26 08:18:49 +0000
commit60507d492507817bb5ae14a17a01d19c50d41e0a (patch)
tree950dd8b48806f3990882c25edb2c18980569b7f0
parent3a9ea36465e97ce729c5ab26dc8e0d1435b7b246 (diff)
downloadghostpdl-60507d492507817bb5ae14a17a01d19c50d41e0a.tar.gz
toolbin/squeeze2text.py: improve log output.
With -p, if there is gap in 'Memory squeezing @ <N>' output (because of calls to free()), output next <N>. Also flush log output to avoid looking like we've hung.
-rwxr-xr-xtoolbin/squeeze2text.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/toolbin/squeeze2text.py b/toolbin/squeeze2text.py
index 89e4db43b..6fa339089 100755
--- a/toolbin/squeeze2text.py
+++ b/toolbin/squeeze2text.py
@@ -57,11 +57,12 @@ if __name__ == '__main__':
# Use latin_1 encoding to ensure we can read all 8-bit bytes from stdin as
# characters.
f = io.TextIOWrapper( sys.stdin.buffer, encoding='latin_1')
+ progress_n_next = 0
for line in f:
m = re.match( '^Memory squeezing @ ([0-9]+)$', line)
if m:
memento_n = int( m.group(1))
- if memento_n % progress_n == 0:
+ if memento_n >= progress_n_next:
print( 'memento_n=%s. num_segv=%s num_leak=%s' % (
memento_n,
num_segv,
@@ -69,6 +70,8 @@ if __name__ == '__main__':
),
file=log,
)
+ progress_n_next = int(memento_n / progress_n + 1) * progress_n
+ log.flush() # Otherwise buffered and we see no output for ages.
if line.startswith( 'SEGV at:'):
num_segv += 1
print( 'memento_n=%s: segv' % memento_n, file=out)