Beispiel #1
0
 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()
Beispiel #2
0
 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()
Beispiel #3
0
 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()
Beispiel #4
0
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
Beispiel #5
0
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
Beispiel #6
0
 def test():
     nice = pidstat(proc.pid).nice
     self.assertEqual(nice, 10)
Beispiel #7
0
 def test():
     nice = pidstat(proc.pid).nice
     self.assertEqual(nice, 10)