From 39abbc1596fde561111ce388f01e727452cdab96 Mon Sep 17 00:00:00 2001 From: Paul Oliver Date: Thu, 29 Feb 2024 02:29:13 +0100 Subject: Auto saved files are now gzipped. [#8] We compress all auto saved files via a subprocess call to 'gzip'. Saved files are reduced to around 25% of their original size. --- bin/salis.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'bin') diff --git a/bin/salis.py b/bin/salis.py index 25c6526..3e3bacc 100755 --- a/bin/salis.py +++ b/bin/salis.py @@ -25,6 +25,7 @@ from argparse import ArgumentParser, HelpFormatter from ctypes import CDLL, c_bool, c_uint8, c_uint32, c_char_p, POINTER from handler import Handler from printer import Printer +from subprocess import check_call __version__ = "2.0" @@ -128,10 +129,11 @@ class Salis: self.autosave = interval def check_autosave(self): - """ Save simulation to './sims/auto/*' whenever the autosave interval - is reached. We use the following naming convention for auto-saved files: + """ Save compressed simulation file to './sims/auto/*' whenever the + autosave interval is reached. We use the following naming convention + for auto-saved files: - >>> ./sims/auto/...auto + >>> ./sims/auto/...auto.gz """ if self.autosave != "---": if not self.lib.sal_main_get_cycle() % self.autosave: @@ -142,6 +144,7 @@ class Salis: "auto" ])) self.lib.sal_main_save(auto_path.encode("utf-8")) + check_call(["gzip", auto_path]) def exit(self): """ Signal we want to exit the simulator. -- cgit v1.2.1