Path: utzoo!attcan!uunet!cs.utexas.edu!yale!cs.yale.edu!anselmo-ed From: anselmo-ed@cs.yale.edu (Ed Anselmo) Newsgroups: comp.sys.encore Subject: Re: cpp symbol for multimax Message-ID: <26468@cs.yale.edu> Date: 2 Oct 90 21:16:25 GMT References: <26458@cs.yale.edu> <84281@tut.cis.ohio-state.edu> Sender: news@cs.yale.edu Organization: Yale University, Dept. of Computer Science, New Haven, CT Lines: 94 Nntp-Posting-Host: bigbird.cf.cs.yale.edu In-reply-to: jrm@stegosaur.cis.ohio-state.edu's message of 2 Oct 90 20:34:13 GMT >>>>> On 2 Oct 90 20:34:13 GMT, jrm@stegosaur.cis.ohio-state.edu (John R. Mudd) said: John> You too, eh? Since the UMAX kernel doesn't seem to define John> "_avenrun", it'd be awfully nice for Encore to provide their John> users with a replacement for xload/get_load.c (hint hint). My John> version of xload that uses inq_stats() seems to have really John> lousy resolution, which means the graphic load meter is John> stair-stepped. Reminds me a lot of TRS80 graphics. :-) The version I lifted from the GNU emacs etc/loadst.c works pretty well. Diffs to the original get_load.c follow. *** mit/clients/xload/get_load.c.orig Thu Dec 14 09:46:20 1989 --- mit/clients/xload/get_load.c Tue Oct 2 12:14:15 1990 *************** *** 80,85 **** --- 80,98 ---- #define n_type n_value #endif /* CRAY */ + #ifdef umax + /* + * UMAX 4.2, which runs on the Encore Multimax multiprocessor, does not + * have a /dev/kmem. Information about the workings of the running kernel + * can be gathered with inq_stats system calls. + */ + #include + #include + #include + #include + #include + #endif /* umax */ + #ifdef sequent #include #endif /* sequent */ *************** *** 106,111 **** --- 119,161 ---- extern long lseek(); extern void exit(); + #ifdef umax + void + GetLoadPoint( w, closure, call_data ) + Widget w; /* unused */ + XtPointer closure; /* unused */ + XtPointer call_data; /* pointer to (double) return value */ + { + int i, j; + double sum; + struct proc_summary proc_sum_data; + struct stat_descr proc_info; + + proc_info.sd_next = NULL; + proc_info.sd_subsys = SUBSYS_PROC; + proc_info.sd_type = PROCTYPE_SUMMARY; + proc_info.sd_addr = (char *) &proc_sum_data; + proc_info.sd_size = sizeof (struct proc_summary); + proc_info.sd_sizeused = 0; + + if (inq_stats (1, &proc_info) != 0 ) + { + perror ("sysline proc summary inq_stats"); + exit (1); + } + /* + * Generate current load average. + */ + sum = 0; + for (i = proc_sum_data.ps_nrunidx, j = 0; j < 12; j++) + { + sum += proc_sum_data.ps_nrun[i]; + if (--i < 0) + i = 179; + } + *(double *)call_data = sum /12; + } + #else /* not umax */ #if apollo /* ARGSUSED */ void GetLoadPoint( w, closure, call_data ) *************** *** 401,406 **** --- 451,457 ---- #endif /* LOADSTUB */ #endif /* KVM_ROUTINES */ #endif /* apollo */ + #endif /* umax */ static xload_error(str1, str2) char *str1, *str2; -- Ed Anselmo anselmo-ed@cs.yale.edu {harvard,cmcl2}!yale!anselmo-ed