gooderp18绿色标准版
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

782 行
51KB

  1. <!DOCTYPE html>
  2. <html lang="en" data-content_root="../">
  3. <head>
  4. <meta charset="utf-8" />
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
  6. <meta property="og:title" content="resource — Resource usage information" />
  7. <meta property="og:type" content="website" />
  8. <meta property="og:url" content="https://docs.python.org/3/library/resource.html" />
  9. <meta property="og:site_name" content="Python documentation" />
  10. <meta property="og:description" content="This module provides basic mechanisms for measuring and controlling system resources utilized by a program. Availability: Unix, not Emscripten, not WASI. Symbolic constants are used to specify part..." />
  11. <meta property="og:image" content="https://docs.python.org/3/_static/og-image.png" />
  12. <meta property="og:image:alt" content="Python documentation" />
  13. <meta name="description" content="This module provides basic mechanisms for measuring and controlling system resources utilized by a program. Availability: Unix, not Emscripten, not WASI. Symbolic constants are used to specify part..." />
  14. <meta property="og:image:width" content="200" />
  15. <meta property="og:image:height" content="200" />
  16. <meta name="theme-color" content="#3776ab" />
  17. <title>resource — Resource usage information &#8212; Python 3.12.3 documentation</title><meta name="viewport" content="width=device-width, initial-scale=1.0">
  18. <link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=80d5e7a1" />
  19. <link rel="stylesheet" type="text/css" href="../_static/pydoctheme.css?v=bb723527" />
  20. <link id="pygments_dark_css" media="(prefers-color-scheme: dark)" rel="stylesheet" type="text/css" href="../_static/pygments_dark.css?v=b20cc3f5" />
  21. <script src="../_static/documentation_options.js?v=2c828074"></script>
  22. <script src="../_static/doctools.js?v=888ff710"></script>
  23. <script src="../_static/sphinx_highlight.js?v=dc90522c"></script>
  24. <script src="../_static/sidebar.js"></script>
  25. <link rel="search" type="application/opensearchdescription+xml"
  26. title="Search within Python 3.12.3 documentation"
  27. href="../_static/opensearch.xml"/>
  28. <link rel="author" title="About these documents" href="../about.html" />
  29. <link rel="index" title="Index" href="../genindex.html" />
  30. <link rel="search" title="Search" href="../search.html" />
  31. <link rel="copyright" title="Copyright" href="../copyright.html" />
  32. <link rel="next" title="syslog — Unix syslog library routines" href="syslog.html" />
  33. <link rel="prev" title="fcntl — The fcntl and ioctl system calls" href="fcntl.html" />
  34. <link rel="canonical" href="https://docs.python.org/3/library/resource.html" />
  35. <style>
  36. @media only screen {
  37. table.full-width-table {
  38. width: 100%;
  39. }
  40. }
  41. </style>
  42. <link rel="stylesheet" href="../_static/pydoctheme_dark.css" media="(prefers-color-scheme: dark)" id="pydoctheme_dark_css">
  43. <link rel="shortcut icon" type="image/png" href="../_static/py.svg" />
  44. <script type="text/javascript" src="../_static/copybutton.js"></script>
  45. <script type="text/javascript" src="../_static/menu.js"></script>
  46. <script type="text/javascript" src="../_static/search-focus.js"></script>
  47. <script type="text/javascript" src="../_static/themetoggle.js"></script>
  48. </head>
  49. <body>
  50. <div class="mobile-nav">
  51. <input type="checkbox" id="menuToggler" class="toggler__input" aria-controls="navigation"
  52. aria-pressed="false" aria-expanded="false" role="button" aria-label="Menu" />
  53. <nav class="nav-content" role="navigation">
  54. <label for="menuToggler" class="toggler__label">
  55. <span></span>
  56. </label>
  57. <span class="nav-items-wrapper">
  58. <a href="https://www.python.org/" class="nav-logo">
  59. <img src="../_static/py.svg" alt="Python logo"/>
  60. </a>
  61. <span class="version_switcher_placeholder"></span>
  62. <form role="search" class="search" action="../search.html" method="get">
  63. <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" class="search-icon">
  64. <path fill-rule="nonzero" fill="currentColor" d="M15.5 14h-.79l-.28-.27a6.5 6.5 0 001.48-5.34c-.47-2.78-2.79-5-5.59-5.34a6.505 6.505 0 00-7.27 7.27c.34 2.8 2.56 5.12 5.34 5.59a6.5 6.5 0 005.34-1.48l.27.28v.79l4.25 4.25c.41.41 1.08.41 1.49 0 .41-.41.41-1.08 0-1.49L15.5 14zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"></path>
  65. </svg>
  66. <input placeholder="Quick search" aria-label="Quick search" type="search" name="q" />
  67. <input type="submit" value="Go"/>
  68. </form>
  69. </span>
  70. </nav>
  71. <div class="menu-wrapper">
  72. <nav class="menu" role="navigation" aria-label="main navigation">
  73. <div class="language_switcher_placeholder"></div>
  74. <label class="theme-selector-label">
  75. Theme
  76. <select class="theme-selector" oninput="activateTheme(this.value)">
  77. <option value="auto" selected>Auto</option>
  78. <option value="light">Light</option>
  79. <option value="dark">Dark</option>
  80. </select>
  81. </label>
  82. <div>
  83. <h3><a href="../contents.html">Table of Contents</a></h3>
  84. <ul>
  85. <li><a class="reference internal" href="#"><code class="xref py py-mod docutils literal notranslate"><span class="pre">resource</span></code> — Resource usage information</a><ul>
  86. <li><a class="reference internal" href="#resource-limits">Resource Limits</a></li>
  87. <li><a class="reference internal" href="#resource-usage">Resource Usage</a></li>
  88. </ul>
  89. </li>
  90. </ul>
  91. </div>
  92. <div>
  93. <h4>Previous topic</h4>
  94. <p class="topless"><a href="fcntl.html"
  95. title="previous chapter"><code class="xref py py-mod docutils literal notranslate"><span class="pre">fcntl</span></code> — The <code class="docutils literal notranslate"><span class="pre">fcntl</span></code> and <code class="docutils literal notranslate"><span class="pre">ioctl</span></code> system calls</a></p>
  96. </div>
  97. <div>
  98. <h4>Next topic</h4>
  99. <p class="topless"><a href="syslog.html"
  100. title="next chapter"><code class="xref py py-mod docutils literal notranslate"><span class="pre">syslog</span></code> — Unix syslog library routines</a></p>
  101. </div>
  102. <div role="note" aria-label="source link">
  103. <h3>This Page</h3>
  104. <ul class="this-page-menu">
  105. <li><a href="../bugs.html">Report a Bug</a></li>
  106. <li>
  107. <a href="https://github.com/python/cpython/blob/main/Doc/library/resource.rst"
  108. rel="nofollow">Show Source
  109. </a>
  110. </li>
  111. </ul>
  112. </div>
  113. </nav>
  114. </div>
  115. </div>
  116. <div class="related" role="navigation" aria-label="related navigation">
  117. <h3>Navigation</h3>
  118. <ul>
  119. <li class="right" style="margin-right: 10px">
  120. <a href="../genindex.html" title="General Index"
  121. accesskey="I">index</a></li>
  122. <li class="right" >
  123. <a href="../py-modindex.html" title="Python Module Index"
  124. >modules</a> |</li>
  125. <li class="right" >
  126. <a href="syslog.html" title="syslog — Unix syslog library routines"
  127. accesskey="N">next</a> |</li>
  128. <li class="right" >
  129. <a href="fcntl.html" title="fcntl — The fcntl and ioctl system calls"
  130. accesskey="P">previous</a> |</li>
  131. <li><img src="../_static/py.svg" alt="Python logo" style="vertical-align: middle; margin-top: -1px"/></li>
  132. <li><a href="https://www.python.org/">Python</a> &#187;</li>
  133. <li class="switchers">
  134. <div class="language_switcher_placeholder"></div>
  135. <div class="version_switcher_placeholder"></div>
  136. </li>
  137. <li>
  138. </li>
  139. <li id="cpython-language-and-version">
  140. <a href="../index.html">3.12.3 Documentation</a> &#187;
  141. </li>
  142. <li class="nav-item nav-item-1"><a href="index.html" >The Python Standard Library</a> &#187;</li>
  143. <li class="nav-item nav-item-2"><a href="unix.html" accesskey="U">Unix Specific Services</a> &#187;</li>
  144. <li class="nav-item nav-item-this"><a href=""><code class="xref py py-mod docutils literal notranslate"><span class="pre">resource</span></code> — Resource usage information</a></li>
  145. <li class="right">
  146. <div class="inline-search" role="search">
  147. <form class="inline-search" action="../search.html" method="get">
  148. <input placeholder="Quick search" aria-label="Quick search" type="search" name="q" id="search-box" />
  149. <input type="submit" value="Go" />
  150. </form>
  151. </div>
  152. |
  153. </li>
  154. <li class="right">
  155. <label class="theme-selector-label">
  156. Theme
  157. <select class="theme-selector" oninput="activateTheme(this.value)">
  158. <option value="auto" selected>Auto</option>
  159. <option value="light">Light</option>
  160. <option value="dark">Dark</option>
  161. </select>
  162. </label> |</li>
  163. </ul>
  164. </div>
  165. <div class="document">
  166. <div class="documentwrapper">
  167. <div class="bodywrapper">
  168. <div class="body" role="main">
  169. <section id="module-resource">
  170. <span id="resource-resource-usage-information"></span><h1><a class="reference internal" href="#module-resource" title="resource: An interface to provide resource usage information on the current process. (Unix)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">resource</span></code></a> — Resource usage information<a class="headerlink" href="#module-resource" title="Link to this heading">¶</a></h1>
  171. <hr class="docutils" />
  172. <p>This module provides basic mechanisms for measuring and controlling system
  173. resources utilized by a program.</p>
  174. <div class="availability docutils container">
  175. <p><a class="reference internal" href="intro.html#availability"><span class="std std-ref">Availability</span></a>: Unix, not Emscripten, not WASI.</p>
  176. </div>
  177. <p>Symbolic constants are used to specify particular system resources and to
  178. request usage information about either the current process or its children.</p>
  179. <p>An <a class="reference internal" href="exceptions.html#OSError" title="OSError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">OSError</span></code></a> is raised on syscall failure.</p>
  180. <dl class="py exception">
  181. <dt class="sig sig-object py" id="resource.error">
  182. <em class="property"><span class="pre">exception</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">resource.</span></span><span class="sig-name descname"><span class="pre">error</span></span><a class="headerlink" href="#resource.error" title="Link to this definition">¶</a></dt>
  183. <dd><p>A deprecated alias of <a class="reference internal" href="exceptions.html#OSError" title="OSError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">OSError</span></code></a>.</p>
  184. <div class="versionchanged">
  185. <p><span class="versionmodified changed">Changed in version 3.3: </span>Following <span class="target" id="index-0"></span><a class="pep reference external" href="https://peps.python.org/pep-3151/"><strong>PEP 3151</strong></a>, this class was made an alias of <a class="reference internal" href="exceptions.html#OSError" title="OSError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">OSError</span></code></a>.</p>
  186. </div>
  187. </dd></dl>
  188. <section id="resource-limits">
  189. <h2>Resource Limits<a class="headerlink" href="#resource-limits" title="Link to this heading">¶</a></h2>
  190. <p>Resources usage can be limited using the <a class="reference internal" href="#resource.setrlimit" title="resource.setrlimit"><code class="xref py py-func docutils literal notranslate"><span class="pre">setrlimit()</span></code></a> function described
  191. below. Each resource is controlled by a pair of limits: a soft limit and a hard
  192. limit. The soft limit is the current limit, and may be lowered or raised by a
  193. process over time. The soft limit can never exceed the hard limit. The hard
  194. limit can be lowered to any value greater than the soft limit, but not raised.
  195. (Only processes with the effective UID of the super-user can raise a hard
  196. limit.)</p>
  197. <p>The specific resources that can be limited are system dependent. They are
  198. described in the <em class="manpage"><a class="manpage reference external" href="https://manpages.debian.org/getrlimit(2)">getrlimit(2)</a></em> man page. The resources listed below
  199. are supported when the underlying operating system supports them; resources
  200. which cannot be checked or controlled by the operating system are not defined in
  201. this module for those platforms.</p>
  202. <dl class="py data">
  203. <dt class="sig sig-object py" id="resource.RLIM_INFINITY">
  204. <span class="sig-prename descclassname"><span class="pre">resource.</span></span><span class="sig-name descname"><span class="pre">RLIM_INFINITY</span></span><a class="headerlink" href="#resource.RLIM_INFINITY" title="Link to this definition">¶</a></dt>
  205. <dd><p>Constant used to represent the limit for an unlimited resource.</p>
  206. </dd></dl>
  207. <dl class="py function">
  208. <dt class="sig sig-object py" id="resource.getrlimit">
  209. <span class="sig-prename descclassname"><span class="pre">resource.</span></span><span class="sig-name descname"><span class="pre">getrlimit</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">resource</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#resource.getrlimit" title="Link to this definition">¶</a></dt>
  210. <dd><p>Returns a tuple <code class="docutils literal notranslate"><span class="pre">(soft,</span> <span class="pre">hard)</span></code> with the current soft and hard limits of
  211. <em>resource</em>. Raises <a class="reference internal" href="exceptions.html#ValueError" title="ValueError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">ValueError</span></code></a> if an invalid resource is specified, or
  212. <a class="reference internal" href="#resource.error" title="resource.error"><code class="xref py py-exc docutils literal notranslate"><span class="pre">error</span></code></a> if the underlying system call fails unexpectedly.</p>
  213. </dd></dl>
  214. <dl class="py function">
  215. <dt class="sig sig-object py" id="resource.setrlimit">
  216. <span class="sig-prename descclassname"><span class="pre">resource.</span></span><span class="sig-name descname"><span class="pre">setrlimit</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">resource</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">limits</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#resource.setrlimit" title="Link to this definition">¶</a></dt>
  217. <dd><p>Sets new limits of consumption of <em>resource</em>. The <em>limits</em> argument must be a
  218. tuple <code class="docutils literal notranslate"><span class="pre">(soft,</span> <span class="pre">hard)</span></code> of two integers describing the new limits. A value of
  219. <a class="reference internal" href="#resource.RLIM_INFINITY" title="resource.RLIM_INFINITY"><code class="xref py py-data docutils literal notranslate"><span class="pre">RLIM_INFINITY</span></code></a> can be used to request a limit that is
  220. unlimited.</p>
  221. <p>Raises <a class="reference internal" href="exceptions.html#ValueError" title="ValueError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">ValueError</span></code></a> if an invalid resource is specified, if the new soft
  222. limit exceeds the hard limit, or if a process tries to raise its hard limit.
  223. Specifying a limit of <a class="reference internal" href="#resource.RLIM_INFINITY" title="resource.RLIM_INFINITY"><code class="xref py py-data docutils literal notranslate"><span class="pre">RLIM_INFINITY</span></code></a> when the hard or
  224. system limit for that resource is not unlimited will result in a
  225. <a class="reference internal" href="exceptions.html#ValueError" title="ValueError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">ValueError</span></code></a>. A process with the effective UID of super-user can
  226. request any valid limit value, including unlimited, but <a class="reference internal" href="exceptions.html#ValueError" title="ValueError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">ValueError</span></code></a>
  227. will still be raised if the requested limit exceeds the system imposed
  228. limit.</p>
  229. <p><code class="docutils literal notranslate"><span class="pre">setrlimit</span></code> may also raise <a class="reference internal" href="#resource.error" title="resource.error"><code class="xref py py-exc docutils literal notranslate"><span class="pre">error</span></code></a> if the underlying system call
  230. fails.</p>
  231. <p>VxWorks only supports setting <a class="reference internal" href="#resource.RLIMIT_NOFILE" title="resource.RLIMIT_NOFILE"><code class="xref py py-data docutils literal notranslate"><span class="pre">RLIMIT_NOFILE</span></code></a>.</p>
  232. <p class="audit-hook">Raises an <a class="reference internal" href="sys.html#auditing"><span class="std std-ref">auditing event</span></a> <code class="docutils literal notranslate"><span class="pre">resource.setrlimit</span></code> with arguments <code class="docutils literal notranslate"><span class="pre">resource</span></code>, <code class="docutils literal notranslate"><span class="pre">limits</span></code>.</p>
  233. </dd></dl>
  234. <dl class="py function">
  235. <dt class="sig sig-object py" id="resource.prlimit">
  236. <span class="sig-prename descclassname"><span class="pre">resource.</span></span><span class="sig-name descname"><span class="pre">prlimit</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">pid</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">resource</span></span></em><span class="optional">[</span>, <em class="sig-param"><span class="n"><span class="pre">limits</span></span></em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#resource.prlimit" title="Link to this definition">¶</a></dt>
  237. <dd><p>Combines <a class="reference internal" href="#resource.setrlimit" title="resource.setrlimit"><code class="xref py py-func docutils literal notranslate"><span class="pre">setrlimit()</span></code></a> and <a class="reference internal" href="#resource.getrlimit" title="resource.getrlimit"><code class="xref py py-func docutils literal notranslate"><span class="pre">getrlimit()</span></code></a> in one function and
  238. supports to get and set the resources limits of an arbitrary process. If
  239. <em>pid</em> is 0, then the call applies to the current process. <em>resource</em> and
  240. <em>limits</em> have the same meaning as in <a class="reference internal" href="#resource.setrlimit" title="resource.setrlimit"><code class="xref py py-func docutils literal notranslate"><span class="pre">setrlimit()</span></code></a>, except that
  241. <em>limits</em> is optional.</p>
  242. <p>When <em>limits</em> is not given the function returns the <em>resource</em> limit of the
  243. process <em>pid</em>. When <em>limits</em> is given the <em>resource</em> limit of the process is
  244. set and the former resource limit is returned.</p>
  245. <p>Raises <a class="reference internal" href="exceptions.html#ProcessLookupError" title="ProcessLookupError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">ProcessLookupError</span></code></a> when <em>pid</em> can’t be found and
  246. <a class="reference internal" href="exceptions.html#PermissionError" title="PermissionError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">PermissionError</span></code></a> when the user doesn’t have <code class="docutils literal notranslate"><span class="pre">CAP_SYS_RESOURCE</span></code> for
  247. the process.</p>
  248. <p class="audit-hook">Raises an <a class="reference internal" href="sys.html#auditing"><span class="std std-ref">auditing event</span></a> <code class="docutils literal notranslate"><span class="pre">resource.prlimit</span></code> with arguments <code class="docutils literal notranslate"><span class="pre">pid</span></code>, <code class="docutils literal notranslate"><span class="pre">resource</span></code>, <code class="docutils literal notranslate"><span class="pre">limits</span></code>.</p>
  249. <div class="availability docutils container">
  250. <p><a class="reference internal" href="intro.html#availability"><span class="std std-ref">Availability</span></a>: Linux &gt;= 2.6.36 with glibc &gt;= 2.13.</p>
  251. </div>
  252. <div class="versionadded">
  253. <p><span class="versionmodified added">New in version 3.4.</span></p>
  254. </div>
  255. </dd></dl>
  256. <p>These symbols define resources whose consumption can be controlled using the
  257. <a class="reference internal" href="#resource.setrlimit" title="resource.setrlimit"><code class="xref py py-func docutils literal notranslate"><span class="pre">setrlimit()</span></code></a> and <a class="reference internal" href="#resource.getrlimit" title="resource.getrlimit"><code class="xref py py-func docutils literal notranslate"><span class="pre">getrlimit()</span></code></a> functions described below. The values of
  258. these symbols are exactly the constants used by C programs.</p>
  259. <p>The Unix man page for <em class="manpage"><a class="manpage reference external" href="https://manpages.debian.org/getrlimit(2)">getrlimit(2)</a></em> lists the available resources.
  260. Note that not all systems use the same symbol or same value to denote the same
  261. resource. This module does not attempt to mask platform differences — symbols
  262. not defined for a platform will not be available from this module on that
  263. platform.</p>
  264. <dl class="py data">
  265. <dt class="sig sig-object py" id="resource.RLIMIT_CORE">
  266. <span class="sig-prename descclassname"><span class="pre">resource.</span></span><span class="sig-name descname"><span class="pre">RLIMIT_CORE</span></span><a class="headerlink" href="#resource.RLIMIT_CORE" title="Link to this definition">¶</a></dt>
  267. <dd><p>The maximum size (in bytes) of a core file that the current process can create.
  268. This may result in the creation of a partial core file if a larger core would be
  269. required to contain the entire process image.</p>
  270. </dd></dl>
  271. <dl class="py data">
  272. <dt class="sig sig-object py" id="resource.RLIMIT_CPU">
  273. <span class="sig-prename descclassname"><span class="pre">resource.</span></span><span class="sig-name descname"><span class="pre">RLIMIT_CPU</span></span><a class="headerlink" href="#resource.RLIMIT_CPU" title="Link to this definition">¶</a></dt>
  274. <dd><p>The maximum amount of processor time (in seconds) that a process can use. If
  275. this limit is exceeded, a <code class="xref py py-const docutils literal notranslate"><span class="pre">SIGXCPU</span></code> signal is sent to the process. (See
  276. the <a class="reference internal" href="signal.html#module-signal" title="signal: Set handlers for asynchronous events."><code class="xref py py-mod docutils literal notranslate"><span class="pre">signal</span></code></a> module documentation for information about how to catch this
  277. signal and do something useful, e.g. flush open files to disk.)</p>
  278. </dd></dl>
  279. <dl class="py data">
  280. <dt class="sig sig-object py" id="resource.RLIMIT_FSIZE">
  281. <span class="sig-prename descclassname"><span class="pre">resource.</span></span><span class="sig-name descname"><span class="pre">RLIMIT_FSIZE</span></span><a class="headerlink" href="#resource.RLIMIT_FSIZE" title="Link to this definition">¶</a></dt>
  282. <dd><p>The maximum size of a file which the process may create.</p>
  283. </dd></dl>
  284. <dl class="py data">
  285. <dt class="sig sig-object py" id="resource.RLIMIT_DATA">
  286. <span class="sig-prename descclassname"><span class="pre">resource.</span></span><span class="sig-name descname"><span class="pre">RLIMIT_DATA</span></span><a class="headerlink" href="#resource.RLIMIT_DATA" title="Link to this definition">¶</a></dt>
  287. <dd><p>The maximum size (in bytes) of the process’s heap.</p>
  288. </dd></dl>
  289. <dl class="py data">
  290. <dt class="sig sig-object py" id="resource.RLIMIT_STACK">
  291. <span class="sig-prename descclassname"><span class="pre">resource.</span></span><span class="sig-name descname"><span class="pre">RLIMIT_STACK</span></span><a class="headerlink" href="#resource.RLIMIT_STACK" title="Link to this definition">¶</a></dt>
  292. <dd><p>The maximum size (in bytes) of the call stack for the current process. This only
  293. affects the stack of the main thread in a multi-threaded process.</p>
  294. </dd></dl>
  295. <dl class="py data">
  296. <dt class="sig sig-object py" id="resource.RLIMIT_RSS">
  297. <span class="sig-prename descclassname"><span class="pre">resource.</span></span><span class="sig-name descname"><span class="pre">RLIMIT_RSS</span></span><a class="headerlink" href="#resource.RLIMIT_RSS" title="Link to this definition">¶</a></dt>
  298. <dd><p>The maximum resident set size that should be made available to the process.</p>
  299. </dd></dl>
  300. <dl class="py data">
  301. <dt class="sig sig-object py" id="resource.RLIMIT_NPROC">
  302. <span class="sig-prename descclassname"><span class="pre">resource.</span></span><span class="sig-name descname"><span class="pre">RLIMIT_NPROC</span></span><a class="headerlink" href="#resource.RLIMIT_NPROC" title="Link to this definition">¶</a></dt>
  303. <dd><p>The maximum number of processes the current process may create.</p>
  304. </dd></dl>
  305. <dl class="py data">
  306. <dt class="sig sig-object py" id="resource.RLIMIT_NOFILE">
  307. <span class="sig-prename descclassname"><span class="pre">resource.</span></span><span class="sig-name descname"><span class="pre">RLIMIT_NOFILE</span></span><a class="headerlink" href="#resource.RLIMIT_NOFILE" title="Link to this definition">¶</a></dt>
  308. <dd><p>The maximum number of open file descriptors for the current process.</p>
  309. </dd></dl>
  310. <dl class="py data">
  311. <dt class="sig sig-object py" id="resource.RLIMIT_OFILE">
  312. <span class="sig-prename descclassname"><span class="pre">resource.</span></span><span class="sig-name descname"><span class="pre">RLIMIT_OFILE</span></span><a class="headerlink" href="#resource.RLIMIT_OFILE" title="Link to this definition">¶</a></dt>
  313. <dd><p>The BSD name for <a class="reference internal" href="#resource.RLIMIT_NOFILE" title="resource.RLIMIT_NOFILE"><code class="xref py py-const docutils literal notranslate"><span class="pre">RLIMIT_NOFILE</span></code></a>.</p>
  314. </dd></dl>
  315. <dl class="py data">
  316. <dt class="sig sig-object py" id="resource.RLIMIT_MEMLOCK">
  317. <span class="sig-prename descclassname"><span class="pre">resource.</span></span><span class="sig-name descname"><span class="pre">RLIMIT_MEMLOCK</span></span><a class="headerlink" href="#resource.RLIMIT_MEMLOCK" title="Link to this definition">¶</a></dt>
  318. <dd><p>The maximum address space which may be locked in memory.</p>
  319. </dd></dl>
  320. <dl class="py data">
  321. <dt class="sig sig-object py" id="resource.RLIMIT_VMEM">
  322. <span class="sig-prename descclassname"><span class="pre">resource.</span></span><span class="sig-name descname"><span class="pre">RLIMIT_VMEM</span></span><a class="headerlink" href="#resource.RLIMIT_VMEM" title="Link to this definition">¶</a></dt>
  323. <dd><p>The largest area of mapped memory which the process may occupy.</p>
  324. <div class="availability docutils container">
  325. <p><a class="reference internal" href="intro.html#availability"><span class="std std-ref">Availability</span></a>: FreeBSD &gt;= 11.</p>
  326. </div>
  327. </dd></dl>
  328. <dl class="py data">
  329. <dt class="sig sig-object py" id="resource.RLIMIT_AS">
  330. <span class="sig-prename descclassname"><span class="pre">resource.</span></span><span class="sig-name descname"><span class="pre">RLIMIT_AS</span></span><a class="headerlink" href="#resource.RLIMIT_AS" title="Link to this definition">¶</a></dt>
  331. <dd><p>The maximum area (in bytes) of address space which may be taken by the process.</p>
  332. </dd></dl>
  333. <dl class="py data">
  334. <dt class="sig sig-object py" id="resource.RLIMIT_MSGQUEUE">
  335. <span class="sig-prename descclassname"><span class="pre">resource.</span></span><span class="sig-name descname"><span class="pre">RLIMIT_MSGQUEUE</span></span><a class="headerlink" href="#resource.RLIMIT_MSGQUEUE" title="Link to this definition">¶</a></dt>
  336. <dd><p>The number of bytes that can be allocated for POSIX message queues.</p>
  337. <div class="availability docutils container">
  338. <p><a class="reference internal" href="intro.html#availability"><span class="std std-ref">Availability</span></a>: Linux &gt;= 2.6.8.</p>
  339. </div>
  340. <div class="versionadded">
  341. <p><span class="versionmodified added">New in version 3.4.</span></p>
  342. </div>
  343. </dd></dl>
  344. <dl class="py data">
  345. <dt class="sig sig-object py" id="resource.RLIMIT_NICE">
  346. <span class="sig-prename descclassname"><span class="pre">resource.</span></span><span class="sig-name descname"><span class="pre">RLIMIT_NICE</span></span><a class="headerlink" href="#resource.RLIMIT_NICE" title="Link to this definition">¶</a></dt>
  347. <dd><p>The ceiling for the process’s nice level (calculated as 20 - rlim_cur).</p>
  348. <div class="availability docutils container">
  349. <p><a class="reference internal" href="intro.html#availability"><span class="std std-ref">Availability</span></a>: Linux &gt;= 2.6.12.</p>
  350. </div>
  351. <div class="versionadded">
  352. <p><span class="versionmodified added">New in version 3.4.</span></p>
  353. </div>
  354. </dd></dl>
  355. <dl class="py data">
  356. <dt class="sig sig-object py" id="resource.RLIMIT_RTPRIO">
  357. <span class="sig-prename descclassname"><span class="pre">resource.</span></span><span class="sig-name descname"><span class="pre">RLIMIT_RTPRIO</span></span><a class="headerlink" href="#resource.RLIMIT_RTPRIO" title="Link to this definition">¶</a></dt>
  358. <dd><p>The ceiling of the real-time priority.</p>
  359. <div class="availability docutils container">
  360. <p><a class="reference internal" href="intro.html#availability"><span class="std std-ref">Availability</span></a>: Linux &gt;= 2.6.12.</p>
  361. </div>
  362. <div class="versionadded">
  363. <p><span class="versionmodified added">New in version 3.4.</span></p>
  364. </div>
  365. </dd></dl>
  366. <dl class="py data">
  367. <dt class="sig sig-object py" id="resource.RLIMIT_RTTIME">
  368. <span class="sig-prename descclassname"><span class="pre">resource.</span></span><span class="sig-name descname"><span class="pre">RLIMIT_RTTIME</span></span><a class="headerlink" href="#resource.RLIMIT_RTTIME" title="Link to this definition">¶</a></dt>
  369. <dd><p>The time limit (in microseconds) on CPU time that a process can spend
  370. under real-time scheduling without making a blocking syscall.</p>
  371. <div class="availability docutils container">
  372. <p><a class="reference internal" href="intro.html#availability"><span class="std std-ref">Availability</span></a>: Linux &gt;= 2.6.25.</p>
  373. </div>
  374. <div class="versionadded">
  375. <p><span class="versionmodified added">New in version 3.4.</span></p>
  376. </div>
  377. </dd></dl>
  378. <dl class="py data">
  379. <dt class="sig sig-object py" id="resource.RLIMIT_SIGPENDING">
  380. <span class="sig-prename descclassname"><span class="pre">resource.</span></span><span class="sig-name descname"><span class="pre">RLIMIT_SIGPENDING</span></span><a class="headerlink" href="#resource.RLIMIT_SIGPENDING" title="Link to this definition">¶</a></dt>
  381. <dd><p>The number of signals which the process may queue.</p>
  382. <div class="availability docutils container">
  383. <p><a class="reference internal" href="intro.html#availability"><span class="std std-ref">Availability</span></a>: Linux &gt;= 2.6.8.</p>
  384. </div>
  385. <div class="versionadded">
  386. <p><span class="versionmodified added">New in version 3.4.</span></p>
  387. </div>
  388. </dd></dl>
  389. <dl class="py data">
  390. <dt class="sig sig-object py" id="resource.RLIMIT_SBSIZE">
  391. <span class="sig-prename descclassname"><span class="pre">resource.</span></span><span class="sig-name descname"><span class="pre">RLIMIT_SBSIZE</span></span><a class="headerlink" href="#resource.RLIMIT_SBSIZE" title="Link to this definition">¶</a></dt>
  392. <dd><p>The maximum size (in bytes) of socket buffer usage for this user.
  393. This limits the amount of network memory, and hence the amount of mbufs,
  394. that this user may hold at any time.</p>
  395. <div class="availability docutils container">
  396. <p><a class="reference internal" href="intro.html#availability"><span class="std std-ref">Availability</span></a>: FreeBSD.</p>
  397. </div>
  398. <div class="versionadded">
  399. <p><span class="versionmodified added">New in version 3.4.</span></p>
  400. </div>
  401. </dd></dl>
  402. <dl class="py data">
  403. <dt class="sig sig-object py" id="resource.RLIMIT_SWAP">
  404. <span class="sig-prename descclassname"><span class="pre">resource.</span></span><span class="sig-name descname"><span class="pre">RLIMIT_SWAP</span></span><a class="headerlink" href="#resource.RLIMIT_SWAP" title="Link to this definition">¶</a></dt>
  405. <dd><p>The maximum size (in bytes) of the swap space that may be reserved or
  406. used by all of this user id’s processes.
  407. This limit is enforced only if bit 1 of the vm.overcommit sysctl is set.
  408. Please see
  409. <a class="reference external" href="https://man.freebsd.org/cgi/man.cgi?query=tuning&amp;sektion=7">tuning(7)</a>
  410. for a complete description of this sysctl.</p>
  411. <div class="availability docutils container">
  412. <p><a class="reference internal" href="intro.html#availability"><span class="std std-ref">Availability</span></a>: FreeBSD.</p>
  413. </div>
  414. <div class="versionadded">
  415. <p><span class="versionmodified added">New in version 3.4.</span></p>
  416. </div>
  417. </dd></dl>
  418. <dl class="py data">
  419. <dt class="sig sig-object py" id="resource.RLIMIT_NPTS">
  420. <span class="sig-prename descclassname"><span class="pre">resource.</span></span><span class="sig-name descname"><span class="pre">RLIMIT_NPTS</span></span><a class="headerlink" href="#resource.RLIMIT_NPTS" title="Link to this definition">¶</a></dt>
  421. <dd><p>The maximum number of pseudo-terminals created by this user id.</p>
  422. <div class="availability docutils container">
  423. <p><a class="reference internal" href="intro.html#availability"><span class="std std-ref">Availability</span></a>: FreeBSD.</p>
  424. </div>
  425. <div class="versionadded">
  426. <p><span class="versionmodified added">New in version 3.4.</span></p>
  427. </div>
  428. </dd></dl>
  429. <dl class="py data">
  430. <dt class="sig sig-object py" id="resource.RLIMIT_KQUEUES">
  431. <span class="sig-prename descclassname"><span class="pre">resource.</span></span><span class="sig-name descname"><span class="pre">RLIMIT_KQUEUES</span></span><a class="headerlink" href="#resource.RLIMIT_KQUEUES" title="Link to this definition">¶</a></dt>
  432. <dd><p>The maximum number of kqueues this user id is allowed to create.</p>
  433. <div class="availability docutils container">
  434. <p><a class="reference internal" href="intro.html#availability"><span class="std std-ref">Availability</span></a>: FreeBSD &gt;= 11.</p>
  435. </div>
  436. <div class="versionadded">
  437. <p><span class="versionmodified added">New in version 3.10.</span></p>
  438. </div>
  439. </dd></dl>
  440. </section>
  441. <section id="resource-usage">
  442. <h2>Resource Usage<a class="headerlink" href="#resource-usage" title="Link to this heading">¶</a></h2>
  443. <p>These functions are used to retrieve resource usage information:</p>
  444. <dl class="py function">
  445. <dt class="sig sig-object py" id="resource.getrusage">
  446. <span class="sig-prename descclassname"><span class="pre">resource.</span></span><span class="sig-name descname"><span class="pre">getrusage</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">who</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#resource.getrusage" title="Link to this definition">¶</a></dt>
  447. <dd><p>This function returns an object that describes the resources consumed by either
  448. the current process or its children, as specified by the <em>who</em> parameter. The
  449. <em>who</em> parameter should be specified using one of the <code class="xref py py-const docutils literal notranslate"><span class="pre">RUSAGE_*</span></code>
  450. constants described below.</p>
  451. <p>A simple example:</p>
  452. <div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">resource</span> <span class="kn">import</span> <span class="o">*</span>
  453. <span class="kn">import</span> <span class="nn">time</span>
  454. <span class="c1"># a non CPU-bound task</span>
  455. <span class="n">time</span><span class="o">.</span><span class="n">sleep</span><span class="p">(</span><span class="mi">3</span><span class="p">)</span>
  456. <span class="nb">print</span><span class="p">(</span><span class="n">getrusage</span><span class="p">(</span><span class="n">RUSAGE_SELF</span><span class="p">))</span>
  457. <span class="c1"># a CPU-bound task</span>
  458. <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">10</span> <span class="o">**</span> <span class="mi">8</span><span class="p">):</span>
  459. <span class="n">_</span> <span class="o">=</span> <span class="mi">1</span> <span class="o">+</span> <span class="mi">1</span>
  460. <span class="nb">print</span><span class="p">(</span><span class="n">getrusage</span><span class="p">(</span><span class="n">RUSAGE_SELF</span><span class="p">))</span>
  461. </pre></div>
  462. </div>
  463. <p>The fields of the return value each describe how a particular system resource
  464. has been used, e.g. amount of time spent running is user mode or number of times
  465. the process was swapped out of main memory. Some values are dependent on the
  466. clock tick internal, e.g. the amount of memory the process is using.</p>
  467. <p>For backward compatibility, the return value is also accessible as a tuple of 16
  468. elements.</p>
  469. <p>The fields <code class="xref py py-attr docutils literal notranslate"><span class="pre">ru_utime</span></code> and <code class="xref py py-attr docutils literal notranslate"><span class="pre">ru_stime</span></code> of the return value are
  470. floating point values representing the amount of time spent executing in user
  471. mode and the amount of time spent executing in system mode, respectively. The
  472. remaining values are integers. Consult the <em class="manpage"><a class="manpage reference external" href="https://manpages.debian.org/getrusage(2)">getrusage(2)</a></em> man page for
  473. detailed information about these values. A brief summary is presented here:</p>
  474. <table class="docutils align-default">
  475. <thead>
  476. <tr class="row-odd"><th class="head"><p>Index</p></th>
  477. <th class="head"><p>Field</p></th>
  478. <th class="head"><p>Resource</p></th>
  479. </tr>
  480. </thead>
  481. <tbody>
  482. <tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">0</span></code></p></td>
  483. <td><p><code class="xref py py-attr docutils literal notranslate"><span class="pre">ru_utime</span></code></p></td>
  484. <td><p>time in user mode (float seconds)</p></td>
  485. </tr>
  486. <tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">1</span></code></p></td>
  487. <td><p><code class="xref py py-attr docutils literal notranslate"><span class="pre">ru_stime</span></code></p></td>
  488. <td><p>time in system mode (float seconds)</p></td>
  489. </tr>
  490. <tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">2</span></code></p></td>
  491. <td><p><code class="xref py py-attr docutils literal notranslate"><span class="pre">ru_maxrss</span></code></p></td>
  492. <td><p>maximum resident set size</p></td>
  493. </tr>
  494. <tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">3</span></code></p></td>
  495. <td><p><code class="xref py py-attr docutils literal notranslate"><span class="pre">ru_ixrss</span></code></p></td>
  496. <td><p>shared memory size</p></td>
  497. </tr>
  498. <tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">4</span></code></p></td>
  499. <td><p><code class="xref py py-attr docutils literal notranslate"><span class="pre">ru_idrss</span></code></p></td>
  500. <td><p>unshared memory size</p></td>
  501. </tr>
  502. <tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">5</span></code></p></td>
  503. <td><p><code class="xref py py-attr docutils literal notranslate"><span class="pre">ru_isrss</span></code></p></td>
  504. <td><p>unshared stack size</p></td>
  505. </tr>
  506. <tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">6</span></code></p></td>
  507. <td><p><code class="xref py py-attr docutils literal notranslate"><span class="pre">ru_minflt</span></code></p></td>
  508. <td><p>page faults not requiring I/O</p></td>
  509. </tr>
  510. <tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">7</span></code></p></td>
  511. <td><p><code class="xref py py-attr docutils literal notranslate"><span class="pre">ru_majflt</span></code></p></td>
  512. <td><p>page faults requiring I/O</p></td>
  513. </tr>
  514. <tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">8</span></code></p></td>
  515. <td><p><code class="xref py py-attr docutils literal notranslate"><span class="pre">ru_nswap</span></code></p></td>
  516. <td><p>number of swap outs</p></td>
  517. </tr>
  518. <tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">9</span></code></p></td>
  519. <td><p><code class="xref py py-attr docutils literal notranslate"><span class="pre">ru_inblock</span></code></p></td>
  520. <td><p>block input operations</p></td>
  521. </tr>
  522. <tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">10</span></code></p></td>
  523. <td><p><code class="xref py py-attr docutils literal notranslate"><span class="pre">ru_oublock</span></code></p></td>
  524. <td><p>block output operations</p></td>
  525. </tr>
  526. <tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">11</span></code></p></td>
  527. <td><p><code class="xref py py-attr docutils literal notranslate"><span class="pre">ru_msgsnd</span></code></p></td>
  528. <td><p>messages sent</p></td>
  529. </tr>
  530. <tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">12</span></code></p></td>
  531. <td><p><code class="xref py py-attr docutils literal notranslate"><span class="pre">ru_msgrcv</span></code></p></td>
  532. <td><p>messages received</p></td>
  533. </tr>
  534. <tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">13</span></code></p></td>
  535. <td><p><code class="xref py py-attr docutils literal notranslate"><span class="pre">ru_nsignals</span></code></p></td>
  536. <td><p>signals received</p></td>
  537. </tr>
  538. <tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">14</span></code></p></td>
  539. <td><p><code class="xref py py-attr docutils literal notranslate"><span class="pre">ru_nvcsw</span></code></p></td>
  540. <td><p>voluntary context switches</p></td>
  541. </tr>
  542. <tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">15</span></code></p></td>
  543. <td><p><code class="xref py py-attr docutils literal notranslate"><span class="pre">ru_nivcsw</span></code></p></td>
  544. <td><p>involuntary context switches</p></td>
  545. </tr>
  546. </tbody>
  547. </table>
  548. <p>This function will raise a <a class="reference internal" href="exceptions.html#ValueError" title="ValueError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">ValueError</span></code></a> if an invalid <em>who</em> parameter is
  549. specified. It may also raise <a class="reference internal" href="#resource.error" title="resource.error"><code class="xref py py-exc docutils literal notranslate"><span class="pre">error</span></code></a> exception in unusual circumstances.</p>
  550. </dd></dl>
  551. <dl class="py function">
  552. <dt class="sig sig-object py" id="resource.getpagesize">
  553. <span class="sig-prename descclassname"><span class="pre">resource.</span></span><span class="sig-name descname"><span class="pre">getpagesize</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#resource.getpagesize" title="Link to this definition">¶</a></dt>
  554. <dd><p>Returns the number of bytes in a system page. (This need not be the same as the
  555. hardware page size.)</p>
  556. </dd></dl>
  557. <p>The following <code class="xref py py-const docutils literal notranslate"><span class="pre">RUSAGE_*</span></code> symbols are passed to the <a class="reference internal" href="#resource.getrusage" title="resource.getrusage"><code class="xref py py-func docutils literal notranslate"><span class="pre">getrusage()</span></code></a>
  558. function to specify which processes information should be provided for.</p>
  559. <dl class="py data">
  560. <dt class="sig sig-object py" id="resource.RUSAGE_SELF">
  561. <span class="sig-prename descclassname"><span class="pre">resource.</span></span><span class="sig-name descname"><span class="pre">RUSAGE_SELF</span></span><a class="headerlink" href="#resource.RUSAGE_SELF" title="Link to this definition">¶</a></dt>
  562. <dd><p>Pass to <a class="reference internal" href="#resource.getrusage" title="resource.getrusage"><code class="xref py py-func docutils literal notranslate"><span class="pre">getrusage()</span></code></a> to request resources consumed by the calling
  563. process, which is the sum of resources used by all threads in the process.</p>
  564. </dd></dl>
  565. <dl class="py data">
  566. <dt class="sig sig-object py" id="resource.RUSAGE_CHILDREN">
  567. <span class="sig-prename descclassname"><span class="pre">resource.</span></span><span class="sig-name descname"><span class="pre">RUSAGE_CHILDREN</span></span><a class="headerlink" href="#resource.RUSAGE_CHILDREN" title="Link to this definition">¶</a></dt>
  568. <dd><p>Pass to <a class="reference internal" href="#resource.getrusage" title="resource.getrusage"><code class="xref py py-func docutils literal notranslate"><span class="pre">getrusage()</span></code></a> to request resources consumed by child processes
  569. of the calling process which have been terminated and waited for.</p>
  570. </dd></dl>
  571. <dl class="py data">
  572. <dt class="sig sig-object py" id="resource.RUSAGE_BOTH">
  573. <span class="sig-prename descclassname"><span class="pre">resource.</span></span><span class="sig-name descname"><span class="pre">RUSAGE_BOTH</span></span><a class="headerlink" href="#resource.RUSAGE_BOTH" title="Link to this definition">¶</a></dt>
  574. <dd><p>Pass to <a class="reference internal" href="#resource.getrusage" title="resource.getrusage"><code class="xref py py-func docutils literal notranslate"><span class="pre">getrusage()</span></code></a> to request resources consumed by both the current
  575. process and child processes. May not be available on all systems.</p>
  576. </dd></dl>
  577. <dl class="py data">
  578. <dt class="sig sig-object py" id="resource.RUSAGE_THREAD">
  579. <span class="sig-prename descclassname"><span class="pre">resource.</span></span><span class="sig-name descname"><span class="pre">RUSAGE_THREAD</span></span><a class="headerlink" href="#resource.RUSAGE_THREAD" title="Link to this definition">¶</a></dt>
  580. <dd><p>Pass to <a class="reference internal" href="#resource.getrusage" title="resource.getrusage"><code class="xref py py-func docutils literal notranslate"><span class="pre">getrusage()</span></code></a> to request resources consumed by the current
  581. thread. May not be available on all systems.</p>
  582. <div class="versionadded">
  583. <p><span class="versionmodified added">New in version 3.2.</span></p>
  584. </div>
  585. </dd></dl>
  586. </section>
  587. </section>
  588. <div class="clearer"></div>
  589. </div>
  590. </div>
  591. </div>
  592. <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
  593. <div class="sphinxsidebarwrapper">
  594. <div>
  595. <h3><a href="../contents.html">Table of Contents</a></h3>
  596. <ul>
  597. <li><a class="reference internal" href="#"><code class="xref py py-mod docutils literal notranslate"><span class="pre">resource</span></code> — Resource usage information</a><ul>
  598. <li><a class="reference internal" href="#resource-limits">Resource Limits</a></li>
  599. <li><a class="reference internal" href="#resource-usage">Resource Usage</a></li>
  600. </ul>
  601. </li>
  602. </ul>
  603. </div>
  604. <div>
  605. <h4>Previous topic</h4>
  606. <p class="topless"><a href="fcntl.html"
  607. title="previous chapter"><code class="xref py py-mod docutils literal notranslate"><span class="pre">fcntl</span></code> — The <code class="docutils literal notranslate"><span class="pre">fcntl</span></code> and <code class="docutils literal notranslate"><span class="pre">ioctl</span></code> system calls</a></p>
  608. </div>
  609. <div>
  610. <h4>Next topic</h4>
  611. <p class="topless"><a href="syslog.html"
  612. title="next chapter"><code class="xref py py-mod docutils literal notranslate"><span class="pre">syslog</span></code> — Unix syslog library routines</a></p>
  613. </div>
  614. <div role="note" aria-label="source link">
  615. <h3>This Page</h3>
  616. <ul class="this-page-menu">
  617. <li><a href="../bugs.html">Report a Bug</a></li>
  618. <li>
  619. <a href="https://github.com/python/cpython/blob/main/Doc/library/resource.rst"
  620. rel="nofollow">Show Source
  621. </a>
  622. </li>
  623. </ul>
  624. </div>
  625. </div>
  626. <div id="sidebarbutton" title="Collapse sidebar">
  627. <span>«</span>
  628. </div>
  629. </div>
  630. <div class="clearer"></div>
  631. </div>
  632. <div class="related" role="navigation" aria-label="related navigation">
  633. <h3>Navigation</h3>
  634. <ul>
  635. <li class="right" style="margin-right: 10px">
  636. <a href="../genindex.html" title="General Index"
  637. >index</a></li>
  638. <li class="right" >
  639. <a href="../py-modindex.html" title="Python Module Index"
  640. >modules</a> |</li>
  641. <li class="right" >
  642. <a href="syslog.html" title="syslog — Unix syslog library routines"
  643. >next</a> |</li>
  644. <li class="right" >
  645. <a href="fcntl.html" title="fcntl — The fcntl and ioctl system calls"
  646. >previous</a> |</li>
  647. <li><img src="../_static/py.svg" alt="Python logo" style="vertical-align: middle; margin-top: -1px"/></li>
  648. <li><a href="https://www.python.org/">Python</a> &#187;</li>
  649. <li class="switchers">
  650. <div class="language_switcher_placeholder"></div>
  651. <div class="version_switcher_placeholder"></div>
  652. </li>
  653. <li>
  654. </li>
  655. <li id="cpython-language-and-version">
  656. <a href="../index.html">3.12.3 Documentation</a> &#187;
  657. </li>
  658. <li class="nav-item nav-item-1"><a href="index.html" >The Python Standard Library</a> &#187;</li>
  659. <li class="nav-item nav-item-2"><a href="unix.html" >Unix Specific Services</a> &#187;</li>
  660. <li class="nav-item nav-item-this"><a href=""><code class="xref py py-mod docutils literal notranslate"><span class="pre">resource</span></code> — Resource usage information</a></li>
  661. <li class="right">
  662. <div class="inline-search" role="search">
  663. <form class="inline-search" action="../search.html" method="get">
  664. <input placeholder="Quick search" aria-label="Quick search" type="search" name="q" id="search-box" />
  665. <input type="submit" value="Go" />
  666. </form>
  667. </div>
  668. |
  669. </li>
  670. <li class="right">
  671. <label class="theme-selector-label">
  672. Theme
  673. <select class="theme-selector" oninput="activateTheme(this.value)">
  674. <option value="auto" selected>Auto</option>
  675. <option value="light">Light</option>
  676. <option value="dark">Dark</option>
  677. </select>
  678. </label> |</li>
  679. </ul>
  680. </div>
  681. <div class="footer">
  682. &copy;
  683. <a href="../copyright.html">
  684. Copyright
  685. </a>
  686. 2001-2024, Python Software Foundation.
  687. <br />
  688. This page is licensed under the Python Software Foundation License Version 2.
  689. <br />
  690. Examples, recipes, and other code in the documentation are additionally licensed under the Zero Clause BSD License.
  691. <br />
  692. See <a href="/license.html">History and License</a> for more information.<br />
  693. <br />
  694. The Python Software Foundation is a non-profit corporation.
  695. <a href="https://www.python.org/psf/donations/">Please donate.</a>
  696. <br />
  697. <br />
  698. Last updated on Apr 09, 2024 (13:47 UTC).
  699. <a href="/bugs.html">Found a bug</a>?
  700. <br />
  701. Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 7.2.6.
  702. </div>
  703. </body>
  704. </html>
上海开阖软件有限公司 沪ICP备12045867号-1