Added more stats and fixed animations
They weren't cleared on reload via SIGUSR1
This commit is contained in:
parent
f5f58cfcd6
commit
d47ab01964
|
@ -59,6 +59,8 @@ class Manager:
|
||||||
|
|
||||||
print("Resetting shmem...")
|
print("Resetting shmem...")
|
||||||
self.shmem.buf[OFFSET_AVOID:] = bytes(500000 - OFFSET_AVOID)
|
self.shmem.buf[OFFSET_AVOID:] = bytes(500000 - OFFSET_AVOID)
|
||||||
|
self.animations = []
|
||||||
|
self.animation_functions = []
|
||||||
|
|
||||||
if fontconfig := settings.get("default_font"):
|
if fontconfig := settings.get("default_font"):
|
||||||
self.default_font_size = int(fontconfig.get("size", 8))
|
self.default_font_size = int(fontconfig.get("size", 8))
|
||||||
|
@ -265,6 +267,7 @@ class Manager:
|
||||||
assert self.shmem is not None
|
assert self.shmem is not None
|
||||||
print("Caught SIGUSR1, dumping state")
|
print("Caught SIGUSR1, dumping state")
|
||||||
buf = bytes(self.shmem.buf[:])
|
buf = bytes(self.shmem.buf[:])
|
||||||
|
print("# Dumping state.png")
|
||||||
with Image.new("RGB", (1000, 1000), 0) as im:
|
with Image.new("RGB", (1000, 1000), 0) as im:
|
||||||
for i in range(1000000):
|
for i in range(1000000):
|
||||||
y, x = divmod(i, 1000)
|
y, x = divmod(i, 1000)
|
||||||
|
@ -282,6 +285,7 @@ class Manager:
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
im.save("state.png")
|
im.save("state.png")
|
||||||
|
print("# Dumping avoid.png")
|
||||||
with Image.new("L", (1000, 1000), 0) as im:
|
with Image.new("L", (1000, 1000), 0) as im:
|
||||||
for i in range(1000000):
|
for i in range(1000000):
|
||||||
y, x = divmod(i, 1000)
|
y, x = divmod(i, 1000)
|
||||||
|
@ -291,6 +295,19 @@ class Manager:
|
||||||
255 if (buf[OFFSET_AVOID + byte] << bit) & 0x80 else 0,
|
255 if (buf[OFFSET_AVOID + byte] << bit) & 0x80 else 0,
|
||||||
)
|
)
|
||||||
im.save("avoid.png")
|
im.save("avoid.png")
|
||||||
|
print(f"# Animations {len(self.animations)}")
|
||||||
|
for anim in self.animations:
|
||||||
|
frame = int(time.time() / anim.spf) % len(anim.frames)
|
||||||
|
print(
|
||||||
|
str.format(
|
||||||
|
"X: {:4d} Y: {:4d} Frames: {:3d} S/F: {:4.1f} Frame: {:d}",
|
||||||
|
anim.x,
|
||||||
|
anim.y,
|
||||||
|
len(anim.frames),
|
||||||
|
anim.spf,
|
||||||
|
frame,
|
||||||
|
)
|
||||||
|
)
|
||||||
print("Dump done")
|
print("Dump done")
|
||||||
|
|
||||||
def on_sigusr2(self, signum, frame):
|
def on_sigusr2(self, signum, frame):
|
||||||
|
|
Loading…
Reference in New Issue