Blame include/glibtop/proctime.h

Packit Service 407539
/* Copyright (C) 1998-99 Martin Baulig
Packit Service 407539
   This file is part of LibGTop 1.0.
Packit Service 407539
Packit Service 407539
   Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
Packit Service 407539
Packit Service 407539
   LibGTop is free software; you can redistribute it and/or modify it
Packit Service 407539
   under the terms of the GNU General Public License as published by
Packit Service 407539
   the Free Software Foundation; either version 2 of the License,
Packit Service 407539
   or (at your option) any later version.
Packit Service 407539
Packit Service 407539
   LibGTop is distributed in the hope that it will be useful, but WITHOUT
Packit Service 407539
   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
Packit Service 407539
   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
Packit Service 407539
   for more details.
Packit Service 407539
Packit Service 407539
   You should have received a copy of the GNU General Public License
Packit Service 407539
   along with LibGTop; see the file COPYING. If not, write to the
Packit Service 407539
   Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Packit Service 407539
   Boston, MA 02110-1301, USA.
Packit Service 407539
*/
Packit Service 407539
Packit Service 407539
#ifndef __GLIBTOP_PROCTIME_H__
Packit Service 407539
#define __GLIBTOP_PROCTIME_H__
Packit Service 407539
Packit Service 407539
#include <glibtop.h>
Packit Service 407539
#include <glibtop/cpu.h>
Packit Service 407539
#include <glibtop/global.h>
Packit Service 407539
Packit Service 407539
G_BEGIN_DECLS
Packit Service 407539
Packit Service 407539
#define GLIBTOP_PROC_TIME_START_TIME	0
Packit Service 407539
#define GLIBTOP_PROC_TIME_RTIME		1
Packit Service 407539
#define GLIBTOP_PROC_TIME_UTIME		2
Packit Service 407539
#define GLIBTOP_PROC_TIME_STIME		3
Packit Service 407539
#define GLIBTOP_PROC_TIME_CUTIME	4
Packit Service 407539
#define GLIBTOP_PROC_TIME_CSTIME	5
Packit Service 407539
#define GLIBTOP_PROC_TIME_TIMEOUT	6
Packit Service 407539
#define GLIBTOP_PROC_TIME_IT_REAL_VALUE	7
Packit Service 407539
#define GLIBTOP_PROC_TIME_FREQUENCY	8
Packit Service 407539
#define GLIBTOP_PROC_TIME_XCPU_UTIME	9
Packit Service 407539
#define GLIBTOP_PROC_TIME_XCPU_STIME	10
Packit Service 407539
Packit Service 407539
#define GLIBTOP_MAX_PROC_TIME		11
Packit Service 407539
Packit Service 407539
typedef struct _glibtop_proc_time	glibtop_proc_time;
Packit Service 407539
Packit Service 407539
/* Time section */
Packit Service 407539
Packit Service 407539
/**
Packit Service 407539
 * glibtop_proc_time:
Packit Service 407539
 * @start_time: Start time of process in seconds since the epoch.
Packit Service 407539
 * @rtime: Real time accumulated by process (should be @utime + @stime).
Packit Service 407539
 * @utime: User-mode CPU time accumulated by process.
Packit Service 407539
 * @stime: Kernel-mode CPU time accumulated by process.
Packit Service 407539
 * @cutime: Cumulative utime of process and reaped children.
Packit Service 407539
 * @cstime: Cumulative stime of process and reaped children.
Packit Service 407539
 * @timeout: The time (in jiffies) of the process’s next timeout.
Packit Service 407539
 * @it_real_value: The time (in jiffies) before the next <type>SIGALRM</type>
Packit Service 407539
 * is sent to the process due to an interval timer.
Packit Service 407539
 * @frequency: Tick frequency.
Packit Service 407539
 * @xcpu_utime: SMP user-mode CPU time accumulated by process.
Packit Service 407539
 * @xcpu_stime: SMP kernel-mode CPU time accumulated by process 
Packit Service 407539
 *
Packit Service 407539
 * Process time data filled by glibtop_get_proc_time().
Packit Service 407539
 *
Packit Service 407539
 * Under Linux the @start_time value may be wrong due to the information
Packit Service 407539
 * available from the kernel.
Packit Service 407539
 * 
Packit Service 407539
 * The Linux kernel defines <type>INITIAL_JIFFIES</type> which implies a time
Packit Service 407539
 * shift. Because <type>INITIAL_JIFFIES</type> is not user-space defined,
Packit Service 407539
 * we cannot use it to compute an accurate @start_time. On Linux 2.6,
Packit Service 407539
 * <type>INITIAL_JIFFIES</type> is 300 so @start_time is 
Packit Service 407539
 * always 3s different from the real start time of the given process. You 
Packit Service 407539
 * may also get shift results if your system clock is not synchronised 
Packit Service 407539
 * with your hardware clock. See <command>man hwclock</command>.
Packit Service 407539
 */
Packit Service 407539
struct _glibtop_proc_time
Packit Service 407539
{
Packit Service 407539
    /*< private >*/
Packit Service 407539
	guint64	flags;
Packit Service 407539
	/*< public >*/
Packit Service 407539
	guint64 start_time;
Packit Service 407539
	guint64 rtime;
Packit Service 407539
	guint64 utime;
Packit Service 407539
	guint64 stime;
Packit Service 407539
	guint64 cutime;
Packit Service 407539
	guint64 cstime;
Packit Service 407539
	guint64 timeout;
Packit Service 407539
	guint64 it_real_value;
Packit Service 407539
	guint64 frequency;
Packit Service 407539
	guint64 xcpu_utime [GLIBTOP_NCPU];
Packit Service 407539
	guint64 xcpu_stime [GLIBTOP_NCPU];
Packit Service 407539
};
Packit Service 407539
Packit Service 407539
Packit Service 407539
void glibtop_get_proc_time(glibtop_proc_time *buf, pid_t pid);
Packit Service 407539
Packit Service 407539
#if GLIBTOP_SUID_PROC_TIME
Packit Service 407539
#define glibtop_get_proc_time_r	glibtop_get_proc_time_p
Packit Service 407539
#else
Packit Service 407539
#define glibtop_get_proc_time_r	glibtop_get_proc_time_s
Packit Service 407539
#endif
Packit Service 407539
Packit Service 407539
void glibtop_get_proc_time_l (glibtop *server, glibtop_proc_time *buf, pid_t pid);
Packit Service 407539
Packit Service 407539
#if GLIBTOP_SUID_PROC_TIME
Packit Service 407539
void _glibtop_init_proc_time_p (glibtop *server);
Packit Service 407539
void glibtop_get_proc_time_p (glibtop *server, glibtop_proc_time *buf, pid_t pid);
Packit Service 407539
#else
Packit Service 407539
void _glibtop_init_proc_time_s (glibtop *server);
Packit Service 407539
void glibtop_get_proc_time_s (glibtop *server, glibtop_proc_time *buf, pid_t pid);
Packit Service 407539
#endif
Packit Service 407539
Packit Service 407539
Packit Service 407539
G_END_DECLS
Packit Service 407539
Packit Service 407539
#endif