Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(83)

Unified Diff: third_party/psutil/docs/documentation.html

Issue 8774018: Add psutil build step to fix pyauto media issues. Upgrade psutil to 0.4.0. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Replace 'python' w/ sys.executable. Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/psutil/docs/documentation.html
diff --git a/third_party/psutil/docs/documentation.html b/third_party/psutil/docs/documentation.html
index 35adcb957a6b6706040ecc4bdb99b6204a8284e7..77c88378dfe4adfe4b811e3d98b05765c054fb2b 100644
--- a/third_party/psutil/docs/documentation.html
+++ b/third_party/psutil/docs/documentation.html
@@ -2,7 +2,7 @@
<!-- saved from url=(0066)http://code.google.com/p/psutil/wiki/DocumentationDev?show=content -->
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>DocumentationDev</title>
- <script src="./documentation_files/googleapis.client__plusone.js"></script></head>
+ </head>
<body>
@@ -18,9 +18,9 @@
<div id="wikicontent">
<div class="vt" id="wikimaincol">
- <h1><a name="API_Reference"></a>API Reference<a href="http://code.google.com/p/psutil/wiki/DocumentationDev?show=content#API_Reference" class="section_anchor"></a></h1><h2><a name="Exceptions"></a>Exceptions<a href="http://code.google.com/p/psutil/wiki/DocumentationDev?show=content#Exceptions" class="section_anchor"></a></h2><p>psutil.<strong>NoSuchProcess</strong><font size="3"><strong><tt>(</tt></strong></font><i>pid, name=None, msg=None</i><font size="3"><strong><tt>)</tt></strong></font> </p><blockquote>Raised when no process with the given PID is found in the current process list or when a process no longer exists (zombie).
-</blockquote><p></p><p>psutil.<strong>AccessDenied</strong><font size="3"><strong><tt>(</tt></strong></font><i>pid=None, name=None, msg=None</i><font size="3"><strong><tt>)</tt></strong></font> </p><blockquote>Raised when permission to perform an action is denied.
-</blockquote><p></p><p>psutil.<strong>TimeoutExpired</strong><font size="3"><strong><tt>(</tt></strong></font><i>pid=None, name=None</i><font size="3"><strong><tt>)</tt></strong></font> </p><blockquote>Raised on <tt>Process.wait(timeout)</tt> if timeout expires and process is still alive.
+<h1><a name="API_Reference"></a>API Reference<a href="http://code.google.com/p/psutil/wiki/DocumentationDev?show=content#API_Reference" class="section_anchor"></a></h1><h2><a name="Exceptions"></a>Exceptions<a href="http://code.google.com/p/psutil/wiki/DocumentationDev?show=content#Exceptions" class="section_anchor"></a></h2><p>psutil.<strong>NoSuchProcess<a href="http://code.google.com/p/psutil/w/edit/NoSuchProcess">?</a></strong><font size="3"><strong><tt>(</tt></strong></font><i>pid, name=None, msg=None</i><font size="3"><strong><tt>)</tt></strong></font> </p><blockquote>Raised when no process with the given PID is found in the current process list or when a process no longer exists (zombie).
+</blockquote><p></p><p>psutil.<strong>AccessDenied<a href="http://code.google.com/p/psutil/w/edit/AccessDenied">?</a></strong><font size="3"><strong><tt>(</tt></strong></font><i>pid=None, name=None, msg=None</i><font size="3"><strong><tt>)</tt></strong></font> </p><blockquote>Raised when permission to perform an action is denied.
+</blockquote><p></p><p>psutil.<strong>TimeoutExpired<a href="http://code.google.com/p/psutil/w/edit/TimeoutExpired">?</a></strong><font size="3"><strong><tt>(</tt></strong></font><i>pid=None, name=None</i><font size="3"><strong><tt>)</tt></strong></font> </p><blockquote>Raised on <tt>Process.wait(timeout)</tt> if timeout expires and process is still alive.
</blockquote><p></p><blockquote><i><strong>New in 0.2.1</strong></i>
</blockquote><hr><h2><a name="Classes"></a>Classes<a href="http://code.google.com/p/psutil/wiki/DocumentationDev?show=content#Classes" class="section_anchor"></a></h2><p>psutil.<strong>Process</strong><font size="3"><strong><tt>(</tt></strong></font><i>pid</i><font size="3"><strong><tt>)</tt></strong></font> </p><blockquote>A class which represents an OS process.
</blockquote><ul><li><strong>pid</strong><br>The process pid. </li></ul><ul><li><strong>ppid</strong><br>The process parent pid. </li></ul><ul><li><strong>parent</strong><br>Return the parent process as a <tt>Process</tt> object. If no ppid is known then return <tt>None</tt>. </li></ul><ul><li><strong>name</strong><br>The process name. </li></ul><ul><li><strong>exe</strong><br>The process executable as an absolute path name. </li></ul><ul><li><strong>cmdline</strong><br>The command line process has been called with. </li></ul><ul><li><strong>create_time</strong><br> The process creation time as a floating point number expressed in seconds since the epoch, in <a href="http://en.wikipedia.org/wiki/Coordinated_Universal_Time" rel="nofollow">UTC</a>. </li><pre class="prettyprint">&gt;&gt;&gt; import os, psutil, datetime
@@ -49,7 +49,8 @@ True
10</pre></ul><blockquote>On Windows this is available as well by using <a href="http://msdn.microsoft.com/en-us/library/ms683211(v=vs.85).aspx" rel="nofollow">GetPriorityClass</a> and <a href="http://msdn.microsoft.com/en-us/library/ms686219(v=vs.85).aspx" rel="nofollow">SetPriorityClass</a>. <tt>psutil.*_PRIORITY_CLASS</tt> constants (explained <a href="http://msdn.microsoft.com/en-us/library/ms686219(v=vs.85).aspx" rel="nofollow">here</a>) can be used in conjunction. Example which increases process priority:
</blockquote><blockquote><pre class="prettyprint">&gt;&gt; p.nice = psutil.HIGH_PRIORITY_CLASS</pre>
</blockquote><blockquote><i><strong>New in 2.1</strong></i>
-</blockquote><ul><li><strong>getcwd</strong><font size="3"><strong><tt>()</tt></strong></font><br>Return a string representing the process current working directory. </li></ul><blockquote><i><strong>Availability:</strong> Windows, Linux</i>
+</blockquote><ul><li><strong>getcwd</strong><font size="3"><strong><tt>()</tt></strong></font><br>Return a string representing the process current working directory. </li></ul><blockquote><i><strong>Availability:</strong> Windows, Linux, FreeBSD</i><br>
+<i><strong>Changed in 0.4.0:</strong> added FreeBSD support</i>
</blockquote><ul><li><strong>get_io_counters</strong><font size="3"><strong><tt>()</tt></strong></font><br>Return process I/O statistics as a namedtuple including the number of read and write operations performed by the process and the amount of bytes read and written. For linux refer to <a href="http://www.mjmwired.net/kernel/Documentation/filesystems/proc.txt#1304" rel="nofollow">/proc filesysem documentation</a>. On BSD there's apparently no way to retrieve bytes counters, hence <tt>-1</tt> is returned for <tt>read_bytes</tt> and <tt>write_bytes</tt> fields. OSX is not supported. </li><pre class="prettyprint">&gt;&gt;&gt; p.get_io_counters()
io(read_count=454556, write_count=3456, read_bytes=110592, write_bytes=0)</pre></ul><blockquote><i><strong>New in 2.1</strong></i><br><i><strong>Availability:</strong> Linux, Windows, FreeBSD</i>
</blockquote><ul><li><strong>get_ionice</strong><font size="3"><strong><tt>()</tt></strong></font><br>Return <a href="http://friedcpu.wordpress.com/2007/07/17/why-arent-you-using-ionice-yet/" rel="nofollow">process I/O niceness</a> (priority) as a namedtuple including priority class and priority data. See <tt>set_ionice</tt> below for more information. </li></ul><blockquote><i><strong>New in 2.1</strong></i><br><i><strong>Availability:</strong> Linux</i>
@@ -58,13 +59,23 @@ io(read_count=454556, write_count=3456, read_bytes=110592, write_bytes=0)</pre><
&gt;&gt;&gt; p.set_ionice(psutil.IOPRIO_CLASS_IDLE)
&gt;&gt;&gt;</pre></ul><blockquote><i><strong>New in 2.1</strong></i><br><i><strong>Availability:</strong> Linux</i>
</blockquote><ul><li><strong>get_num_threads</strong><font size="3"><strong><tt>()</tt></strong></font><br>Return the number of threads used by this process. </li></ul><ul><li><strong>get_threads</strong><font size="3"><strong><tt>()</tt></strong></font><br>Return threads opened by process as a list of namedtuples including thread id and thread CPU times (user/system). </li></ul><blockquote><i><strong>New in 0.2.1</strong></i>
-</blockquote><ul><li><strong>get_cpu_times</strong><font size="3"><strong><tt>()</tt></strong></font><br>Return a tuple whose values are process CPU user and system times which means the amount of time expressed in seconds that a process has spent in <a href="http://stackoverflow.com/questions/556405/what-do-real-user-and-sys-mean-in-the-output-of-time1" rel="nofollow">user/system mode</a>. </li></ul><ul><li><strong>get_cpu_percent</strong><font size="3"><strong><tt>(</tt></strong></font><i>interval=0.1</i><font size="3"><strong><tt>)</tt></strong></font><br>Return a float representing the process CPU utilization as a percentage. When interval is &gt; 0.0 compares process times to system CPU times elapsed before and after the interval (blocking). When interval is 0.0 or None compares process times to system CPU times elapsed since last call, returning immediately. In this case is recommended for accuracy that this function be called with at least 0.1 seconds between calls. </li></ul><blockquote><i><strong>Changed in 0.2.0:</strong> interval parameter was added</i>
-</blockquote><ul><li><strong>get_memory_info</strong><font size="3"><strong><tt>()</tt></strong></font><br>Return a tuple representing <a href="http://en.wikipedia.org/wiki/Resident_Set_Size" rel="nofollow">RSS</a> (Resident Set Size) and VMS (Virtual Memory Size) in bytes.<br>On UNIX RSS and VMS are the same values shown by ps. On Windows RSS and VMS refer to "Mem Usage" and "VM Size" columns of taskmgr.exe. </li></ul><ul><li><strong>get_memory_percent</strong><font size="3"><strong><tt>()</tt></strong></font><br>Compare physical system memory to process resident memory and calculate process memory utilization as a percentage. </li></ul><ul><li><strong>get_children</strong><font size="3"><strong><tt>()</tt></strong></font><br>Return the children of this process as a list of <tt>Process</tt> objects. </li></ul><ul><li><strong>get_open_files</strong><font size="3"><strong><tt>()</tt></strong></font><br>Return files opened by process as a list of <a href="http://docs.python.org/library/collections.html?highlight=namedtuple#collections.namedtuple" rel="nofollow">namedtuples</a> including file absolute path name and file descriptor. On <strong>FreeBSD</strong> this is done by parsing <a href="http://en.wikipedia.org/wiki/Lsof" rel="nofollow">lsof</a> command output. If lsof is not installed on the system <a href="http://docs.python.org/library/exceptions.html?highlight=notimplementederror#exceptions.NotImplementedError" rel="nofollow">NotImplementedError</a> exception is raised. Example: </li><pre class="prettyprint">&gt;&gt;&gt; import psutil, os
+</blockquote><ul><li><strong>get_cpu_times</strong><font size="3"><strong><tt>()</tt></strong></font><br>Return a tuple whose values are process CPU user and system times which means the amount of time expressed in seconds that a process has spent in <a href="http://stackoverflow.com/questions/556405/what-do-real-user-and-sys-mean-in-the-output-of-time1" rel="nofollow">user/system mode</a>. </li></ul><ul><li><strong>get_cpu_percent</strong><font size="3"><strong><tt>(</tt></strong></font><i>interval=0.1</i><font size="3"><strong><tt>)</tt></strong></font><br>Return a float representing the process CPU utilization as a percentage. When interval is &gt; 0.0 compares process times to system CPU times elapsed before and after the interval (blocking). When interval is 0.0 or None compares process times to system CPU times elapsed since last call, returning immediately. In this case is recommended for accuracy that this function be called with at least 0.1 seconds between calls. Example: </li><pre class="prettyprint">&gt;&gt;&gt; import psutil, os
+&gt;&gt;&gt; p = psutil.Process(os.getpid())
+&gt;&gt;&gt; # blocking
+&gt;&gt;&gt; p.get_cpu_percent(interval=1)
+2.0
+&gt;&gt;&gt; # non-blocking (percentage since last call)
+&gt;&gt;&gt; p.get_cpu_percent(interval=0)
+2.9
+&gt;&gt;&gt;</pre></ul><blockquote><i><strong>Changed in 0.2.0:</strong> interval parameter was added</i>
+</blockquote><ul><li><strong>get_memory_info</strong><font size="3"><strong><tt>()</tt></strong></font><br>Return a tuple representing <a href="http://en.wikipedia.org/wiki/Resident_Set_Size" rel="nofollow">RSS</a> (Resident Set Size) and VMS (Virtual Memory Size) in bytes.<br>On UNIX RSS and VMS are the same values shown by ps. On Windows RSS and VMS refer to "Mem Usage" and "VM Size" columns of taskmgr.exe. </li></ul><ul><li><strong>get_memory_percent</strong><font size="3"><strong><tt>()</tt></strong></font><br>Compare physical system memory to process resident memory and calculate process memory utilization as a percentage. </li></ul><ul><li><strong>get_children</strong><font size="3"><strong><tt>()</tt></strong></font><br>Return the children of this process as a list of <tt>Process</tt> objects. </li></ul><ul><li><strong>get_open_files</strong><font size="3"><strong><tt>()</tt></strong></font><br>Return files opened by process as a list of <a href="http://docs.python.org/library/collections.html?highlight=namedtuple#collections.namedtuple" rel="nofollow">namedtuples</a> including file absolute path name and file descriptor. Example: </li><pre class="prettyprint">&gt;&gt;&gt; import psutil, os
&gt;&gt;&gt; f = open('file.ext', 'w')
&gt;&gt;&gt; p = psutil.Process(os.getpid())
&gt;&gt;&gt; p.get_open_files()
-[openfile(path='/home/giampaolo/svn/psutil/file.ext', fd=3)]</pre></ul><blockquote><i><strong>Changed in 0.2.1:</strong> OSX implementation rewritten in C; no longer requiring lsof.</i>
-</blockquote><ul><li><strong>get_connections</strong><font size="3"><strong><tt>()</tt></strong></font><br>Return all TCP and UPD connections opened by process as a list of <a href="http://docs.python.org/library/collections.html?highlight=namedtuple#collections.namedtuple" rel="nofollow">namedtuples</a>. Every namedtuple provides 6 attributes:<br><br> </li><ul><li><strong>fd</strong>: the socket file descriptor. This can be passed to <a href="http://docs.python.org/library/socket.html#socket.fromfd" rel="nofollow">socket.fromfd</a> to obtain a usable socket object. This is only available on UNIX; on Windows <tt>-1</tt> is always returned.<br> </li><li><strong>family</strong>: the address family, either <a href="http://docs.python.org/library/socket.html#socket.AF_INET" rel="nofollow">AF_INET</a> or <a href="http://docs.python.org/library/socket.html#socket.AF_INET6" rel="nofollow">AF_INET6</a> <br> </li><li><strong>type</strong>: the address type, either <a href="http://docs.python.org/library/socket.html#socket.SOCK_STREAM" rel="nofollow">SOCK_STREAM</a> or <a href="http://docs.python.org/library/socket.html#socket.SOCK_DGRAM" rel="nofollow">SOCK_DGRAM</a> <br> </li><li><strong>local_address</strong>: the local address as a <tt>(ip, port)</tt> tuple. <br> </li><li><strong>remote_address</strong>: the remote address as a <tt>(ip, port)</tt> tuple. When the remote endpoint is not connected the tuple is empty. <br> </li><li><strong>status</strong>: a string representing the TCP connections status. String values are supposed to match Linux's <a href="http://students.mimuw.edu.pl/lxr/source/include/net/tcp_states.h" rel="nofollow">tcp_states.h</a> header file across all platforms. For UDP sockets this is always going to be an empty string.<br> </li></ul></ul><blockquote>Example:
+[openfile(path='/home/giampaolo/svn/psutil/file.ext', fd=3)]</pre></ul><blockquote><i><strong>Changed in 0.2.1:</strong> OSX implementation rewritten in C; no longer requiring lsof.</i><br>
+<i><strong>Changed in 0.4.1:</strong> FreeBSD implementation rewritten in C; no longer requiring lsof.</i>
+</blockquote><ul><li><strong>get_connections</strong><font size="3"><strong><tt>(</tt></strong></font><i>kind='inet'</i><font size="3"><strong><tt>)</tt></strong></font><br>Return all TCP and UPD connections opened by process as a list of <a href="http://docs.python.org/library/collections.html?highlight=namedtuple#collections.namedtuple" rel="nofollow">namedtuples</a>. Every namedtuple provides 6 attributes:<br><br> </li><ul><li><strong>fd</strong>: the socket file descriptor. This can be passed to <a href="http://docs.python.org/library/socket.html#socket.fromfd" rel="nofollow">socket.fromfd</a> to obtain a usable socket object. This is only available on UNIX; on Windows <tt>-1</tt> is always returned.<br> </li><li><strong>family</strong>: the address family, either <a href="http://docs.python.org/library/socket.html#socket.AF_INET" rel="nofollow">AF_INET</a> or <a href="http://docs.python.org/library/socket.html#socket.AF_INET6" rel="nofollow">AF_INET6</a> <br> </li><li><strong>type</strong>: the address type, either <a href="http://docs.python.org/library/socket.html#socket.SOCK_STREAM" rel="nofollow">SOCK_STREAM</a> or <a href="http://docs.python.org/library/socket.html#socket.SOCK_DGRAM" rel="nofollow">SOCK_DGRAM</a> <br> </li><li><strong>local_address</strong>: the local address as a <tt>(ip, port)</tt> tuple. <br> </li><li><strong>remote_address</strong>: the remote address as a <tt>(ip, port)</tt> tuple. When the remote endpoint is not connected the tuple is empty. <br> </li><li><strong>status</strong>: a string representing the TCP connections status. String values are supposed to match Linux's <a href="http://students.mimuw.edu.pl/lxr/source/include/net/tcp_states.h" rel="nofollow">tcp_states.h</a> header file across all platforms. For UDP sockets this is always going to be an empty string.<br> </li></ul></ul><blockquote>The kind parameter is a string which filters for connections that fit the following criteria:
+</blockquote><p><table class="wikitable"><tbody><tr><td style="border: 1px solid #ccc; padding: 5px;"> <strong>Kind value</strong> </td><td style="border: 1px solid #ccc; padding: 5px;"> <strong>Connections using</strong> </td></tr> <tr><td style="border: 1px solid #ccc; padding: 5px;"> inet </td><td style="border: 1px solid #ccc; padding: 5px;"> IPv4 and IPv6 </td></tr> <tr><td style="border: 1px solid #ccc; padding: 5px;"> inet4 </td><td style="border: 1px solid #ccc; padding: 5px;"> IPv4 </td></tr> <tr><td style="border: 1px solid #ccc; padding: 5px;"> inet6 </td><td style="border: 1px solid #ccc; padding: 5px;"> IPv6 </td></tr> <tr><td style="border: 1px solid #ccc; padding: 5px;"> tcp </td><td style="border: 1px solid #ccc; padding: 5px;"> TCP </td></tr> <tr><td style="border: 1px solid #ccc; padding: 5px;"> tcp4 </td><td style="border: 1px solid #ccc; padding: 5px;"> TCP over IPv4 </td></tr> <tr><td style="border: 1px solid #ccc; padding: 5px;"> tcp6 </td><td style="border: 1px solid #ccc; padding: 5px;"> TCP over IPv6 </td></tr> <tr><td style="border: 1px solid #ccc; padding: 5px;"> udp </td><td style="border: 1px solid #ccc; padding: 5px;"> UDP </td></tr> <tr><td style="border: 1px solid #ccc; padding: 5px;"> udp4 </td><td style="border: 1px solid #ccc; padding: 5px;"> UDP over IPv4 </td></tr> <tr><td style="border: 1px solid #ccc; padding: 5px;"> udp6 </td><td style="border: 1px solid #ccc; padding: 5px;"> UDP over IPv6 </td></tr> <tr><td style="border: 1px solid #ccc; padding: 5px;"> all </td><td style="border: 1px solid #ccc; padding: 5px;"> the sum of all the possible families and protocols </td></tr> </tbody></table></p><blockquote>Example:
<pre class="prettyprint">&gt;&gt;&gt; p = psutil.Process(1694)
&gt;&gt;&gt; p.name
'firefox'
@@ -73,9 +84,11 @@ io(read_count=454556, write_count=3456, read_bytes=110592, write_bytes=0)</pre><
connection(fd=117, family=2, type=1, local_address=('10.0.0.1', 43761), remote_address=('72.14.234.100', 80), status='CLOSING'),
connection(fd=119, family=2, type=1, local_address=('10.0.0.1', 60759), remote_address=('72.14.234.104', 80), status='ESTABLISHED'),
connection(fd=123, family=2, type=1, local_address=('10.0.0.1', 51314), remote_address=('72.14.234.83', 443), status='SYN_SENT')]</pre>On <strong>FreeBSD</strong> this is implemented by parsing <a href="http://en.wikipedia.org/wiki/Lsof" rel="nofollow">lsof</a> command output. If lsof is not installed on the system <a href="http://docs.python.org/library/exceptions.html?highlight=notimplementederror#exceptions.NotImplementedError" rel="nofollow">NotImplementedError</a> exception is raised and for third party processes (different than <tt>os.getpid()</tt>) results can differ depending on user privileges.<br>
-</blockquote><blockquote><i><strong>Changed in 0.2.1:</strong> OSX implementation rewritten in C; no longer requiring lsof.</i>
+</blockquote><blockquote><i><strong>Changed in 0.2.1:</strong> OSX implementation rewritten in C; no longer requiring lsof.</i><br>
+<i><strong>Changed in 0.4.0:</strong> added 'kind' parameter.</i>
</blockquote><ul><li><strong>is_running</strong><font size="3"><strong><tt>()</tt></strong></font><br>Return whether the current process is running in the current process list. </li></ul><ul><li><strong>send_signal</strong><font size="3"><strong><tt>(</tt></strong></font><i>signal</i><font size="3"><strong><tt>)</tt></strong></font><br>Send a signal to process (see <a href="http://docs.python.org/library/signal.html" rel="nofollow">signal module</a> constants). On Windows only <tt>SIGTERM</tt> is valid and is treated as an alias for <tt>kill()</tt>. </li></ul><ul><li><strong>suspend</strong><font size="3"><strong><tt>()</tt></strong></font><br>Suspend process execution with <tt>SIGSTOP</tt> signal. On Windows this is done by suspending all process threads execution. </li></ul><ul><li><strong>resume</strong><font size="3"><strong><tt>()</tt></strong></font><br>Resume process execution with <tt>SIGCONT</tt> signal. On Windows this is done by resuming all process threads execution. </li></ul><ul><li><strong>terminate</strong><font size="3"><strong><tt>()</tt></strong></font><br>Terminate the process with <tt>SIGTERM</tt> signal. On Windows this is an alias for <tt>kill()</tt>. </li></ul><ul><li><strong>kill</strong><font size="3"><strong><tt>()</tt></strong></font><br>Kill the current process by using <tt>SIGKILL</tt> signal. </li></ul><blockquote><i><strong>Changed in 0.2.0:</strong> no longer accepts <tt>sig</tt> keyword argument - use <tt>send_signal()</tt> instead. </i>
-</blockquote><ul><li><strong>wait</strong><font size="3"><strong><tt>(</tt></strong></font><i>timeout=None</i><font size="3"><strong><tt>)</tt></strong></font><br>Wait for process termination and if the process is a children of the current one also return the exit code, else <tt>None</tt>. On Windows there's no such limitation (exit code is always returned). If the process is already terminated does not raise <tt>NoSuchProcess</tt> exception but just return <tt>None</tt> immediately. If <i>timeout</i> is specified and process is still alive raises <tt>TimeoutExpired</tt> exception. </li></ul><blockquote><i><strong>New in 0.2.1</strong></i>
+</blockquote><ul><li><strong>wait</strong><font size="3"><strong><tt>(</tt></strong></font><i>timeout=None</i><font size="3"><strong><tt>)</tt></strong></font><br>Wait for process termination and if the process is a children of the current one also return the exit code, else <tt>None</tt>. On Windows there's no such limitation (exit code is always returned). If the process is already terminated does not raise <tt>NoSuchProcess</tt> exception but just return <tt>None</tt> immediately. If <i>timeout</i> is specified and process is still alive raises <tt>TimeoutExpired</tt> exception. </li></ul><blockquote><i><strong>New in 0.2.1</strong></i><br>
+<i><strong>Changed in 0.4.0</strong>: timeout=0 can now be used to make wait() return immediately (non blocking)</i>
</blockquote><p><br><br> psutil.<strong>Popen</strong><font size="3"><strong><tt>(</tt></strong></font><tt>*args, **kwargs</tt><font size="3"><strong><tt>)</tt></strong></font> </p><blockquote>A more convenient interface to stdlib <a href="http://docs.python.org/library/subprocess.html#subprocess.Popen" rel="nofollow">subprocess.Popen</a>. It starts a sub process and deals with it exactly as when using subprocess.Popen class but in addition also provides all the properties and methods of psutil.Process class in a unique interface. For method names common to both classes such as <i>kill()</i> and <i>terminate()</i>, psutil.Process implementation takes precedence. For a complete documentation refers to <a href="http://docs.python.org/library/subprocess.html" rel="nofollow">subprocess module documentation</a>.
<pre class="prettyprint">&gt;&gt;&gt; import psutil
&gt;&gt;&gt; from subprocess import PIPE
@@ -91,10 +104,10 @@ user(real=1000, effective=1000, saved=1000)
&gt;&gt;&gt; p.wait(timeout=2)
0
&gt;&gt;&gt;</pre></blockquote><blockquote><i><strong>New in 0.2.1</strong></i>
-</blockquote><hr><h2><a name="Functions"></a>Functions<a href="http://code.google.com/p/psutil/wiki/DocumentationDev?show=content#Functions" class="section_anchor"></a></h2><p>psutil.<strong>get_pid_list</strong><font size="3"><strong><tt>()</tt></strong></font><br> </p><blockquote>Return a list of current running PIDs.
+</blockquote><hr><h2><a name="System_related_functions"></a>System related functions<a href="http://code.google.com/p/psutil/wiki/DocumentationDev?show=content#System_related_functions" class="section_anchor"></a></h2><h3><a name="Processes"></a>Processes<a href="http://code.google.com/p/psutil/wiki/DocumentationDev?show=content#Processes" class="section_anchor"></a></h3><p>psutil.<strong>get_pid_list</strong><font size="3"><strong><tt>()</tt></strong></font><br> </p><blockquote>Return a list of current running PIDs.
</blockquote><p></p><p>psutil.<strong>pid_exists</strong><font size="3"><strong><tt>(</tt></strong></font><i>pid</i><font size="3"><strong><tt>)</tt></strong></font><br> </p><blockquote>Check whether the given PID exists in the current process list. This is faster than doing <tt>pid in psutil.get_pid_list()</tt> and should be preferred.
</blockquote><p></p><p>psutil.<strong>process_iter</strong><font size="3"><strong><tt>()</tt></strong></font><br> </p><blockquote>Return an iterator yielding a Process class instances for all running processes on the local machine. This should be preferred over doing <tt>for pid in psutil.get_pid_list(): psutil.Process(pid)</tt> as it safe from race conditions.
-</blockquote><p></p><hr><h2><a name="System_related_functions"></a>System related functions<a href="http://code.google.com/p/psutil/wiki/DocumentationDev?show=content#System_related_functions" class="section_anchor"></a></h2><h3><a name="CPU"></a>CPU<a href="http://code.google.com/p/psutil/wiki/DocumentationDev?show=content#CPU" class="section_anchor"></a></h3><p>psutil.<strong>cpu_percent</strong><font size="3"><strong><tt>(</tt></strong></font><i>interval=0.1, percpu=False</i><font size="3"><strong><tt>)</tt></strong></font><br> </p><blockquote>Return a float representing the current system-wide CPU utilization as a percentage. When interval is &gt; 0.0 compares system CPU times elapsed before and after the interval (blocking). When interval is 0.0 or None compares system CPU times elapsed since last call or module import, returning immediately. In this case is recommended for accuracy that this function be called with at least 0.1 seconds between calls.<br>When <i>percpu</i> is True returns a list of floats representing the utilization as a percentage for each CPU. First element of the list refers to first CPU, second element to second CPU and so on. The order of the list is consistent across calls.
+</blockquote><p></p><hr><h3><a name="CPU"></a>CPU<a href="http://code.google.com/p/psutil/wiki/DocumentationDev?show=content#CPU" class="section_anchor"></a></h3><p>psutil.<strong>cpu_percent</strong><font size="3"><strong><tt>(</tt></strong></font><i>interval=0.1, percpu=False</i><font size="3"><strong><tt>)</tt></strong></font><br> </p><blockquote>Return a float representing the current system-wide CPU utilization as a percentage. When interval is &gt; 0.0 compares system CPU times elapsed before and after the interval (blocking). When interval is 0.0 or None compares system CPU times elapsed since last call or module import, returning immediately. In this case is recommended for accuracy that this function be called with at least 0.1 seconds between calls.<br>When <i>percpu</i> is True returns a list of floats representing the utilization as a percentage for each CPU. First element of the list refers to first CPU, second element to second CPU and so on. The order of the list is consistent across calls.
</blockquote><p></p><pre class="prettyprint">&gt;&gt;&gt; # blocking, system-wide
&gt;&gt;&gt; psutil.cpu_percent(interval=1)
2.0
@@ -127,14 +140,22 @@ usage(total=2097147904, used=4096, free=2097143808, percent=0.0)</pre><i><strong
</blockquote><p></p><blockquote><i><strong>Availability:</strong> Linux</i>
</blockquote><p>psutil.<strong>avail_phymem</strong><font size="3"><strong><tt>()</tt></strong></font><br> psutil.<strong>used_phymem</strong><font size="3"><strong><tt>()</tt></strong></font><br> psutil.<strong>total_virtmem</strong><font size="3"><strong><tt>()</tt></strong></font><br> psutil.<strong>avail_virtmem</strong><font size="3"><strong><tt>()</tt></strong></font><br> psutil.<strong>used_virtmem</strong><font size="3"><strong><tt>()</tt></strong></font><br> </p><blockquote>These functions are deprecated by <i>psutil.phymem_usage()</i> and <i>psutil.virtmem_usage()</i>. Use them instead.
</blockquote><p></p><blockquote><i><strong>Deprecated in 0.3.0</strong></i>
-</blockquote><hr><h3><a name="Disk"></a>Disk<a href="http://code.google.com/p/psutil/wiki/DocumentationDev?show=content#Disk" class="section_anchor"></a></h3><p>psutil.<strong>disk_partitions</strong><font size="3"><strong><tt>(</tt></strong></font><i>all=False</i><font size="3"><strong><tt>)</tt></strong></font><br> </p><blockquote>Return all mounted disk partitions as a list of namedtuples including device, mount point and filesystem type, similarly to "df" command on posix. <br>If <i>all</i> parameter is False return physical devices only (e.g. hard disks, cd-rom drives, USB keys) and ignore all others (e.g. memory partitions such as <a href="http://www.cyberciti.biz/tips/what-is-devshm-and-its-practical-usage.html" rel="nofollow">/dev/shm</a>).<br> Namedtuple's 'fstype' field is a string which varies depending on the platform. <br>On Linux it can be one of the values found in /proc/filesystems (e.g. 'ext3' for an ext3 hard drive o 'iso9660' for the CD-ROM drive). <br>On Windows it is determined via <a href="http://msdn.microsoft.com/en-us/library/aa364939(v=vs.85).aspx" rel="nofollow">GetDriveType</a> and can be either "removable", "fixed", "remote", "cdrom", "unmounted" or "ramdisk". <br>On OSX and FreeBSD it is retrieved via <a href="http://www.manpagez.com/man/2/getfsstat/" rel="nofollow">getfsstat(2)</a>. <br>See <a href="http://psutil.googlecode.com/svn/trunk/examples/disk_usage.py" rel="nofollow">examples/disk_usage.py</a> script providing an example usage.
-<p></p><pre class="prettyprint">&gt;&gt;&gt; psutil.get_partitions()
+</blockquote><hr><h3><a name="Disks"></a>Disks<a href="http://code.google.com/p/psutil/wiki/DocumentationDev?show=content#Disks" class="section_anchor"></a></h3><p>psutil.<strong>disk_partitions</strong><font size="3"><strong><tt>(</tt></strong></font><i>all=False</i><font size="3"><strong><tt>)</tt></strong></font><br> </p><blockquote>Return all mounted disk partitions as a list of namedtuples including device, mount point and filesystem type, similarly to "df" command on posix. <br>If <i>all</i> parameter is False return physical devices only (e.g. hard disks, cd-rom drives, USB keys) and ignore all others (e.g. memory partitions such as <a href="http://www.cyberciti.biz/tips/what-is-devshm-and-its-practical-usage.html" rel="nofollow">/dev/shm</a>).<br> Namedtuple's 'fstype' field is a string which varies depending on the platform. <br>On Linux it can be one of the values found in /proc/filesystems (e.g. 'ext3' for an ext3 hard drive o 'iso9660' for the CD-ROM drive). <br>On Windows it is determined via <a href="http://msdn.microsoft.com/en-us/library/aa364939(v=vs.85).aspx" rel="nofollow">GetDriveType</a> and can be either "removable", "fixed", "remote", "cdrom", "unmounted" or "ramdisk". <br>On OSX and FreeBSD it is retrieved via <a href="http://www.manpagez.com/man/2/getfsstat/" rel="nofollow">getfsstat(2)</a>. <br>See <a href="http://psutil.googlecode.com/svn/trunk/examples/disk_usage.py" rel="nofollow">examples/disk_usage.py</a> script providing an example usage.
+<p></p><pre class="prettyprint">&gt;&gt;&gt; psutil.disk_partitions()
[partition(device='/dev/sda3', mountpoint='/', fstype='ext4'),
partition(device='/dev/sda7', mountpoint='/home', fstype='ext4')]
&gt;&gt;&gt;</pre></blockquote><blockquote><i><strong>New in 0.3.0</strong></i>
</blockquote><p>psutil.<strong>disk_usage</strong><font size="3"><strong><tt>(</tt></strong></font><i>path</i><font size="3"><strong><tt>)</tt></strong></font><br> </p><blockquote>Return disk usage statistics about the given <i>path</i> as a namedtuple including total, used and free space expressed in bytes plus the percentage usage. OSError is raised if path does not exist. See <a href="http://psutil.googlecode.com/svn/trunk/examples/disk_usage.py" rel="nofollow">examples/disk_usage.py</a> script providing an example usage.
<p></p><pre class="prettyprint">&gt;&gt;&gt; psutil.disk_usage('/')
usage(total=21378641920, used=4809781248, free=15482871808, percent=22.5)</pre></blockquote><blockquote><i><strong>New in 0.3.0</strong></i>
+</blockquote><p>psutil.<strong>disk_io_counters</strong><font size="3"><strong><tt>(</tt></strong></font><i>perdisk=False</i><font size="3"><strong><tt>)</tt></strong></font><br> </p><blockquote>Return system disk I/O statistics as a namedtuple including the following attributes:
+<ul><li><strong>read_count</strong>: number of reads </li><li><strong>write_count</strong>: number of writes </li><li><strong>read_bytes</strong>: number of bytes read </li><li><strong>write_bytes</strong>: number of bytes written </li><li><strong>read_time</strong>: time spent reading from disk (in milliseconds) </li><li><strong>write_time</strong>: time spent writing to disk (in milliseconds) </li></ul></blockquote><p></p><blockquote>If perdisk is True return the same information for every physical disk installed on the system as a dictionary with partition ames as the keys and the namedutuple described above as the values.
+</blockquote><pre class="prettyprint">&gt;&gt;&gt; psutil.disk_io_counters()
+iostat(read_count=8141, write_count=2431, read_bytes=290203, write_bytes=537676, read_time=5868, write_time=94922)</pre><blockquote><i><strong>New in 0.4.0</strong></i>
+</blockquote><hr><h3><a name="Network"></a>Network<a href="http://code.google.com/p/psutil/wiki/DocumentationDev?show=content#Network" class="section_anchor"></a></h3><p>psutil.<strong>network_io_counters</strong><font size="3"><strong><tt>(</tt></strong></font><i>pernic=False</i><font size="3"><strong><tt>)</tt></strong></font><br> </p><blockquote>Return network I/O statistics as a namedtuple including the following attributes:
+<ul><li><strong>bytes_sent</strong>: number of bytes sent </li><li><strong>bytes_recv</strong>: number of bytes received </li><li><strong>packets_sent</strong>: number of packets sent </li><li><strong>packets_recv</strong>: number of packets received </li></ul></blockquote><p></p><blockquote>If pernic is True return the same information for every network interface installed on the system as a dictionary with network interface names as the keys and the namedtuple described above as the values.
+</blockquote><pre class="prettyprint">&gt;&gt;&gt; psutil.network_io_counters()
+iostat(bytes_sent=1270374, bytes_recv=7828365, packets_sent=9810, packets_recv=11794)</pre><blockquote><i><strong>New in 0.4.0</strong></i>
</blockquote><hr><h2><a name="Constants"></a>Constants<a href="http://code.google.com/p/psutil/wiki/DocumentationDev?show=content#Constants" class="section_anchor"></a></h2><p>psutil.<strong>TOTAL_PHYMEM</strong><br> </p><blockquote>The amount of total physical memory on the system, in bytes.
</blockquote><p></p><p>psutil.<strong>NUM_CPUS</strong><br> </p><blockquote>The number of CPUs on the system. This is preferable than using <tt>os.environ['NUMBER_OF_PROCESSORS']</tt> as it is more accurate and always available.
</blockquote><p></p><p>psutil.<strong>BOOT_TIME</strong><br> </p><blockquote>A number indicating the system boot time expressed in seconds since the epoch.
@@ -155,13 +176,20 @@ usage(total=21378641920, used=4809781248, free=15482871808, percent=22.5)</pre><
-<script type="text/javascript" src="./documentation_files/dit_scripts.js"></script>
+<script src="./DocumentationDev_files/googleapis.client__plusone.js"></script><script type="text/javascript" src="./DocumentationDev_files/dit_scripts.js"></script>
+
+ <script type="text/javascript">
+ _fetchOptions(
+ "", "psutil", "wikiOptions",
+ codesite_token, 1319284146);
+ _onload();
+ </script>
-<script type="text/javascript" src="./documentation_files/plusone.js">
+<script type="text/javascript" src="./DocumentationDev_files/plusone.js">
</script>
-</body></html>
+</body></html>

Powered by Google App Engine
This is Rietveld 408576698