aboutsummaryrefslogtreecommitdiff
path: root/gen/prop/lib.py
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2024-04-30 19:36:54 +0200
committerThomas Voss <mail@thomasvoss.com> 2024-04-30 19:36:54 +0200
commit5d5b627f8104a9f43d3e1536a6b460d98cb4cb60 (patch)
tree162d51b12df5d2b6332cf8aeb9c0e40e645da0ec /gen/prop/lib.py
parent08b8a6d6b483ecf2c5b0b0dcc3c6d706d441936b (diff)
Report change in table size
Diffstat (limited to 'gen/prop/lib.py')
-rw-r--r--gen/prop/lib.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/gen/prop/lib.py b/gen/prop/lib.py
index e71fcf0..cc0b00a 100644
--- a/gen/prop/lib.py
+++ b/gen/prop/lib.py
@@ -52,3 +52,16 @@ def typename(x: int) -> str:
def cwd_init() -> None:
dir = Path(os.path.dirname(sys.argv[0]))
os.chdir(dir / '..' / '..')
+
+def report_size(before: int, after: int) -> None:
+ def btokib(n: int) -> str:
+ s = str(round(n / 1024, 2))
+ if s.endswith('.0'):
+ s = s[:-2]
+ return s + ' KiB'
+
+ prefix = sys.argv[0].split('/')[-1]
+ change = round((after - before) / before * 100, 1)
+ before = btokib(before)
+ after = btokib(after)
+ print(f'%s\t%s%%\t%s → %s' % (prefix, change, before, after), file=sys.stderr)