*** /dev/null Wed Feb 21 08:52:25 1990 --- CHANGES.Pat02 Wed Feb 21 08:52:20 1990 *************** *** 0 **** --- 1,2 ---- + - file s-cray-xmp.c got left out of patch1, sigh. Also a fix to xcpustate.c + and s.c to make them compile on a Cray (thanks to dac@cray.com) *** /tmp/,RCSt1a10610 Wed Feb 21 08:52:45 1990 --- patchlevel.h Wed Feb 21 06:35:28 1990 *************** *** 1 **** ! #define PATCHLEVEL 1 --- 1 ---- ! #define PATCHLEVEL 2 *** /tmp/,RCSt1a10630 Wed Feb 21 08:53:11 1990 --- Imakefile Wed Feb 21 08:49:15 1990 *************** *** 1,5 **** LOCAL_LIBRARIES = $(XAWLIB) $(XMULIB) $(XTOOLLIB) $(XLIB) ! DEP_LIBS = $(DEPXAWLIB) $(DEPXMULIB) $(DEPXTOOLLIB) $(DEPXLIB) SRCS = xcpustate.c Bar.c s.c OBJS = xcpustate.o Bar.o s.o INSTPGMFLAGS = $(INSTKMEMFLAGS) --- 1,5 ---- LOCAL_LIBRARIES = $(XAWLIB) $(XMULIB) $(XTOOLLIB) $(XLIB) ! DEPLIBS = $(DEPXAWLIB) $(DEPXMULIB) $(DEPXTOOLLIB) $(DEPXLIB) SRCS = xcpustate.c Bar.c s.c OBJS = xcpustate.o Bar.o s.o INSTPGMFLAGS = $(INSTKMEMFLAGS) *** /tmp/,RCSt1a10630 Wed Feb 21 08:53:12 1990 --- s.c Wed Feb 21 08:49:15 1990 *************** *** 1,3 **** --- 1,8 ---- + /* + * for each type of machine, stick the appropriate ifdef's in here and define + * s_included. If s_included is not defined, it assumes BSD (i.e look for + * _cp_time in kmem) + */ #ifdef sgi # ifdef mips # include "s-iris4d.c" *************** *** 5,15 **** # endif #endif /* This should work on most BSD machines */ #ifndef s_included # include "s-bsd.c" #endif ! ! #ifdef CRAY1 ! # include "s-cray-xmp.c" ! #endif --- 10,22 ---- # endif #endif + #ifdef CRAY1 + # include "s-cray-xmp.c" + # define s_included + #endif + /* This should work on most BSD machines */ #ifndef s_included # include "s-bsd.c" #endif ! /* Do not add anything after this line */ *** /dev/null Wed Feb 21 08:52:25 1990 --- s-cray-xmp.c Wed Feb 21 06:29:04 1990 *************** *** 0 **** --- 1,123 ---- + /* System dependent file for Cray X/MP and Y/MP Unicos >= 5.1 Systems */ + /* Walter D. Poxon, CRI, Mendota Heights, MN */ + + #include + #include + #include + #include + #include + #include + + #define UNICOS "/unicos" + #define KMEM "/dev/kmem" + + #define NSTATES 6 + + static struct nlist nl[] = { {"cpuw"},{0} }; + int kmem; + long bytes; + struct pw cpuw; + + extern char *xmalloc(/* int nbytes */); + + union cpu_name { + word wval; + struct { + uint : 32, + c : 8, + p : 8, + u : 8, + no : 8; + } cval; + }; + + /* Called at the beginning to inquire how many bars are needed. */ + int + num_bars() + { + bzero(&cpuw,sizeof(cpuw)); + + if (nlist(UNICOS,nl) == -1) { + perror("nlist"); + return 0; + } + + bytes = nl[0].n_value; + + if ((kmem = open(KMEM, O_RDONLY)) <0) { + perror("open"); + return 0; + } + + if (lseek(kmem, bytes, SEEK_SET) != bytes) + perror("lseek"); + + if (read(kmem, &cpuw, sizeof(cpuw)) != sizeof(cpuw)) + perror("read"); + + return cpuw.pw_ccpu; /* Number of CPU's configured in UNICOS */ + /*return cpuw.pw_scpu; /* Number of CPU's started */ + + } + + + char ** + label_bars(nbars) /* Called after num_bars to ask for bar names */ + { + char **names; + int i; + extern char *strcpy(/* char *, const char * */); + union cpu_name c; + + names = (char **) xmalloc(nbars * sizeof(char *)); + for(i = 0; i < nbars; i++) { + char buf[8]; + c.wval = cpuw.pws[i].pw_cpu; + (void) sprintf(buf, "%c%c%c%c", c.cval.c,c.cval.p,c.cval.u,c.cval.no); + names[i] = strcpy(xmalloc(strlen(buf)+1), buf); + } + return names; + } + + /* + * Called after the bars are created to perform any machine dependent + * initializations. + */ + void + init_bars(nbars) + int nbars; + { + (void) display_bars(nbars); + } + + /* + * This procedure gets called every interval to compute and display the + * bars. It should call draw_bar() with the bar number, the array of + * integer values to display in the bar, and the number of values in + * the array. + */ + + #define delta(cpustate) \ + ((int) (si[i]->cpu[(cpustate)] - last_si[i]->cpu[(cpustate)])) + + display_bars(nbars) + { + int states[NSTATES]; + int nstates; + int cpu; + extern void draw_bar(/*int bar_num, int *states, int num_states*/); + + if (lseek(kmem, bytes, SEEK_SET) != bytes) + perror("lseek"); + + if (read(kmem, &cpuw, sizeof(cpuw)) != sizeof(cpuw)) + perror("read"); + + for (cpu=0; cpu < nbars; cpu++) { + nstates = 0; + states[nstates++] = cpuw.pws[cpu].pw_syswe + cpuw.pws[cpu].pw_idlee; + states[nstates++] = cpuw.pws[cpu].pw_usere; + states[nstates++] = cpuw.pws[cpu].pw_unixe; + draw_bar(cpu, states, nstates); + } + }