python/psutil/PKG-INFO

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 Metadata-Version: 1.1
michael@0 2 Name: psutil
michael@0 3 Version: 1.0.1
michael@0 4 Summary: A process and system utilities module for Python
michael@0 5 Home-page: http://code.google.com/p/psutil/
michael@0 6 Author: Giampaolo Rodola
michael@0 7 Author-email: g.rodola <at> gmail <dot> com
michael@0 8 License: License :: OSI Approved :: BSD License
michael@0 9 Download-URL: http://psutil.googlecode.com/files/psutil-1.0.1.tar.gz
michael@0 10 Description: ===========
michael@0 11 Quick links
michael@0 12 ===========
michael@0 13
michael@0 14 * `Home page <http://code.google.com/p/psutil>`_
michael@0 15 * `Download <http://code.google.com/p/psutil/downloads/list>`_
michael@0 16 * `Documentation <http://code.google.com/p/psutil/wiki/Documentation>`_
michael@0 17
michael@0 18 =======
michael@0 19 Summary
michael@0 20 =======
michael@0 21
michael@0 22 psutil is a module providing an interface for retrieving information on all
michael@0 23 running processes and system utilization (CPU, memory, disks, network, users) in
michael@0 24 a portable way by using Python, implementing many functionalities offered by
michael@0 25 command line tools such as: **ps, top, df, kill, free, lsof, free, netstat,
michael@0 26 ifconfig, nice, ionice, iostat, iotop, uptime, pidof, tty, who, taskset, pmap**.
michael@0 27
michael@0 28 It currently supports **Linux**, **Windows**, **OSX**, **FreeBSD**,
michael@0 29 **Sun Solaris** both **32-bit** and **64-bit** with Python versions from **2.4**
michael@0 30 to **3.3** by using a single code base.
michael@0 31
michael@0 32 ==============
michael@0 33 Example usages
michael@0 34 ==============
michael@0 35
michael@0 36 CPU
michael@0 37 ===
michael@0 38
michael@0 39 >>> import psutil
michael@0 40 >>> psutil.cpu_times()
michael@0 41 cputimes(user=3961.46, nice=169.729, system=2150.659, idle=16900.540,
michael@0 42 iowait=629.509, irq=0.0, softirq=19.422, steal=0.0, guest=0, nice=0.0)
michael@0 43 >>>
michael@0 44 >>> for x in range(3):
michael@0 45 ... psutil.cpu_percent(interval=1)
michael@0 46 ...
michael@0 47 4.0
michael@0 48 5.9
michael@0 49 3.8
michael@0 50 >>>
michael@0 51 >>> for x in range(3):
michael@0 52 ... psutil.cpu_percent(interval=1, percpu=True)
michael@0 53 ...
michael@0 54 [4.0, 6.9]
michael@0 55 [7.0, 8.5]
michael@0 56 [1.2, 9.0]
michael@0 57 >>>
michael@0 58 >>> for x in range(3):
michael@0 59 ... psutil.cpu_times_percent(interval=1, percpu=False)
michael@0 60 ...
michael@0 61 cpupercent(user=1.5, nice=0.0, system=0.5, idle=96.5, iowait=1.5, irq=0.0,
michael@0 62 softirq=0.0, steal=0.0, guest=0.0, guest_nice=0.0)
michael@0 63 cpupercent(user=1.0, nice=0.0, system=0.0, idle=99.0, iowait=0.0, irq=0.0,
michael@0 64 softirq=0.0, steal=0.0, guest=0.0, guest_nice=0.0)
michael@0 65 cpupercent(user=2.0, nice=0.0, system=0.0, idle=98.0, iowait=0.0, irq=0.0,
michael@0 66 softirq=0.0, steal=0.0, guest=0.0, guest_nice=0.0)
michael@0 67
michael@0 68 Memory
michael@0 69 ======
michael@0 70
michael@0 71 >>> psutil.virtual_memory()
michael@0 72 vmem(total=8374149120L, available=2081050624L, percent=75.1, used=8074080256L,
michael@0 73 free=300068864L, active=3294920704, inactive=1361616896, buffers=529895424L,
michael@0 74 cached=1251086336)
michael@0 75 >>> psutil.swap_memory()
michael@0 76 swap(total=2097147904L, used=296128512L, free=1801019392L, percent=14.1,
michael@0 77 sin=304193536, sout=677842944)
michael@0 78 >>>
michael@0 79
michael@0 80
michael@0 81 Disks
michael@0 82 =====
michael@0 83
michael@0 84 >>> psutil.disk_partitions()
michael@0 85 [partition(device='/dev/sda1', mountpoint='/', fstype='ext4', opts='rw,nosuid'),
michael@0 86 partition(device='/dev/sda2', mountpoint='/home', fstype='ext, opts='rw')]
michael@0 87 >>>
michael@0 88 >>> psutil.disk_usage('/')
michael@0 89 usage(total=21378641920, used=4809781248, free=15482871808, percent=22.5)
michael@0 90 >>>
michael@0 91 >>> psutil.disk_io_counters()
michael@0 92 iostat(read_count=719566, write_count=1082197, read_bytes=18626220032,
michael@0 93 write_bytes=24081764352, read_time=5023392, write_time=63199568)
michael@0 94 >>>
michael@0 95
michael@0 96
michael@0 97 Network
michael@0 98 =======
michael@0 99
michael@0 100 >>> psutil.net_io_counters(pernic=True)
michael@0 101 {'lo': iostat(bytes_sent=799953745, bytes_recv=799953745,
michael@0 102 packets_sent=453698, packets_recv=453698),
michael@0 103 'eth0': iostat(bytes_sent=734324837, bytes_recv=4163935363,
michael@0 104 packets_sent=3605828, packets_recv=4096685)}
michael@0 105 >>>
michael@0 106
michael@0 107 Other system info
michael@0 108 =================
michael@0 109
michael@0 110 >>> psutil.get_users()
michael@0 111 [user(name='giampaolo', terminal='pts/2', host='localhost', started=1340737536.0),
michael@0 112 user(name='giampaolo', terminal='pts/3', host='localhost', started=1340737792.0)]
michael@0 113 >>>
michael@0 114 >>> psutil.get_boot_time()
michael@0 115 1365519115.0
michael@0 116
michael@0 117
michael@0 118 Process management
michael@0 119 ==================
michael@0 120
michael@0 121 >>> import psutil
michael@0 122 >>> psutil.get_pid_list()
michael@0 123 [1, 2, 3, 4, 5, 6, 7, 46, 48, 50, 51, 178, 182, 222, 223, 224,
michael@0 124 268, 1215, 1216, 1220, 1221, 1243, 1244, 1301, 1601, 2237, 2355,
michael@0 125 2637, 2774, 3932, 4176, 4177, 4185, 4187, 4189, 4225, 4243, 4245,
michael@0 126 4263, 4282, 4306, 4311, 4312, 4313, 4314, 4337, 4339, 4357, 4358,
michael@0 127 4363, 4383, 4395, 4408, 4433, 4443, 4445, 4446, 5167, 5234, 5235,
michael@0 128 5252, 5318, 5424, 5644, 6987, 7054, 7055, 7071]
michael@0 129 >>>
michael@0 130 >>> p = psutil.Process(7055)
michael@0 131 >>> p.name
michael@0 132 'python'
michael@0 133 >>> p.exe
michael@0 134 '/usr/bin/python'
michael@0 135 >>> p.getcwd()
michael@0 136 '/home/giampaolo'
michael@0 137 >>> p.cmdline
michael@0 138 ['/usr/bin/python', 'main.py']
michael@0 139 >>>
michael@0 140 >>> str(p.status)
michael@0 141 'running'
michael@0 142 >>> p.username
michael@0 143 'giampaolo'
michael@0 144 >>> p.create_time
michael@0 145 1267551141.5019531
michael@0 146 >>> p.terminal
michael@0 147 '/dev/pts/0'
michael@0 148 >>>
michael@0 149 >>> p.uids
michael@0 150 user(real=1000, effective=1000, saved=1000)
michael@0 151 >>> p.gids
michael@0 152 group(real=1000, effective=1000, saved=1000)
michael@0 153 >>>
michael@0 154 >>> p.get_cpu_times()
michael@0 155 cputimes(user=1.02, system=0.31)
michael@0 156 >>> p.get_cpu_percent(interval=1.0)
michael@0 157 12.1
michael@0 158 >>> p.get_cpu_affinity()
michael@0 159 [0, 1, 2, 3]
michael@0 160 >>> p.set_cpu_affinity([0])
michael@0 161 >>>
michael@0 162 >>> p.get_memory_percent()
michael@0 163 0.63423
michael@0 164 >>>
michael@0 165 >>> p.get_memory_info()
michael@0 166 meminfo(rss=7471104, vms=68513792)
michael@0 167 >>> p.get_ext_memory_info()
michael@0 168 meminfo(rss=9662464, vms=49192960, shared=3612672, text=2564096, lib=0, data=5754880, dirty=0)
michael@0 169 >>> p.get_memory_maps()
michael@0 170 [mmap(path='/lib/x86_64-linux-gnu/libutil-2.15.so', rss=16384, anonymous=8192, swap=0),
michael@0 171 mmap(path='/lib/x86_64-linux-gnu/libc-2.15.so', rss=6384, anonymous=15, swap=0),
michael@0 172 mmap(path='/lib/x86_64-linux-gnu/libcrypto.so.1.0.0', rss=34124, anonymous=1245, swap=0),
michael@0 173 mmap(path='[heap]', rss=54653, anonymous=8192, swap=0),
michael@0 174 mmap(path='[stack]', rss=1542, anonymous=166, swap=0),
michael@0 175 ...]
michael@0 176 >>>
michael@0 177 >>> p.get_io_counters()
michael@0 178 io(read_count=478001, write_count=59371, read_bytes=700416, write_bytes=69632)
michael@0 179 >>>
michael@0 180 >>> p.get_open_files()
michael@0 181 [openfile(path='/home/giampaolo/svn/psutil/somefile', fd=3)]
michael@0 182 >>>
michael@0 183 >>> p.get_connections()
michael@0 184 [connection(fd=115, family=2, type=1, laddr=('10.0.0.1', 48776),
michael@0 185 raddr=('93.186.135.91', 80), status='ESTABLISHED'),
michael@0 186 connection(fd=117, family=2, type=1, laddr=('10.0.0.1', 43761),
michael@0 187 raddr=('72.14.234.100', 80), status='CLOSING'),
michael@0 188 connection(fd=119, family=2, type=1, laddr=('10.0.0.1', 60759),
michael@0 189 raddr=('72.14.234.104', 80), status='ESTABLISHED'),
michael@0 190 connection(fd=123, family=2, type=1, laddr=('10.0.0.1', 51314),
michael@0 191 raddr=('72.14.234.83', 443), status='SYN_SENT')]
michael@0 192 >>>
michael@0 193 >>> p.get_num_threads()
michael@0 194 4
michael@0 195 >>> p.get_num_fds()
michael@0 196 8
michael@0 197 >>> p.get_threads()
michael@0 198 [thread(id=5234, user_time=22.5, system_time=9.2891),
michael@0 199 thread(id=5235, user_time=0.0, system_time=0.0),
michael@0 200 thread(id=5236, user_time=0.0, system_time=0.0),
michael@0 201 thread(id=5237, user_time=0.0707, system_time=1.1)]
michael@0 202 >>>
michael@0 203 >>> p.get_num_ctx_switches()
michael@0 204 amount(voluntary=78, involuntary=19)
michael@0 205 >>>
michael@0 206 >>> p.get_nice()
michael@0 207 0
michael@0 208 >>> p.set_nice(10)
michael@0 209 >>>
michael@0 210 >>> p.suspend()
michael@0 211 >>> p.resume()
michael@0 212 >>>
michael@0 213 >>> p.terminate()
michael@0 214 >>> p.wait(timeout=3)
michael@0 215 0
michael@0 216 >>>
michael@0 217 >>> psutil.test()
michael@0 218 USER PID %CPU %MEM VSZ RSS TTY START TIME COMMAND
michael@0 219 root 1 0.0 0.0 24584 2240 ? Jun17 00:00 init
michael@0 220 root 2 0.0 0.0 0 0 ? Jun17 00:00 kthreadd
michael@0 221 root 3 0.0 0.0 0 0 ? Jun17 00:05 ksoftirqd/0
michael@0 222 ...
michael@0 223 giampaolo 31475 0.0 0.0 20760 3024 /dev/pts/0 Jun19 00:00 python2.4
michael@0 224 giampaolo 31721 0.0 2.2 773060 181896 ? 00:04 10:30 chrome
michael@0 225 root 31763 0.0 0.0 0 0 ? 00:05 00:00 kworker/0:1
michael@0 226 >>>
michael@0 227
michael@0 228 Keywords: ps,top,kill,free,lsof,netstat,nice,tty,ionice,uptime,taskmgr,process,df,iotop,iostat,ifconfig,taskset,who,pidof,pmap,smem,monitoring
michael@0 229 Platform: Platform Independent
michael@0 230 Classifier: Development Status :: 5 - Production/Stable
michael@0 231 Classifier: Environment :: Console
michael@0 232 Classifier: Operating System :: MacOS :: MacOS X
michael@0 233 Classifier: Operating System :: Microsoft
michael@0 234 Classifier: Operating System :: Microsoft :: Windows :: Windows NT/2000
michael@0 235 Classifier: Operating System :: POSIX
michael@0 236 Classifier: Operating System :: POSIX :: Linux
michael@0 237 Classifier: Operating System :: POSIX :: BSD :: FreeBSD
michael@0 238 Classifier: Operating System :: POSIX :: SunOS/Solaris
michael@0 239 Classifier: Operating System :: OS Independent
michael@0 240 Classifier: Programming Language :: C
michael@0 241 Classifier: Programming Language :: Python
michael@0 242 Classifier: Programming Language :: Python :: 2
michael@0 243 Classifier: Programming Language :: Python :: 2.4
michael@0 244 Classifier: Programming Language :: Python :: 2.5
michael@0 245 Classifier: Programming Language :: Python :: 2.6
michael@0 246 Classifier: Programming Language :: Python :: 2.7
michael@0 247 Classifier: Programming Language :: Python :: 3
michael@0 248 Classifier: Programming Language :: Python :: 3.0
michael@0 249 Classifier: Programming Language :: Python :: 3.1
michael@0 250 Classifier: Programming Language :: Python :: 3.2
michael@0 251 Classifier: Programming Language :: Python :: 3.3
michael@0 252 Classifier: Topic :: System :: Monitoring
michael@0 253 Classifier: Topic :: System :: Networking
michael@0 254 Classifier: Topic :: System :: Networking :: Monitoring
michael@0 255 Classifier: Topic :: System :: Benchmark
michael@0 256 Classifier: Topic :: System :: Hardware
michael@0 257 Classifier: Topic :: System :: Systems Administration
michael@0 258 Classifier: Topic :: Utilities
michael@0 259 Classifier: Topic :: Software Development :: Libraries
michael@0 260 Classifier: Topic :: Software Development :: Libraries :: Python Modules
michael@0 261 Classifier: Intended Audience :: Developers
michael@0 262 Classifier: Intended Audience :: System Administrators
michael@0 263 Classifier: License :: OSI Approved :: BSD License

mercurial