def testNice(self): cmd = ["sleep", "10"] proc = commands.execCmd(cmd, nice=10, sync=False) try: time.sleep(0.2) nice = pidstat(proc.pid).nice self.assertEqual(nice, 10) finally: proc.kill() proc.wait()
def testNice(self): cmd = ["sleep", "10"] proc = commands.start(cmd, nice=10) try: time.sleep(0.2) nice = pidstat(proc.pid).nice self.assertEqual(nice, 10) finally: proc.kill() proc.wait()
def test_without_affinity(self): args = [EXT_SLEEP, "3"] popen = Popen(args, close_fds=True) stats = proc.pidstat(popen.pid) pid = int(stats.pid) # procName comes in the format of (procname) name = stats.comm self.assertEqual(pid, popen.pid) self.assertEqual(name, args[0]) popen.kill() popen.wait()
def getCmdArgs(pid): res = tuple() # Sometimes cmdline is empty even though the process is not a zombie. # Retrying seems to solve it. while len(res) == 0: # cmdline is empty for zombie processes if pidstat(pid).state in ("Z", "z"): return tuple() res = _parseCmdLine(pid) return res
def getCmdArgs(pid): res = tuple() # Sometimes cmdline is empty even though the process is not a zombie. # Retrying seems to solve it. while len(res) == 0: # cmdline is empty for zombie processes if pidstat(pid).state in ("Z", "z"): return tuple() res = _parseCmdLine(pid) return res
def test(): nice = pidstat(proc.pid).nice self.assertEqual(nice, 10)
def test(): nice = pidstat(proc.pid).nice self.assertEqual(nice, 10)