[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [arm/master] Dropping the sysTools module
commit c419c030cf727d27b8eb10bcf3695aad19855f54
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date: Wed Jan 8 08:58:07 2014 -0800
Dropping the sysTools module
The last function of arm's sysTools module was getSysCpuUsage() which was
broken by our move to stem.
When we revise the header panel we'll need to address this by adding a wrapper
around stem's call() function to get its runtimes. For how just leaving this as
a todo note, though.
---
arm/headerPanel.py | 4 ++--
arm/util/sysTools.py | 29 -----------------------------
2 files changed, 2 insertions(+), 31 deletions(-)
diff --git a/arm/headerPanel.py b/arm/headerPanel.py
index 00796a1..158b826 100644
--- a/arm/headerPanel.py
+++ b/arm/headerPanel.py
@@ -28,7 +28,7 @@ import arm.starter
import arm.popups
import arm.controller
-from util import panel, sysTools, torTools, uiTools
+from util import panel, torTools, uiTools
# minimum width for which panel attempts to double up contents (two columns to
# better use screen real estate)
@@ -574,7 +574,7 @@ class HeaderPanel(panel.Panel, threading.Thread):
armCpuDelta = totalArmCpuTime - self._armCpuSampling[0]
armTimeDelta = currentTime - self._armCpuSampling[1]
pythonCpuTime = armCpuDelta / armTimeDelta
- sysCallCpuTime = sysTools.getSysCpuUsage()
+ sysCallCpuTime = 0.0 # TODO: add a wrapper around call() to get this
self.vals["stat/%armCpu"] = "%0.1f" % (100 * (pythonCpuTime + sysCallCpuTime))
self._armCpuSampling = (totalArmCpuTime, currentTime)
diff --git a/arm/util/sysTools.py b/arm/util/sysTools.py
deleted file mode 100644
index 668a56a..0000000
--- a/arm/util/sysTools.py
+++ /dev/null
@@ -1,29 +0,0 @@
-"""
-Helper functions for working with the underlying system.
-"""
-
-import time
-
-# Runtimes for system calls, used to estimate cpu usage. Entries are tuples of
-# the form:
-# (time called, runtime)
-RUNTIMES = []
-SAMPLING_PERIOD = 5 # time of the sampling period
-
-def getSysCpuUsage():
- """
- Provides an estimate of the cpu usage for system calls made through this
- module, based on a sampling period of five seconds. The os.times() function,
- unfortunately, doesn't seem to take popen calls into account. This returns a
- float representing the percentage used.
- """
-
- currentTime = time.time()
-
- # removes any runtimes outside of our sampling period
- while RUNTIMES and currentTime - RUNTIMES[0][0] > SAMPLING_PERIOD:
- RUNTIMES.pop(0)
-
- runtimeSum = sum([entry[1] for entry in RUNTIMES])
- return runtimeSum / SAMPLING_PERIOD
-
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits