aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/klippy.py
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2018-09-02 13:07:43 -0400
committerKevin O'Connor <kevin@koconnor.net>2018-09-02 13:46:19 -0400
commit8fe8a6deb3b7ea3eca8730d5b1500c2c27c251cd (patch)
treee9dee0f04913f7f4bb1baff0cc532ee819e98300 /klippy/klippy.py
parent18b04ffe6815987284130337e5eb4f46f3ba1c69 (diff)
downloadkutter-8fe8a6deb3b7ea3eca8730d5b1500c2c27c251cd.tar.gz
kutter-8fe8a6deb3b7ea3eca8730d5b1500c2c27c251cd.tar.xz
kutter-8fe8a6deb3b7ea3eca8730d5b1500c2c27c251cd.zip
statistics: Move stats handling to new "extras" module
Move the generation of statistics to its own module. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy/klippy.py')
-rw-r--r--klippy/klippy.py15
1 files changed, 1 insertions, 14 deletions
diff --git a/klippy/klippy.py b/klippy/klippy.py
index d5dc8dae..37c28ff3 100644
--- a/klippy/klippy.py
+++ b/klippy/klippy.py
@@ -135,12 +135,10 @@ class Printer:
self.reactor = reactor.Reactor()
gc = gcode.GCodeParser(self, input_fd)
self.objects = collections.OrderedDict({'gcode': gc})
- self.stats_timer = self.reactor.register_timer(self._stats)
self.reactor.register_callback(self._connect)
self.state_message = message_startup
self.is_shutdown = False
self.run_result = None
- self.stats_cb = []
self.state_cb = []
def get_start_args(self):
return self.start_args
@@ -177,12 +175,6 @@ class Printer:
logging.info(info)
if self.bglogger is not None:
self.bglogger.set_rollover_info(name, info)
- def _stats(self, eventtime, force_output=False):
- stats = [cb(eventtime) for cb in self.stats_cb]
- if max([s[0] for s in stats] + [force_output]):
- logging.info("Stats %.1f: %s", eventtime,
- ' '.join([s[1] for s in stats]))
- return eventtime + 1.
def try_load_module(self, config, section):
if section in self.objects:
return self.objects[section]
@@ -233,9 +225,7 @@ class Printer:
raise self.config_error(
"Option '%s' is not valid in section '%s'" % (
option, section))
- # Determine which printer objects have stats/state callbacks
- self.stats_cb = [o.stats for o in self.objects.values()
- if hasattr(o, 'stats')]
+ # Determine which printer objects have state callbacks
self.state_cb = [o.printer_state for o in self.objects.values()
if hasattr(o, 'printer_state')]
def _connect(self, eventtime):
@@ -250,8 +240,6 @@ class Printer:
if self.state_message is not message_ready:
return self.reactor.NEVER
cb('ready')
- if self.start_args.get('debugoutput') is None:
- self.reactor.update_timer(self.stats_timer, self.reactor.NOW)
except (self.config_error, pins.error) as e:
logging.exception("Config error")
self._set_state("%s%s" % (str(e), message_restart))
@@ -281,7 +269,6 @@ class Printer:
# Check restart flags
run_result = self.run_result
try:
- self._stats(self.reactor.monotonic(), force_output=True)
if run_result == 'firmware_restart':
for n, m in self.lookup_objects(module='mcu'):
m.microcontroller_restart()