proctime

## proctime proctime |

## Synopsis

    #include <glibtop/proctime.h>

    #define             GLIBTOP_PROC_TIME_START_TIME
    #define             GLIBTOP_PROC_TIME_RTIME
    #define             GLIBTOP_PROC_TIME_UTIME
    #define             GLIBTOP_PROC_TIME_STIME
    #define             GLIBTOP_PROC_TIME_CUTIME
    #define             GLIBTOP_PROC_TIME_CSTIME
    #define             GLIBTOP_PROC_TIME_TIMEOUT
    #define             GLIBTOP_PROC_TIME_IT_REAL_VALUE
    #define             GLIBTOP_PROC_TIME_FREQUENCY
    #define             GLIBTOP_PROC_TIME_XCPU_UTIME
    #define             GLIBTOP_PROC_TIME_XCPU_STIME
    #define             GLIBTOP_MAX_PROC_TIME
                        glibtop_proc_time;
    void                glibtop_get_proc_time               (glibtop_proc_time *buf,
                                                             pid_t pid);
    #define             glibtop_get_proc_time_r
    void                glibtop_get_proc_time_l             (glibtop *server,
                                                             glibtop_proc_time *buf,
                                                             pid_t pid);
    void                glibtop_get_proc_time_p             (glibtop *server,
                                                             glibtop_proc_time *buf,
                                                             pid_t pid);
    void                glibtop_get_proc_time_s             (glibtop *server,
                                                             glibtop_proc_time *buf,
                                                             pid_t pid);

## Description

## Details

### GLIBTOP_PROC_TIME_START_TIME

    #define GLIBTOP_PROC_TIME_START_TIME 0

### GLIBTOP_PROC_TIME_RTIME

    #define GLIBTOP_PROC_TIME_RTIME		1

### GLIBTOP_PROC_TIME_UTIME

    #define GLIBTOP_PROC_TIME_UTIME		2

### GLIBTOP_PROC_TIME_STIME

    #define GLIBTOP_PROC_TIME_STIME		3

### GLIBTOP_PROC_TIME_CUTIME

    #define GLIBTOP_PROC_TIME_CUTIME 4

### GLIBTOP_PROC_TIME_CSTIME

    #define GLIBTOP_PROC_TIME_CSTIME 5

### GLIBTOP_PROC_TIME_TIMEOUT

    #define GLIBTOP_PROC_TIME_TIMEOUT 6

### GLIBTOP_PROC_TIME_IT_REAL_VALUE

    #define GLIBTOP_PROC_TIME_IT_REAL_VALUE 7

### GLIBTOP_PROC_TIME_FREQUENCY

    #define GLIBTOP_PROC_TIME_FREQUENCY 8

### GLIBTOP_PROC_TIME_XCPU_UTIME

    #define GLIBTOP_PROC_TIME_XCPU_UTIME 9

### GLIBTOP_PROC_TIME_XCPU_STIME

    #define GLIBTOP_PROC_TIME_XCPU_STIME 10

### GLIBTOP_MAX_PROC_TIME

    #define GLIBTOP_MAX_PROC_TIME		11

### glibtop_proc_time

    typedef struct {
    	guint64 flags;
    	guint64 start_time; /* start time of process --
    				 * seconds since 1-1-70 */
    	guint64 rtime;		/* real time accumulated by process */
    	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]; /* utime and stime for all CPUs on */
    	guint64 xcpu_stime [GLIBTOP_NCPU]; /* SMP machines. */
    } glibtop_proc_time;

### glibtop_get_proc_time ()

    void                glibtop_get_proc_time               (glibtop_proc_time *buf,
                                                             pid_t pid);

Please note that under Linux, start_time value may be strange. Linux kernel defines INITIAL_JIFFIES which implies a time shift. Because INITIAL_JIFFIES is not user-space defined, we cannot use it to compute accurate `code`{start_time}. On Linux2.6, INITIAL_JIFFIES is 300 so start_time is always 3s different from 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.

`buf` : |
`pid` : | Process id to get the user and tty information

### glibtop_get_proc_time_r

    #define             glibtop_get_proc_time_r

### glibtop_get_proc_time_l ()

    void                glibtop_get_proc_time_l             (glibtop *server,
                                                             glibtop_proc_time *buf,
                                                             pid_t pid);

`server` : |
`buf` : |
`pid` : |

### glibtop_get_proc_time_p ()

    void                glibtop_get_proc_time_p             (glibtop *server,
                                                             glibtop_proc_time *buf,
                                                             pid_t pid);

`server` : |
`buf` : |
`pid` : |

### glibtop_get_proc_time_s ()

    void                glibtop_get_proc_time_s             (glibtop *server,
                                                             glibtop_proc_time *buf,
                                                             pid_t pid);

`server` : |
`buf` : |
`pid` : |