コード例 #1
0
 def cpu_times(self):
     try:
         ret = cext.proc_cpu_times(self.pid)
     except OSError:
         err = sys.exc_info()[1]
         if err.errno in ACCESS_DENIED_SET:
             ret = cext.proc_cpu_times_2(self.pid)
         else:
             raise
     return _common.pcputimes(*ret)
コード例 #2
0
ファイル: _pswindows.py プロジェクト: Hannah1999/Dato-Core
 def cpu_times(self):
     try:
         ret = cext.proc_cpu_times(self.pid)
     except OSError:
         err = sys.exc_info()[1]
         if err.errno in ACCESS_DENIED_SET:
             ret = cext.proc_cpu_times_2(self.pid)
         else:
             raise
     return _common.pcputimes(*ret)
コード例 #3
0
ファイル: _pslinux.py プロジェクト: Hannah1999/Dato-Core
 def cpu_times(self):
     f = open("/proc/%s/stat" % self.pid, 'rb')
     try:
         st = f.read().strip()
     finally:
         f.close()
     # ignore the first two values ("pid (exe)")
     st = st[st.find(b(')')) + 2:]
     values = st.split(b(' '))
     utime = float(values[11]) / CLOCK_TICKS
     stime = float(values[12]) / CLOCK_TICKS
     return _common.pcputimes(utime, stime)
コード例 #4
0
ファイル: _pslinux.py プロジェクト: zhmz90/Dato-Core
 def cpu_times(self):
     f = open("/proc/%s/stat" % self.pid, 'rb')
     try:
         st = f.read().strip()
     finally:
         f.close()
     # ignore the first two values ("pid (exe)")
     st = st[st.find(b(')')) + 2:]
     values = st.split(b(' '))
     utime = float(values[11]) / CLOCK_TICKS
     stime = float(values[12]) / CLOCK_TICKS
     return _common.pcputimes(utime, stime)
コード例 #5
0
ファイル: _pssunos.py プロジェクト: Hannah1999/Dato-Core
 def cpu_times(self):
     user, system = cext.proc_cpu_times(self.pid)
     return _common.pcputimes(user, system)
コード例 #6
0
ファイル: _pssunos.py プロジェクト: zhmz90/Dato-Core
 def cpu_times(self):
     user, system = cext.proc_cpu_times(self.pid)
     return _common.pcputimes(user, system)