aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Oliver <contact@pauloliver.dev>2024-02-29 02:29:13 +0100
committerPaul Oliver <contact@pauloliver.dev>2024-02-29 02:29:13 +0100
commit39abbc1596fde561111ce388f01e727452cdab96 (patch)
tree51c6b076182d9aba490ff2c5b1991f3f8bd1b773
parent7c5045d4d0da298f7f129ed580b69983342ac68e (diff)
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.
-rw-r--r--.gitignore2
-rwxr-xr-xbin/salis.py9
2 files changed, 7 insertions, 4 deletions
diff --git a/.gitignore b/.gitignore
index ee01acd..69cc08f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,6 +3,6 @@ bin/common/pipe
bin/error.log
bin/lib/libsalis.so
bin/sims/*.sim
-bin/sims/auto/*.auto
+bin/sims/auto/*.auto.gz
build/*.d
build/*.o
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/<file-name>.<sim-epoch>.<sim-cycle>.auto
+ >>> ./sims/auto/<file-name>.<sim-epoch>.<sim-cycle>.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.