(pid)
| 810 | |
| 811 | |
| 812 | def _get_memory_with_ps(pid): |
| 813 | # It's probably possible to do with proc_pidinfo and ctypes on a Mac, |
| 814 | # but we'll do it the easy way with parsing ps output. |
| 815 | command_list = 'ps u -p'.split() |
| 816 | command_list.append(str(pid)) |
| 817 | p = Popen(command_list, stdout=PIPE) |
| 818 | stdout = p.communicate()[0] |
| 819 | if not p.returncode == 0: |
| 820 | raise ProcessTerminatedError(str(pid)) |
| 821 | else: |
| 822 | # Get the RSS from output that looks like this: |
| 823 | # USER PID %CPU %MEM VSZ RSS TT STAT STARTED TIME COMMAND |
| 824 | # user 47102 0.0 0.1 2437000 4496 s002 S+ 7:04PM 0:00.12 python2 |
| 825 | return int(stdout.splitlines()[1].split()[5]) * 1024 |
| 826 | |
| 827 | |
| 828 | class BaseS3CLICommand(unittest.TestCase): |
nothing calls this directly
no test coverage detected