SCCS-vsn: local/local.cmd/la.c 6.2
SCCS-vsn: old/sysline/sysline.c 5.14
SCCS-vsn: usr.bin/systat/disks.c 5.5
SCCS-vsn: usr.bin/systat/iostat.c 5.5
SCCS-vsn: usr.bin/systat/main.c 5.5
SCCS-vsn: usr.bin/systat/pigs.c 5.7
#endif /* not lint */
#ifndef lint
#endif /* not lint */
#ifndef lint
-static char sccsid[] = "@(#)la.c 6.1 (Berkeley) %G%";
+static char sccsid[] = "@(#)la.c 6.2 (Berkeley) %G%";
#endif /* not lint */
/*
* la - print load averages
*/
#endif /* not lint */
/*
* la - print load averages
*/
-#include <sys/param.h>
-#include <nlist.h>
-#include <machine/pte.h> /* VAX page table entry */
-#include <sys/vm.h>
-
-struct nlist nl[] = {
- { "_avenrun" },
-#define X_AVENRUN 0
- { 0 },
-};
double avenrun[3];
main(argc,argv)
double avenrun[3];
main(argc,argv)
-int argc;
-char *argv[];
+ int argc;
+ char *argv[];
{
register int kmem, mem;
{
register int kmem, mem;
- char obuf[BUFSIZ];
-
- setbuf(stdout, obuf);
- if ((kmem = open("/dev/kmem", 0)) < 0) {
- fprintf(stderr, "No kmem\n");
- exit(1);
- }
- nlist("/vmunix", nl);
- if (nl[0].n_type==0) {
- fprintf(stderr, "No namelist\n");
+ if (getloadavg(avenrun, sizeof(avenrun) / sizeof(avenrun[0])) < 0) {
+ fprintf(stderr, "%s: getloadavg: failed\n", argv[0]);
- lseek(kmem, (long)nl[X_AVENRUN].n_value, 0);
- read(kmem, avenrun, sizeof(avenrun));
if ((argc > 1) && (! strcmp (argv[1],"-g"))) {
if ((argc > 1) && (! strcmp (argv[1],"-g"))) {
- printf("1 5 15\n");
- printf("Min Min Min\n");
- printf("-------------\n");
- }
+ printf("1 5 15\n");
+ printf("Min Min Min\n");
+ printf("-------------\n");
+ }
printf("%.2f %.2f %.2f\n", avenrun[0], avenrun[1], avenrun[2]);
}
printf("%.2f %.2f %.2f\n", avenrun[0], avenrun[1], avenrun[2]);
}
#endif /* not lint */
#ifndef lint
#endif /* not lint */
#ifndef lint
-static char sccsid[] = "@(#)sysline.c 5.13 (Berkeley) %G%";
+static char sccsid[] = "@(#)sysline.c 5.14 (Berkeley) %G%";
#include <stdio.h>
#include <sys/param.h>
#include <stdio.h>
#include <sys/param.h>
#include <sys/signal.h>
#include <utmp.h>
#include <ctype.h>
#include <sys/signal.h>
#include <utmp.h>
#include <ctype.h>
#define NL_BOOT 0
{ "_proc" },
#define NL_PROC 1
#define NL_BOOT 0
{ "_proc" },
#define NL_PROC 1
- { "_avenrun" },
-#define NL_AVEN 2
#ifdef VMUNIX
{ "_nproc" },
#ifdef VMUNIX
{ "_nproc" },
if (!quiet)
fprintf(stderr,
"Time makes no sense... namelist must be wrong\n");
if (!quiet)
fprintf(stderr,
"Time makes no sense... namelist must be wrong\n");
- nl[NL_PROC].n_value = nl[NL_AVEN].n_value = 0;
+ nl[NL_PROC].n_value = 0;
* print load average and difference between current load average
* and the load average 5 minutes ago
*/
* print load average and difference between current load average
* and the load average 5 minutes ago
*/
- if (nl[NL_AVEN].n_value != 0) {
+ if (getloadavg(avenrun, 3) > 0) {
double diff;
stringspace();
double diff;
stringspace();
-#ifdef VMUNIX
- lseek(kmem, (long)nl[NL_AVEN].n_value, 0);
- read(kmem, avenrun, sizeof avenrun);
-#endif
-#ifdef pdp11
- loadav(avenrun);
-#endif
if ((diff = avenrun[0] - avenrun[1]) < 0.0)
stringprt("%.1f %.1f", avenrun[0], diff);
else
if ((diff = avenrun[0] - avenrun[1]) < 0.0)
stringprt("%.1f %.1f", avenrun[0], diff);
else
-#ifdef pdp11
-loadav(ap)
-double ap[];
-{
- register int i;
- short s_avenrun[3];
-
- lseek(kmem, (long)nl[NL_AVEN].n_value, 0);
- read(kmem, s_avenrun, sizeof(s_avenrun));
- for (i=0; i < (sizeof(s_avenrun)/sizeof(s_avenrun[0])); i++)
- ap[i] = s_avenrun[i] / 256.0;
-}
-#endif
-
#ifdef RWHO
char *
sysrup(hp)
#ifdef RWHO
char *
sysrup(hp)
-static char sccsid[] = "@(#)disks.c 5.4 (Berkeley) %G%";
+static char sccsid[] = "@(#)disks.c 5.5 (Berkeley) %G%";
#endif not lint
#include "systat.h"
#endif not lint
#include "systat.h"
static struct nlist nlst[] = {
#define X_DK_NDRIVE 0
{ "_dk_ndrive" },
static struct nlist nlst[] = {
#define X_DK_NDRIVE 0
{ "_dk_ndrive" },
-#define X_DK_MSPW 1
- { "_dk_mspw" },
+#define X_DK_WPMS 1
+ { "_dk_wpms" },
-#define X_MBDINIT (X_DK_MSPW+1)
+#define X_MBDINIT (X_DK_WPMS+1)
-#define X_UBDINIT (X_DK_MSPW+2)
+#define X_UBDINIT (X_DK_WPMS+2)
{ "_ubdinit" },
#endif
#ifdef sun
{ "_ubdinit" },
#endif
#ifdef sun
-#define X_MBDINIT (X_DK_MSPW+1)
+#define X_MBDINIT (X_DK_WPMS+1)
{ "_mbdinit" },
#endif
#ifdef tahoe
{ "_mbdinit" },
#endif
#ifdef tahoe
-#define X_VBDINIT (X_DK_MSPW+1)
+#define X_VBDINIT (X_DK_WPMS+1)
{ "_vbdinit" },
#endif
{ "" },
{ "_vbdinit" },
#endif
{ "" },
return(0);
}
dk_mspw = (float *)calloc(dk_ndrive, sizeof (float));
return(0);
}
dk_mspw = (float *)calloc(dk_ndrive, sizeof (float));
- lseek(kmem, nlst[X_DK_MSPW].n_value, L_SET);
- read(kmem, dk_mspw, dk_ndrive * sizeof (float));
+ lseek(kmem, nlst[X_DK_WPMS].n_value, L_SET);
+ {
+ long *wpms = (long *)calloc(dk_ndrive, sizeof(long));
+ read(kmem, wpms, dk_ndrive * sizeof (long));
+ for (i = 0; i < dk_ndrive; i++)
+ *(dk_mspw + i) = (*(wpms + i) == 0)? 0.0:
+ (float) 1.0 / *(wpms + i);
+ free(wpms);
+ }
dr_name = (char **)calloc(dk_ndrive, sizeof (char *));
dk_select = (int *)calloc(dk_ndrive, sizeof (int));
for (cp = buf, i = 0; i < dk_ndrive; i++) {
dr_name = (char **)calloc(dk_ndrive, sizeof (char *));
dk_select = (int *)calloc(dk_ndrive, sizeof (int));
for (cp = buf, i = 0; i < dk_ndrive; i++) {
-static char sccsid[] = "@(#)iostat.c 5.4 (Berkeley) %G%";
+static char sccsid[] = "@(#)iostat.c 5.5 (Berkeley) %G%";
time = 1.0;
wmove(wnd, row, INSET);
#define CPUSCALE 0.5
time = 1.0;
wmove(wnd, row, INSET);
#define CPUSCALE 0.5
- histogram(100 * s.cp_time[o] / time, 50, CPUSCALE);
+ histogram(100.0 * s.cp_time[o] / time, 50, CPUSCALE);
}
histogram(val, colwidth, scale)
}
histogram(val, colwidth, scale)
#endif not lint
#ifndef lint
#endif not lint
#ifndef lint
-static char sccsid[] = "@(#)main.c 5.4 (Berkeley) %G%";
+static char sccsid[] = "@(#)main.c 5.5 (Berkeley) %G%";
#endif not lint
#include "systat.h"
#endif not lint
#include "systat.h"
static struct nlist nlst[] = {
#define X_CCPU 0
{ "_ccpu" },
static struct nlist nlst[] = {
#define X_CCPU 0
{ "_ccpu" },
-#define X_AVENRUN 1
- { "_avenrun" },
+#define X_FSCALE 1
+ { "_fscale" },
#define X_HZ 2
{ "_hz" },
#define X_PHZ 3
#define X_HZ 2
{ "_hz" },
#define X_PHZ 3
int suspend();
int (*sigtstpdfl)();
int suspend();
int (*sigtstpdfl)();
int dellave;
static WINDOW *wload; /* one line window for load average */
int dellave;
static WINDOW *wload; /* one line window for load average */
}
gethostname(hostname, sizeof (hostname));
}
gethostname(hostname, sizeof (hostname));
- lseek(kmem, nlst[X_CCPU].n_value, L_SET);
- read(kmem, &ccpu, sizeof (ccpu));
- lccpu = log(ccpu);
+ ccpu = getw(nlst[X_CCPU].n_value);
+ fscale = getw(nlst[X_FSCALE].n_value);
+ lccpu = log((double) ccpu / fscale);
hz = getw(nlst[X_HZ].n_value);
phz = getw(nlst[X_PHZ].n_value);
(*curcmd->c_init)();
hz = getw(nlst[X_HZ].n_value);
phz = getw(nlst[X_PHZ].n_value);
(*curcmd->c_init)();
register int i, j;
/* Get the load average over the last minute. */
register int i, j;
/* Get the load average over the last minute. */
- lseek(kmem, nlst[X_AVENRUN].n_value, L_SET);
- read(kmem, avenrun, sizeof (avenrun));
+ (void) getloadavg(avenrun, sizeof(avenrun) / sizeof(avenrun[0]));
(*curcmd->c_fetch)();
if (curcmd->c_flags & CF_LOADAV) {
j = 5.0*avenrun[0] + 0.5;
(*curcmd->c_fetch)();
if (curcmd->c_flags & CF_LOADAV) {
j = 5.0*avenrun[0] + 0.5;
- lseek(kmem, nlst[X_AVENRUN].n_value, L_SET);
- read(kmem, avenrun, sizeof (avenrun));
+ (void) getloadavg(avenrun, sizeof(avenrun)/sizeof(avenrun[0]));
mvprintw(CMDLINE, 0, "%4.1f %4.1f %4.1f",
avenrun[0], avenrun[1], avenrun[2]);
clrtoeol();
mvprintw(CMDLINE, 0, "%4.1f %4.1f %4.1f",
avenrun[0], avenrun[1], avenrun[2]);
clrtoeol();
-static char sccsid[] = "@(#)pigs.c 5.6 (Berkeley) %G%";
+static char sccsid[] = "@(#)pigs.c 5.7 (Berkeley) %G%";
continue;
prt->pt_pid = pp->p_pid;
prt->pt_pp = pp;
continue;
prt->pt_pid = pp->p_pid;
prt->pt_pp = pp;
- prt->pt_pctcpu = pp->p_pctcpu / (1.0 - exp(time * lccpu));
+ prt->pt_pctcpu = ((double) pp->p_pctcpu / fscale) /
+ (1.0 - exp(time * lccpu));
prt->pt_uid = pp->p_uid;
prt++;
}
prt->pt_uid = pp->p_uid;
prt++;
}