Blob Blame History Raw
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Process Time: Libgtop Reference Manual</title>
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot">
<link rel="home" href="index.html" title="Libgtop Reference Manual">
<link rel="up" href="libgtop-lib.html" title="Libgtop Library Reference">
<link rel="prev" href="libgtop-procuid.html" title="procuid">
<link rel="next" href="libgtop-signal.html" title="signal">
<meta name="generator" content="GTK-Doc V1.25 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
<td width="100%" align="left" class="shortcuts">
<a href="#" class="shortcut">Top</a><span id="nav_description">  <span class="dim">|</span> 
                  <a href="#libgtop-Process-Time.description" class="shortcut">Description</a></span>
</td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
<td><a accesskey="u" href="libgtop-lib.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
<td><a accesskey="p" href="libgtop-procuid.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
<td><a accesskey="n" href="libgtop-signal.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
</tr></table>
<div class="refentry">
<a name="libgtop-Process-Time"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="libgtop-Process-Time.top_of_page"></a>Process Time</span></h2>
<p>Process Time — Get process time information</p>
</td>
<td class="gallery_image" valign="top" align="right"></td>
</tr></table></div>
<div class="refsect1">
<a name="libgtop-Process-Time.stability-level"></a><h2>Stability Level</h2>
<a href="http://foldoc.org/Stable"><span class="acronym">Stable</span></a>, unless otherwise indicated
</div>
<div class="refsect1">
<a name="libgtop-Process-Time.functions"></a><h2>Functions</h2>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="functions_return">
<col class="functions_name">
</colgroup>
<tbody><tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="libgtop-Process-Time.html#glibtop-get-proc-time" title="glibtop_get_proc_time ()">glibtop_get_proc_time</a> <span class="c_punctuation">()</span>
</td>
</tr></tbody>
</table></div>
</div>
<div class="refsect1">
<a name="libgtop-Process-Time.other"></a><h2>Types and Values</h2>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="name">
<col class="description">
</colgroup>
<tbody><tr>
<td class="datatype_keyword">struct</td>
<td class="function_name"><a class="link" href="libgtop-Process-Time.html#glibtop-proc-time" title="struct glibtop_proc_time">glibtop_proc_time</a></td>
</tr></tbody>
</table></div>
</div>
<div class="refsect1">
<a name="libgtop-Process-Time.includes"></a><h2>Includes</h2>
<pre class="synopsis">#include &lt;glibtop/proctime.h&gt;
</pre>
</div>
<div class="refsect1">
<a name="libgtop-Process-Time.description"></a><h2>Description</h2>
</div>
<div class="refsect1">
<a name="libgtop-Process-Time.functions_details"></a><h2>Functions</h2>
<div class="refsect2">
<a name="glibtop-get-proc-time"></a><h3>glibtop_get_proc_time ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
glibtop_get_proc_time (<em class="parameter"><code><a class="link" href="libgtop-Process-Time.html#glibtop-proc-time" title="struct glibtop_proc_time"><span class="type">glibtop_proc_time</span></a> *buf</code></em>,
                       <em class="parameter"><code><span class="type">pid_t</span> pid</code></em>);</pre>
<p>Get process time information.</p>
<div class="refsect3">
<a name="glibtop-get-proc-time.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>buf</p></td>
<td class="parameter_description"><p>Returned process time information - see <a class="link" href="libgtop-Process-Time.html#glibtop-proc-time" title="struct glibtop_proc_time"><span class="type">glibtop_proc_time</span></a>.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>pid</p></td>
<td class="parameter_description"><p>Process id</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
</div>
</div>
<div class="refsect1">
<a name="libgtop-Process-Time.other_details"></a><h2>Types and Values</h2>
<div class="refsect2">
<a name="glibtop-proc-time"></a><h3>struct glibtop_proc_time</h3>
<pre class="programlisting">struct glibtop_proc_time {
	guint64 start_time;
	guint64 rtime;
	guint64 utime;
	guint64 stime;
	guint64 cutime;
	guint64 cstime;
	guint64 timeout;
	guint64 it_real_value;
	guint64 frequency;
	guint64 xcpu_utime [GLIBTOP_NCPU];
	guint64 xcpu_stime [GLIBTOP_NCPU];
};
</pre>
<p>Process time data filled by <a class="link" href="libgtop-Process-Time.html#glibtop-get-proc-time" title="glibtop_get_proc_time ()"><code class="function">glibtop_get_proc_time()</code></a>.</p>
<p>Under Linux the <em class="parameter"><code>start_time</code></em>
 value may be wrong due to the information
