[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] r22622: {arm} added: logging refresh rate metric (in arm/trunk: . interface)
Author: atagar
Date: 2010-07-09 15:51:08 +0000 (Fri, 09 Jul 2010)
New Revision: 22622
Modified:
arm/trunk/armrc.sample
arm/trunk/interface/controller.py
Log:
added: logging refresh rate metric
Modified: arm/trunk/armrc.sample
===================================================================
--- arm/trunk/armrc.sample 2010-07-09 01:55:22 UTC (rev 22621)
+++ arm/trunk/armrc.sample 2010-07-09 15:51:08 UTC (rev 22622)
@@ -6,6 +6,7 @@
startup.events N3
features.colorInterface true
+features.logRefreshRate 5
# general graph parameters
# interval: 0 -> each second, 1 -> 5 seconds, 2 -> 30 seconds,
@@ -59,6 +60,7 @@
cache.armLog.trimSize 200
# runlevels at which to log arm related events
+log.refreshRate DEBUG
log.configEntryNotFound NONE
log.configEntryUndefined NOTICE
log.configEntryTypeError NOTICE
Modified: arm/trunk/interface/controller.py
===================================================================
--- arm/trunk/interface/controller.py 2010-07-09 01:55:22 UTC (rev 22621)
+++ arm/trunk/interface/controller.py 2010-07-09 15:51:08 UTC (rev 22622)
@@ -42,7 +42,7 @@
["torrc"]]
PAUSEABLE = ["header", "graph", "log", "conn"]
-CONFIG = {"features.graph.type": 1, "features.graph.bw.prepopulate": True, "log.configEntryUndefined": log.NOTICE}
+CONFIG = {"features.logRefreshRate": 5, "features.graph.type": 1, "features.graph.bw.prepopulate": True, "log.refreshRate": log.DEBUG, "log.configEntryUndefined": log.NOTICE}
class ControlPanel(panel.Panel):
""" Draws single line label for interface controls. """
@@ -439,6 +439,9 @@
for key in config.getUnusedKeys():
log.log(CONFIG["log.configEntryUndefined"], "unrecognized configuration entry: %s" % key)
+ lastPerformanceLog = 0 # ensures we don't do performance logging too frequently
+ redrawStartTime = time.time()
+
# TODO: popups need to force the panels it covers to redraw (or better, have
# a global refresh function for after changing pages, popups, etc)
while True:
@@ -448,6 +451,8 @@
panel.CURSES_LOCK.acquire()
try:
+ redrawStartTime = time.time()
+
# if sighup received then reload related information
if sighupTracker.isReset:
#panels["header"]._updateParams(True)
@@ -517,6 +522,11 @@
panels[panelKey].redraw(True)
stdscr.refresh()
+
+ currentTime = time.time()
+ if currentTime - lastPerformanceLog >= CONFIG["features.logRefreshRate"]:
+ log.log(CONFIG["log.refreshRate"], "refresh rate: %0.3f seconds" % (currentTime - redrawStartTime))
+ lastPerformanceLog = currentTime
finally:
panel.CURSES_LOCK.release()