Exemple #1
0
 def __startReportToMonitoring(self):
     now = time.time()
     stats = os.times()
     cpuTime = stats[0] + stats[2]
     mem = None
     if now - self.__monitorLastStatsUpdate < 0:
         return (now, cpuTime, mem)
     self.__monitorLastStatsUpdate = now
     membytes = MemStat.VmB("VmRSS:")
     if membytes:
         mem = membytes / (1024.0 * 1024.0)
     return (now, cpuTime, mem)
Exemple #2
0
 def __startReportToMonitoring(self):
     self._monitor.addMark("Queries")
     now = time.time()
     stats = os.times()
     cpuTime = stats[0] + stats[2]
     if now - self.__monitorLastStatsUpdate < 0:
         return (now, cpuTime)
     # Send CPU consumption mark
     wallClock = now - self.__monitorLastStatsUpdate
     self.__monitorLastStatsUpdate = now
     # Send Memory consumption mark
     membytes = MemStat.VmB('VmRSS:')
     if membytes:
         mem = membytes / (1024. * 1024.)
         self._monitor.addMark('MEM', mem)
     return (now, cpuTime)
Exemple #3
0
 def __startReportToMonitoring(self):
     try:
         now = time.time()
         stats = os.times()
         cpuTime = stats[0] + stats[2]
         if now - self.__monitorLastStatsUpdate < 10:
             return (now, cpuTime)
         # Send CPU consumption mark
         self.__monitorLastStatsUpdate = now
         # Send Memory consumption mark
         membytes = MemStat.VmB('VmRSS:')
         if membytes:
             mem = membytes / (1024. * 1024.)
             gMonitor.addMark('MEM', mem)
         return (now, cpuTime)
     except Exception:
         return False
Exemple #4
0
    def __startReportToMonitoring(self):
        if not self.activityMonitoring:
            self._monitor.addMark("Queries")

        now = time.time()
        stats = os.times()
        cpuTime = stats[0] + stats[2]
        if now - self.__monitorLastStatsUpdate < 0:
            return (now, cpuTime)
        # Send CPU consumption mark
        self.__monitorLastStatsUpdate = now
        # Send Memory consumption mark
        membytes = MemStat.VmB("VmRSS:")
        if membytes:
            mem = membytes / (1024.0 * 1024.0)
            if not self.activityMonitoring:
                self._monitor.addMark("MEM", mem)
        return (now, cpuTime)
Exemple #5
0
    def __startReportToMonitoringLoop(self):
        """
        Snapshot of resources to be taken at the beginning
        of a monitoring cycle.
        Also sends memory snapshot to the monitoring.

        This is basically copy/paste of Service.py

        :returns: tuple (<time.time(), cpuTime )

        """
        now = time.time()  # Used to calulate a delta
        stats = os.times()
        cpuTime = stats[0] + stats[2]
        if now - self.__monitorLastStatsUpdate < 0:
            return (now, cpuTime)
        # Send CPU consumption mark
        self.__monitorLastStatsUpdate = now
        # Send Memory consumption mark
        membytes = MemStat.VmB("VmRSS:")
        if membytes:
            mem = membytes / (1024.0 * 1024.0)
        return (now, cpuTime, mem)