rdimpl.h revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _RDIMPL_H
#define _RDIMPL_H
#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/sysmacros.h>
#include <procfs.h>
#include <setjmp.h>
#include <time.h>
#include <inttypes.h>
#ifdef __cplusplus
extern "C" {
#endif
extern int monitor_start();
extern void monitor_stop();
extern int monitor_update();
extern void list_clear();
extern char *ltdb_file;
extern int mo; /* option flag for microstate accounting */
/*
* FRC2PCT macro is used to convert 16-bit binary fractions in the range
* 0.0 to 1.0 with binary point to the right of the high order bit
* (i.e. 1.0 == 0x8000) to percentage value.
*/
/*
* Possible list types
*/
#define LT_LWPS 0x0001
#define LT_USERS 0x0002
#define LT_TASKS 0x0004
#define LT_PROJECTS 0x0008
#define LT_PSETS 0x0010
#define LT_SYS 0x0020
#define LT_PROCESS 0x0040
/*
* Default list sizes
*/
#define LS_LWPS 1024
#define LS_PROCESSES 512
#define LS_USERS 32
#define LS_PROJECTS 16
#define LS_PSETS 8
#define LS_SYS 1
/*
* Linked list of per-process or per-lwp statistics
*/
typedef struct lwp_info {
int li_alive; /* flag for alive lwps */
int rlwpid; /* id of the representative lwp */
double li_usr; /* user level CPU time */
double li_sys; /* system call CPU time */
double li_ttime; /* SystemTrapTime */
double li_tpftime; /* TextPageFaultSleepTime */
double li_dpftime; /* DataPageFaultSleepTime */
double li_kpftime; /* SystemPageFaultSleepTime */
double li_lck; /* user lock wait sleep time */
double li_slp; /* all other sleep time */
double li_lat; /* wait-cpu (latency) time */
double li_stime; /* StoppedTime */
} lwp_info_t;
typedef struct {
char *nodename;
char *name;
} sys_info_t;
typedef struct {
int id;
void *id_next; /* pointer to next entry */
void *id_prev; /* pointer to previous entry */
} info_head_t;
/*
* Linked list of collective per-uid, per-set, or per-projid statistics
*/
typedef struct id_info {
int id_alive; /* flag for alive id */
double id_usr; /* UserModeTime */
double id_sys; /* SystemModeTime */
double id_ttime; /* SystemTrapTime */
double id_tpftime; /* TextPageFaultSleepTime */
double id_dpftime; /* DataPageFaultSleepTime */
double id_kpftime; /* SystemPageFaultSleepTime */
double id_lck; /* UserLockWaitSleepTime */
double id_slp; /* OtherSleepTime */
double id_lat; /* WaitCPUTime */
double id_stime; /* StoppedTime */
float id_pctcpu; /* PercentCPUTime # psinfo */
float id_pctmem; /* PercentMemorySize # psinfo */
char *id_name;
} id_info_t;
/*
* Per-list structure
*/
typedef struct list {
int l_type; /* list type */
int l_count; /* number of entries in the list */
void *l_head; /* pointer to the head of the list */
void *l_tail; /* pointer to the tail of the list */
int l_size; /* number of allocated pointers */
int l_used; /* number of used pointers */
void **l_ptrs; /* pointer to an array of pointers */
} list_t;
typedef struct swap_info {
float pctswap; /* percentage of used swap */
} swap_info_t;
#ifdef __cplusplus
}
#endif
#endif /* _RDIMPL_H */