/*
*
* U.S. Government Rights - Commercial software. Government users are subject
* to the Sun Microsystems, Inc. standard license agreement and applicable
* provisions of the FAR and its supplements.
*
*
* This distribution may include materials developed by third parties. Sun,
* Sun Microsystems, the Sun logo and Solaris are trademarks or registered
* trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <ctype.h>
#include <unistd.h>
#include <memory.h>
#include <string.h>
#include <fcntl.h>
#include <errno.h>
#include <signal.h>
#include <kstat.h>
static int ncpus;
static void fail(int, char *, ...);
static void safe_zalloc(void **, int, int);
typedef struct {
long deficit;
} all_stat_t;
static int hz;
static int pagesize;
static int etime;
static void all_stat_init(void);
static int all_stat_load(void);
static void *safe_kstat_data_lookup(kstat_t *, char *);
static int fr_time = 0;
/* Get CPU Process details from kstats-
* Number of processes in runqueue,
* waiting and swapqueue
*/
int
{
if(!fr_time) {
/* Initialize a kstat control structure */
fr_time = 1;
}
/* update the kstat header chain or load all_stat structure */
}
/*
* Close the kstat control structure and set it to null.
*/
/* kstat_close(kc);
kc = (kstat_ctl_t *)NULL;*/
return(0);
}
/* Get RAm details from kstats */
int
{
int i;
/* default max handspread is 64MB worth of pages */
if(!fr_time) {
}
/* Initialize the all_stat structure */
fr_time = 1;
}
/* update the kstat header chain or load all_stat structure */
/* (void) printf("<<State change>>\n"); */
}
etime = 0;
for (i = 0; i < CPU_STATES; i++)
/*
* Close the kstat control structure and set it to null.
*/
/* kstat_close(kc);
kc = (kstat_ctl_t *)NULL;
*/
return(0);
}
/* Get ncstat data */
int
{
if(!fr_time) {
/* Initialize the all_stat structure */
}
/* Initialize the all_stat structure */
fr_time =1 ;
}
if (all_stat_load() != 0)
/*
* Close the kstat control structure and set it to null.
*/
/* kstat_close(kc);
kc = (kstat_ctl_t *)NULL;
*/
return(0);
}
/* Initialize the all_stat structure */
static void
all_stat_init(void)
{
/*
* Global statistics
*/
/*
* Per-CPU statistics
*/
ncpus = 0;
ncpus++;
ncpus = 0;
if (ncpus == 0)
fail(0, "can't find any cpu statistics");
}
/*
* load statistics, summing across CPUs where needed
*/
static int
all_stat_load(void)
{
int i, j;
/*
* Global statistics
*/
/*
* Per-CPU statistics.
* For now, we just sum across all CPUs. In the future,
* we should add options to vmstat for per-CPU data.
*/
for (i = 0; i < ncpus; i++) {
return (1);
for (j = 0; j < sizeof (cpu_sysinfo_t); j += sizeof (uint_t))
for (j = 0; j < sizeof (cpu_vminfo_t); j += sizeof (uint_t))
}
return (0);
}
static void
{
if (do_perror)
exit(2);
}
static void
{
}
void
{
if (kstat_chain_id == -1)
}
kstat_t *
char *ks_name)
{
fail(0, "kstat_lookup('%s', %d, '%s') failed",
return (ksp);
}
void *
{
fail(0, "kstat_data_lookup('%s', '%s') failed",
return (fp);
}