hleroy@presto.irisa.fr (Hugues Leroy) (03/20/90)
This patches s.c and adds a new file s-gould-np1.c which draws 2 separate bars for the 2 cpus. Apply the patch file ( patch<s.c.diff2) and recompile. Hugues Leroy, INRIA Rennes (France) // Hugues.Leroy@irisa.fr ============================================================================== #! /bin/sh # This is a shell archive. Remove anything before this line, then unpack # it by saving it into a file and typing "sh file". To overwrite existing # files, type "sh file -c". You can also feed this as standard input via # unshar, or by typing "sh <file", e.g.. If this archive is complete, you # will see the following message at the end: # "End of shell archive." # Contents: s.c.diff2 s-gould-np1.c # Wrapped by hleroy@presto on Mon Mar 19 18:41:10 1990 PATH=/bin:/usr/bin:/usr/ucb ; export PATH if test -f 's.c.diff2' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'s.c.diff2'\" else echo shar: Extracting \"'s.c.diff2'\" \(321 characters\) sed "s/^X//" >'s.c.diff2' <<'END_OF_FILE' X*** s.c.orig Thu Mar 15 18:24:35 1990 X--- s.c Mon Mar 19 13:12:15 1990 X*************** X*** 20,25 **** X--- 20,30 ---- X # define s_included X #endif X X+ #ifdef GOULD_NP1 X+ # include "s-gould-np1.c" X+ # define s_included X+ #endif X+ X /* This should work on most BSD machines */ X #ifndef s_included X # include "s-bsd.c" END_OF_FILE if test 321 -ne `wc -c <'s.c.diff2'`; then echo shar: \"'s.c.diff2'\" unpacked with wrong size! fi # end of 's.c.diff2' fi if test -f 's-gould-np1.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'s-gould-np1.c'\" else echo shar: Extracting \"'s-gould-np1.c'\" \(2417 characters\) sed "s/^X//" >'s-gould-np1.c' <<'END_OF_FILE' X/* s-gould-np1.c : has _Cptime instead of _cp_time */ X X/* X * Hugues Leroy, INRIA, RENNES France <Hugues.Leroy@irisa.fr> X * added support for the Gould NP1 X * based on code by X * Chris Siebenmann, CSRI, University of Toronto <cks@white.toronto.edu> X * and X * Salvador P. Abreu, U.Nova de Lisboa, PORTUGAL <spa@fctunl.rccn.pt> X*/ X X/* LINTLIBRARY */ X#include <sys/param.h> X#include <sys/dk.h> X#include <nlist.h> X Xextern int open(), read(); Xextern long lseek(); X X/* NPROCS is now always 2 */ X X#define NPROCS 2 X Xlong cp_time[NPROCS][CPUSTATES]; Xlong cp_old [NPROCS][CPUSTATES]; Xint kmem; /* file descriptor of /dev/kmem. */ Xstruct nlist nl[] = { X#define X_CP_TIME 0 X { "_Cptime" }, X { "" }, X}; X X/* Called at the beginning to inquire how many bars are needed. */ Xint Xnum_bars() X{ X return NPROCS; X} X X/* Called after num_bars to ask for the bar names */ X/* ARGSUSED */ Xchar ** Xlabel_bars(nbars) X{ X static char *name[NPROCS]; X X name[0] = "CPU 1"; X name[1] = "CPU 2"; X return name; X} X X/* X * Called after the bars are created to perform any machine dependent X * initializations. X */ X/* ARGSUSED */ Xvoid Xinit_bars(nbars) Xint nbars; X{ X X if ((kmem = open("/dev/kmem", 0)) < 0) { X perror("/dev/kmem"); X exit(1); X } X (void)nlist("/vmunix", nl); X if (lseek(kmem, (long) nl[X_CP_TIME].n_value, 0) != X (long) nl[X_CP_TIME].n_value) X perror("lseek"); X if (read(kmem, (char *) cp_old, sizeof(cp_old)) != X sizeof(cp_old)) X perror("read"); X} X X/* X * This procedure gets called every interval to compute and display the X * bars. It should call draw_bar() with the bar number, the array of X * integer values to display in the bar, and the number of values in X * the array. X */ X/* ARGSUSED */ Xvoid Xdisplay_bars(nbars) X{ X int states[CPUSTATES]; X int nstates; X int i,j; X X X if (lseek(kmem, (long) nl[X_CP_TIME].n_value, 0) != X (long) nl[X_CP_TIME].n_value) X perror("lseek"); X if (read(kmem, (char *) cp_time, sizeof(cp_time)) != X sizeof(cp_time)) X perror("read"); X X X#define delta(cpustate) ((int) (cp_time[i][(cpustate)] - cp_old[i][(cpustate)])) X X for (i=0; i<NPROCS; i++) { X nstates = 0; X states[nstates++] = delta(CP_IDLE); X states[nstates++] = delta(CP_USER); X states[nstates++] = delta(CP_NICE); X states[nstates++] = delta(CP_SYS); X draw_bar(i, states, nstates); X } X for (i = 0; i < CPUSTATES; i ++) X for (j=0; j< NPROCS; j++) X cp_old[j][i] = cp_time[j][i]; X X X} END_OF_FILE if test 2417 -ne `wc -c <'s-gould-np1.c'`; then echo shar: \"'s-gould-np1.c'\" unpacked with wrong size! fi # end of 's-gould-np1.c' fi echo shar: End of shell archive. exit 0