From pa.dec.com!decwrl!uunet!sparky!kent Tue Jul 16 09:11:22 PDT 1991 Article: 2486 of comp.sources.misc Newsgroups: comp.sources.misc Path: pa.dec.com!decwrl!uunet!sparky!kent From: Jussi Maki Subject: v20i095: aixmon - AIX3.1 system monitor v1.04, Patch01 Message-ID: <1991Jul12.042116.13118@sparky.IMD.Sterling.COM> X-Md4-Signature: 873374fe2cde8903dc88cbd4dffd7620 Sender: kent@sparky.IMD.Sterling.COM (Kent Landfield) Organization: Helsinki University of Technology, Finland Date: Fri, 12 Jul 1991 04:21:16 GMT Approved: kent@sparky.imd.sterling.com Lines: 119 Submitted-by: Jussi Maki Posting-number: Volume 20, Issue 95 Archive-name: aixmon/patch01 Patch-To: aixmon: Volume 20, Issue 94 Environment: AIX3.1 Here's a patch in "diff -lc" format to fix a problem with monitor-program in showing top cpu processes. ----------------------------------clip here- ------------------------------ *** top.c.old Wed Jul 10 20:19:34 1991 --- top.c Thu Jul 11 10:14:18 1991 *************** *** 4,9 **** --- 4,13 ---- ** THIS PROGRAM AND MODIFY IT AS LONG AS YOU KEEP ORIGINAL ** COPYRIGHTS. **/ + /* + ** modified 910710: changed top_calcsortinfo() to work correctly + ** modified 910711: version 1.04 to 1.04.2 + */ #include #include *************** *** 145,170 **** { int i,j; double cpusum=0.0; ! /* Oops,this must be changed in 1.04 (non-beta) :-) ! * I mean that to check if some processes are deletet between two samples ! */ for (i=0; i=0) { ! if (proc2[i].pi_pid == proc1[j].pi_pid) { ! procfound=1; ! break; ! } ! if (proc2[i].pi_pid > proc1[j].pi_pid) { ! break; ! } ! } ! } ! ! procsortinfo[i].cputime = user2[i].ui_ru.ru_utime.tv_sec + user2[i].ui_ru.ru_utime.tv_usec*1.0e-6 + user2[i].ui_ru.ru_stime.tv_sec + user2[i].ui_ru.ru_stime.tv_usec*1.0e-6; + if (procfound) { procsortinfo[i].deltacputime = procsortinfo[i].cputime - (user1[j].ui_ru.ru_utime.tv_sec + user1[j].ui_ru.ru_utime.tv_usec*1.0e-6 + user1[j].ui_ru.ru_stime.tv_sec + user1[j].ui_ru.ru_stime.tv_usec*1.0e-6); ! } else { /* previous process was not found so it must be new */ ! procsortinfo[i].deltacputime = procsortinfo[i].cputime; } + procsortinfo[i].index = i; + cpusum += procsortinfo[i].deltacputime; } qsort(procsortinfo,nproc2,sizeof(struct procsortinfo),cmp_deltacputime); return(cpusum); } --------------------------------patchend here ------------------------------ Jussi Maki | Internet: jmaki@vipunen.hut.fi Helsinki University of Technology, Finland | Bitnet: jmaki@fingate.bitnet Computing Centre | Voice: + 358 - 0 - 451 4317 Systems Support Division | Telefax: + 358 - 0 - 464 788 exit 0 # Just in case... -- Kent Landfield INTERNET: kent@sparky.IMD.Sterling.COM Sterling Software, IMD UUCP: uunet!sparky!kent Phone: (402) 291-8300 FAX: (402) 291-4362 Please send comp.sources.misc-related mail to kent@uunet.uu.net.