available from the kernel.</p>
<p>The Linux kernel defines <span class="type">INITIAL_JIFFIES</span> which implies a time
shift. Because <span class="type">INITIAL_JIFFIES</span> is not user-space defined,
we cannot use it to compute an accurate <em class="parameter"><code>start_time</code></em>
. On Linux 2.6,</p>
<span class="type">INITIAL_JIFFIES</span> is 300 so <em class="parameter"><code>start_time</code></em> is 
<p>always 3s different from the real start time of the given process. You 
may also get shift results if your system clock is not synchronised 
with your hardware clock. See <span class="command"><strong>man hwclock</strong></span>.</p>
<div class="refsect3">
<a name="glibtop-proc-time.members"></a><h4>Members</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="300px" class="struct_members_name">
<col class="struct_members_description">
<col width="200px" class="struct_members_annotations">
</colgroup>
<tbody>
<tr>
<td class="struct_member_name"><p><a href="/usr/share/gtk-doc/html/glibglib-Basic-Types.html#guint64"><span class="type">guint64</span></a> <em class="structfield"><code><a name="glibtop-proc-time.start-time"></a>start_time</code></em>;</p></td>
<td class="struct_member_description"><p>Start time of process in seconds since the epoch.</p></td>
<td class="struct_member_annotations"> </td>
</tr>
<tr>
<td class="struct_member_name"><p><a href="/usr/share/gtk-doc/html/glibglib-Basic-Types.html#guint64"><span class="type">guint64</span></a> <em class="structfield"><code><a name="glibtop-proc-time.rtime"></a>rtime</code></em>;</p></td>
<td class="struct_member_description"><p>Real time accumulated by process (should be <em class="parameter"><code>utime</code></em>
+ <em class="parameter"><code>stime</code></em>
).</p></td>
<td class="struct_member_annotations"> </td>
</tr>
<tr>
<td class="struct_member_name"><p><a href="/usr/share/gtk-doc/html/glibglib-Basic-Types.html#guint64"><span class="type">guint64</span></a> <em class="structfield"><code><a name="glibtop-proc-time.utime"></a>utime</code></em>;</p></td>
<td class="struct_member_description"><p>User-mode CPU time accumulated by process.</p></td>
<td class="struct_member_annotations"> </td>
</tr>
<tr>
<td class="struct_member_name"><p><a href="/usr/share/gtk-doc/html/glibglib-Basic-Types.html#guint64"><span class="type">guint64</span></a> <em class="structfield"><code><a name="glibtop-proc-time.stime"></a>stime</code></em>;</p></td>
<td class="struct_member_description"><p>Kernel-mode CPU time accumulated by process.</p></td>
<td class="struct_member_annotations"> </td>
</tr>
<tr>
<td class="struct_member_name"><p><a href="/usr/share/gtk-doc/html/glibglib-Basic-Types.html#guint64"><span class="type">guint64</span></a> <em class="structfield"><code><a name="glibtop-proc-time.cutime"></a>cutime</code></em>;</p></td>
<td class="struct_member_description"><p>Cumulative utime of process and reaped children.</p></td>
<td class="struct_member_annotations"> </td>
</tr>
<tr>
<td class="struct_member_name"><p><a href="/usr/share/gtk-doc/html/glibglib-Basic-Types.html#guint64"><span class="type">guint64</span></a> <em class="structfield"><code><a name="glibtop-proc-time.cstime"></a>cstime</code></em>;</p></td>
<td class="struct_member_description"><p>Cumulative stime of process and reaped children.</p></td>
<td class="struct_member_annotations"> </td>
</tr>
<tr>
<td class="struct_member_name"><p><a href="/usr/share/gtk-doc/html/glibglib-Basic-Types.html#guint64"><span class="type">guint64</span></a> <em class="structfield"><code><a name="glibtop-proc-time.timeout"></a>timeout</code></em>;</p></td>
<td class="struct_member_description"><p>The time (in jiffies) of the process’s next timeout.</p></td>
<td class="struct_member_annotations"> </td>
</tr>
<tr>
<td class="struct_member_name"><p><a href="/usr/share/gtk-doc/html/glibglib-Basic-Types.html#guint64"><span class="type">guint64</span></a> <em class="structfield"><code><a name="glibtop-proc-time.it-real-value"></a>it_real_value</code></em>;</p></td>
<td class="struct_member_description"><p>The time (in jiffies) before the next <span class="type">SIGALRM</span>
is sent to the process due to an interval timer.</p></td>
<td class="struct_member_annotations"> </td>
</tr>
<tr>
<td class="struct_member_name"><p><a href="/usr/share/gtk-doc/html/glibglib-Basic-Types.html#guint64"><span class="type">guint64</span></a> <em class="structfield"><code><a name="glibtop-proc-time.frequency"></a>frequency</code></em>;</p></td>
<td class="struct_member_description"><p>Tick frequency.</p></td>
<td class="struct_member_annotations"> </td>
</tr>
<tr>
<td class="struct_member_name"><p><a href="/usr/share/gtk-doc/html/glibglib-Basic-Types.html#guint64"><span class="type">guint64</span></a> <em class="structfield"><code><a name="glibtop-proc-time.xcpu-utime"></a>xcpu_utime</code></em>[GLIBTOP_NCPU];</p></td>
<td class="struct_member_description"><p>SMP user-mode CPU time accumulated by process.</p></td>
<td class="struct_member_annotations"> </td>
</tr>
<tr>
<td class="struct_member_name"><p><a href="/usr/share/gtk-doc/html/glibglib-Basic-Types.html#guint64"><span class="type">guint64</span></a> <em class="structfield"><code><a name="glibtop-proc-time.xcpu-stime"></a>xcpu_stime</code></em>[GLIBTOP_NCPU];</p></td>
<td class="struct_member_description"><p>SMP kernel-mode CPU time accumulated by process </p></td>
<td class="struct_member_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
</div>
</div>
</div>
<div class="footer">
<hr>Generated by GTK-Doc V1.25</div>
</body>
</html>