<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.info.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'de',
  ),
  'this' => 
  array (
    0 => 'function.getrusage.php',
    1 => 'getrusage',
    2 => 'Liefert den aktuellen Wert der Ressourcenauslastung',
  ),
  'up' => 
  array (
    0 => 'ref.info.php',
    1 => 'PHP-Optionen-/-Informationen-Funktionen',
  ),
  'prev' => 
  array (
    0 => 'function.getopt.php',
    1 => 'getopt',
  ),
  'next' => 
  array (
    0 => 'function.ini-alter.php',
    1 => 'ini_alter',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'de',
    'path' => 'reference/info/functions/getrusage.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.getrusage" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">getrusage</h1>
  <p class="verinfo">(PHP 4, PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">getrusage</span> &mdash; <span class="dc-title">Liefert den aktuellen Wert der Ressourcenauslastung</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.getrusage-description">
  <h3 class="title">Beschreibung</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>getrusage</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$mode</code><span class="initializer"> = 0</span></span>): <span class="type"><span class="type"><a href="language.types.array.php" class="type array">array</a></span>|<span class="type"><a href="language.types.singleton.php" class="type false">false</a></span></span></div>

  <p class="para rdfs-comment">
   Dies ist eine Schnittstelle zu <strong class="command">getrusage(2)</strong>. Sie gibt
   die Daten des Systemaufrufs zurück.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.getrusage-parameters">
  <h3 class="title">Parameter-Liste</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">mode</code></dt>
     <dd>
      <p class="para">
       Ist <code class="parameter">mode</code> 1, wird getrusage mit
       <strong><code>RUSAGE_CHILDREN</code></strong> aufgerufen.
      </p>
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.getrusage-returnvalues">
  <h3 class="title">Rückgabewerte</h3>
  <p class="para">
   Gibt ein assoziatives Array mit den Daten zurück, die der Systemaufruf
   ausgibt. Alle Elemente sind unter Verwendung ihres dokumentierten
   Feldnamens zugreifbar.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.getrusage-examples">
  <h3 class="title">Beispiele</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>Beispiel #1 <span class="function"><strong>getrusage()</strong></span>-Beispiel</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />$dat </span><span style="color: #007700">= </span><span style="color: #0000BB">getrusage</span><span style="color: #007700">();<br />echo </span><span style="color: #0000BB">$dat</span><span style="color: #007700">[</span><span style="color: #DD0000">"ru_oublock"</span><span style="color: #007700">];       </span><span style="color: #FF8000">// Anzahl der Blockausgabeoperationen<br /></span><span style="color: #007700">echo </span><span style="color: #0000BB">$dat</span><span style="color: #007700">[</span><span style="color: #DD0000">"ru_inblock"</span><span style="color: #007700">];       </span><span style="color: #FF8000">// Anzahl der Blockeingabeoperationen<br /></span><span style="color: #007700">echo </span><span style="color: #0000BB">$dat</span><span style="color: #007700">[</span><span style="color: #DD0000">"ru_msgsnd"</span><span style="color: #007700">];        </span><span style="color: #FF8000">// Anzahl der gesendeten IPC-Nachrichten<br /></span><span style="color: #007700">echo </span><span style="color: #0000BB">$dat</span><span style="color: #007700">[</span><span style="color: #DD0000">"ru_msgrcv"</span><span style="color: #007700">];        </span><span style="color: #FF8000">// Anzahl der empfangenen IPC-Nachrichten<br /></span><span style="color: #007700">echo </span><span style="color: #0000BB">$dat</span><span style="color: #007700">[</span><span style="color: #DD0000">"ru_maxrss"</span><span style="color: #007700">];        </span><span style="color: #FF8000">// maximale Größe des residenten Speichers im RAM<br /></span><span style="color: #007700">echo </span><span style="color: #0000BB">$dat</span><span style="color: #007700">[</span><span style="color: #DD0000">"ru_ixrss"</span><span style="color: #007700">];         </span><span style="color: #FF8000">// Gesamtgröße des gemeinsam genutzen Speichers<br /></span><span style="color: #007700">echo </span><span style="color: #0000BB">$dat</span><span style="color: #007700">[</span><span style="color: #DD0000">"ru_idrss"</span><span style="color: #007700">];         </span><span style="color: #FF8000">// Gesamtgröße der nicht gemeinsam genutzten Daten<br /></span><span style="color: #007700">echo </span><span style="color: #0000BB">$dat</span><span style="color: #007700">[</span><span style="color: #DD0000">"ru_minflt"</span><span style="color: #007700">];        </span><span style="color: #FF8000">// Anzahl der wiederhergestellten Seiten (Soft Page Faults)<br /></span><span style="color: #007700">echo </span><span style="color: #0000BB">$dat</span><span style="color: #007700">[</span><span style="color: #DD0000">"ru_majflt"</span><span style="color: #007700">];        </span><span style="color: #FF8000">// Anzahl der Seitenfehler (Hard Page Faults)<br /></span><span style="color: #007700">echo </span><span style="color: #0000BB">$dat</span><span style="color: #007700">[</span><span style="color: #DD0000">"ru_nsignals"</span><span style="color: #007700">];      </span><span style="color: #FF8000">// Anzahl der empfangenen Signale<br /></span><span style="color: #007700">echo </span><span style="color: #0000BB">$dat</span><span style="color: #007700">[</span><span style="color: #DD0000">"ru_nvcsw"</span><span style="color: #007700">];         </span><span style="color: #FF8000">// Anzahl der freiwilligen Kontextwechsel<br /></span><span style="color: #007700">echo </span><span style="color: #0000BB">$dat</span><span style="color: #007700">[</span><span style="color: #DD0000">"ru_nivcsw"</span><span style="color: #007700">];        </span><span style="color: #FF8000">// Anzahl der unfreiwilligen Kontextwechsel<br /></span><span style="color: #007700">echo </span><span style="color: #0000BB">$dat</span><span style="color: #007700">[</span><span style="color: #DD0000">"ru_nswap"</span><span style="color: #007700">];         </span><span style="color: #FF8000">// Anzahl der Auslagerungen (Swaps)<br /></span><span style="color: #007700">echo </span><span style="color: #0000BB">$dat</span><span style="color: #007700">[</span><span style="color: #DD0000">"ru_utime.tv_usec"</span><span style="color: #007700">]; </span><span style="color: #FF8000">// verwendete Benutzerzeit (Mikrosekunden)<br /></span><span style="color: #007700">echo </span><span style="color: #0000BB">$dat</span><span style="color: #007700">[</span><span style="color: #DD0000">"ru_utime.tv_sec"</span><span style="color: #007700">];  </span><span style="color: #FF8000">// verwendete Benutzerzeit (Sekunden)<br /></span><span style="color: #007700">echo </span><span style="color: #0000BB">$dat</span><span style="color: #007700">[</span><span style="color: #DD0000">"ru_stime.tv_usec"</span><span style="color: #007700">]; </span><span style="color: #FF8000">// verwendete Systemzeit (Mikrosekunden)<br /></span><span style="color: #007700">echo </span><span style="color: #0000BB">$dat</span><span style="color: #007700">[</span><span style="color: #DD0000">"ru_stime.tv_sec"</span><span style="color: #007700">];  </span><span style="color: #FF8000">// verwendete Systemzeit (Sekunden)<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

   </div>
  </p>
 </div>


 <div class="refsect1 notes" id="refsect1-function.getrusage-notes">
  <h3 class="title">Anmerkungen</h3>
  <blockquote class="note"><p><strong class="note">Hinweis</strong>: 
   <p class="para">
    Unter Windows gibt <span class="function"><strong>getrusage()</strong></span> nur folgende Elemente
    zurück:
   </p>
   <p class="para">
    <ul class="simplelist">
     <li><code class="literal">&quot;ru_stime.tv_sec&quot;</code></li>
     <li><code class="literal">&quot;ru_stime.tv_usec&quot;</code></li>
     <li><code class="literal">&quot;ru_utime.tv_sec&quot;</code></li>
     <li><code class="literal">&quot;ru_utime.tv_usec&quot;</code></li>
     <li>
      <code class="literal">&quot;ru_majflt&quot;</code> (nur wenn <code class="parameter">mode</code>
      <strong><code>RUSAGE_SELF</code></strong> ist).
     </li>
     <li>
      <code class="literal">&quot;ru_maxrss&quot;</code> (nur wenn <code class="parameter">mode</code>
      <strong><code>RUSAGE_SELF</code></strong> ist).
     </li>
    </ul>
   </p>
   <p class="para">
    Wird <span class="function"><strong>getrusage()</strong></span> mit <code class="parameter">mode</code> als
    <code class="literal">1</code> (<strong><code>RUSAGE_CHILDREN</code></strong>) aufgerufen,
    dann wird der Ressourcenverbrauch der Threads zusammengefasst (was
    bedeutet, dass die Funktion intern mit <strong><code>RUSAGE_THREAD</code></strong>
    aufgerufen wird).
   </p>
  </p></blockquote>
  <blockquote class="note"><p><strong class="note">Hinweis</strong>: 
   <p class="para">
    Unter BeOS 2000 werden nur folgende Element zurückgegeben:
   </p>
   <p class="para">
    <ul class="simplelist">
     <li><code class="literal">&quot;ru_stime.tv_sec&quot;</code></li>
     <li><code class="literal">&quot;ru_stime.tv_usec&quot;</code></li>
     <li><code class="literal">&quot;ru_utime.tv_sec&quot;</code></li>
     <li><code class="literal">&quot;ru_utime.tv_usec&quot;</code></li>
    </ul>
   </p>
  </p></blockquote>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.getrusage-seealso">
  <h3 class="title">Siehe auch</h3>
  <p class="para">
   <ul class="simplelist">
    <li>Die Manpage zu <strong class="command">getrusage(2)</strong></li>
   </ul>
  </p>
 </div>


</div><?php manual_footer($setup); ?>