## Process Time Process Time — Get process time information |

## Stability Level

Stable, unless otherwise indicated

## Functions

void | glibtop_get_proc_time ()

## Types and Values

struct | glibtop_proc_time

## Includes

    #include <glibtop/proctime.h>

## Description

## Functions

### glibtop_get_proc_time ()

    void
    glibtop_get_proc_time (glibtop_proc_time *buf,
                           pid_t pid);

Get process time information.

#### Parameters

buf | Returned process time information - see glibtop_proc_time. |
pid | Process id |

## Types and Values

### struct glibtop_proc_time

    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];
    };

Process time data filled by `glibtop_get_proc_time()`.

Under Linux the `start_time` value may be wrong due to the information available from the kernel.

The Linux kernel defines INITIAL_JIFFIES which implies a time shift. Because INITIAL_JIFFIES is not user-space defined, we cannot use it to compute an accurate `start_time` . On Linux 2.6,

INITIAL_JIFFIES is 300 so `start_time` is

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 man hwclock.

#### Members

guint64 `start_time`; | Start time of process in seconds since the epoch. |
guint64 `rtime`; | Real time accumulated by process (should be `utime` + `stime` ). |
guint64 `utime`; | User-mode CPU time accumulated by process. |
guint64 `stime`; | Kernel-mode CPU time accumulated by process. |
guint64 `cutime`; | Cumulative utime of process and reaped children. |
guint64 `cstime`; | Cumulative stime of process and reaped children. |
guint64 `timeout`; | The time (in jiffies) of the process’s next timeout. |
guint64 `it_real_value`; | The time (in jiffies) before the next SIGALRM is sent to the process due to an interval timer. |
guint64 `frequency`; | Tick frequency. |
guint64 `xcpu_utime`[GLIBTOP_NCPU]; | SMP user-mode CPU time accumulated by process. |
guint64 `xcpu_stime`[GLIBTOP_NCPU]; | SMP kernel-mode CPU time accumulated by process |