mirror of
https://github.com/nicolargo/glances.git
synced 2024-12-27 03:04:16 +03:00
Rename GlancesGrabProcesses to glancesProcesses
This commit is contained in:
parent
fc3a9d5df1
commit
e8e2eee531
@ -18,7 +18,24 @@
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import time
|
||||
from time import time
|
||||
|
||||
# Global list to manage the elapsed time
|
||||
last_update_times = {}
|
||||
|
||||
|
||||
def getTimeSinceLastUpdate(IOType):
|
||||
global last_update_times
|
||||
# assert(IOType in ['net', 'disk', 'process_disk'])
|
||||
current_time = time()
|
||||
last_time = last_update_times.get(IOType)
|
||||
if not last_time:
|
||||
time_since_update = 1
|
||||
else:
|
||||
time_since_update = current_time - last_time
|
||||
last_update_times[IOType] = current_time
|
||||
return time_since_update
|
||||
|
||||
|
||||
class Timer:
|
||||
"""
|
||||
@ -31,7 +48,7 @@ class Timer:
|
||||
self.start()
|
||||
|
||||
def start(self):
|
||||
self.target = time.time() + self.duration
|
||||
self.target = time() + self.duration
|
||||
|
||||
def reset(self):
|
||||
self.start()
|
||||
@ -40,5 +57,5 @@ class Timer:
|
||||
self.duration = duration
|
||||
|
||||
def finished(self):
|
||||
return time.time() > self.target
|
||||
return time() > self.target
|
||||
|
||||
|
@ -18,11 +18,12 @@
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Import system lib
|
||||
from psutil import process_iter, AccessDenied, NoSuchProcess
|
||||
|
||||
# Import Glances lib
|
||||
from glances.core.glances_globals import is_BSD, is_Mac, is_Windows
|
||||
from glances_plugin import getTimeSinceLastUpdate
|
||||
from glances.core.glances_timer import Timer
|
||||
from glances.core.glances_timer import Timer, getTimeSinceLastUpdate
|
||||
|
||||
|
||||
class glancesProcesses:
|
||||
|
@ -25,7 +25,9 @@ try:
|
||||
except:
|
||||
pass
|
||||
|
||||
from glances_plugin import GlancesPlugin, getTimeSinceLastUpdate
|
||||
# Import Glances lib
|
||||
from glances_plugin import GlancesPlugin
|
||||
from glances.core.glances_timer import getTimeSinceLastUpdate
|
||||
|
||||
|
||||
class Plugin(GlancesPlugin):
|
||||
|
@ -23,7 +23,9 @@ from psutil import disk_io_counters
|
||||
|
||||
# Import Glances lib
|
||||
from glances.core.glances_globals import is_Mac
|
||||
from glances_plugin import GlancesPlugin, getTimeSinceLastUpdate
|
||||
from glances_plugin import GlancesPlugin
|
||||
from glances.core.glances_timer import getTimeSinceLastUpdate
|
||||
|
||||
|
||||
class Plugin(GlancesPlugin):
|
||||
"""
|
||||
|
@ -21,7 +21,10 @@
|
||||
# Import system libs
|
||||
import socket
|
||||
|
||||
from glances_plugin import GlancesPlugin, getTimeSinceLastUpdate
|
||||
# Import Glances lib
|
||||
from glances_plugin import GlancesPlugin
|
||||
from glances.core.glances_timer import getTimeSinceLastUpdate
|
||||
|
||||
|
||||
class Plugin(GlancesPlugin):
|
||||
"""
|
||||
|
@ -31,8 +31,10 @@ except:
|
||||
except:
|
||||
pass
|
||||
|
||||
# from ..plugins.glances_plugin import GlancesPlugin
|
||||
from glances_plugin import GlancesPlugin, getTimeSinceLastUpdate
|
||||
# Import Glances lib
|
||||
from glances_plugin import GlancesPlugin
|
||||
from glances.core.glances_timer import getTimeSinceLastUpdate
|
||||
|
||||
|
||||
class Plugin(GlancesPlugin):
|
||||
"""
|
||||
|
@ -26,8 +26,11 @@ try:
|
||||
except:
|
||||
pass
|
||||
|
||||
from glances_plugin import GlancesPlugin, getTimeSinceLastUpdate
|
||||
# Import Glances lib
|
||||
from glances_hddtemp import Plugin as HddTempPlugin
|
||||
from glances_plugin import GlancesPlugin
|
||||
from glances.core.glances_timer import getTimeSinceLastUpdate
|
||||
|
||||
|
||||
|
||||
class glancesGrabSensors:
|
||||
|
Loading…
Reference in New Issue
Block a user