home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / x / volume5 / xtacho / patch1 next >
Internet Message Format  |  1989-11-29  |  17KB

  1. Path: uunet!island!minako.stars.flab.fujitsu.co.jp
  2. From: sumi@minako.stars.flab.fujitsu.co.jp (Shinji Sumimoto)
  3. Newsgroups: comp.sources.x
  4. Subject: v05i033: xtacho, Patch1
  5. Message-ID: <1218@island.uu.net>
  6. Date: 30 Nov 89 04:50:23 GMT
  7. Sender: news@island.uu.net
  8. Lines: 634
  9. Approved: island!argv@sun.com
  10.  
  11. Submitted-by: ucbcad!uunet.UU.NET!sumi%minako.stars.flab.fujitsu.junet
  12. Posting-number: Volume 5, Issue 33
  13. Archive-name: xtacho/patch1
  14. Patch-To: xtacho: Volume 4, Issue 63 (July 19, 1989)
  15.  
  16. -----    Shinji Sumimoto
  17.     Fujitsu Laboratories Ltd.
  18.     Artificial Intelligence Laboratory
  19.     sumi@minako.stars.flab.fujitsu.co.jp  -------
  20.  
  21. ------ Followings are new patch ------
  22. Submitted-by: sumi@minako.stars.flab.fujitsu.co.jp (Shinji Sumimoto)
  23. Posting-number: Volume 1.
  24. Archive-name: xtacho/patch1 
  25. Original-Archive: (v04i063: xtacho -- x cpu tachometer, Part01/01
  26.            Date: 19 Jul 89 23:29:32 GMT)
  27.  
  28. This is a patch to improve xtacho that was posted by Kazuhiko Shutoh
  29. (e-mail: shutoh@isl.yamaha.co.jp).
  30.  
  31. This improves following improvements:
  32.  
  33.     1) Triple tachometer display.
  34.        Xtachos displays System, User, Idle tachometers from the left side.
  35.  
  36.     2) Support a system without rstat library.
  37.        Xtachos gets the data from /dev/kmem
  38.  
  39. This xtachos works well on Sun-3(SunOS 4.0,X11R3) and 4.3BSD(X11R3).
  40.  
  41. These patches consist of following files:
  42.  
  43.     README--- You already know
  44.     patch1--- patch file to xtachos
  45.     patch.sh- shell script for making xtachos
  46.  
  47. Any comments and bug fixes are welcome.
  48.  
  49. Have fun !
  50.  
  51. -----    Shinji Sumimoto
  52.     Fujitsu Laboratories Ltd.
  53.     Artificial Intelligence Laboratory
  54.     sumi@minako.stars.flab.fujitsu.co.jp  -------
  55.  
  56. ------------- cut here --------------
  57. #!/bin/sh
  58. # shar:    Shell Archiver  (v1.22)
  59. #
  60. #    Run the following text with /bin/sh to create:
  61. #      README
  62. #      patch.sh
  63. #      patch1
  64. #
  65. echo "x - extracting README (Text)"
  66. sed 's/^X//' << 'SHAR_EOF' > README &&
  67. XSubmitted-by: sumi@minako.stars.flab.fujitsu.co.jp (Shinji Sumimoto)
  68. XPosting-number: Volume 1,
  69. XArchive-name: xtacho/patch1
  70. X
  71. XThese patches to xtacho improve following improvements:
  72. X
  73. X    1) Triple tachometer display.
  74. X       Xtachos displays System, User, Idle tachometers from the left side.
  75. X
  76. X    2) Support a system without rstat library.
  77. X       xtachos gets the data from /dev/kmem
  78. X
  79. XThis xtachos works well on Sun-3(SunOS 4.0,X11R3) and 4.3BSD(X11R3).
  80. X
  81. XThese patches consist of following files:
  82. X
  83. X    README--- You already know
  84. X    patch1--- patch file to xtachos
  85. X    patch.sh- shell script for making xtachos
  86. X
  87. X
  88. XTODO:
  89. X    Please execute patch.sh, this automatically replaces
  90. X    xtacho files, and make xtachos files.
  91. X    And edit a Makefile in following way:
  92. X    (defaults: It's for sun)
  93. X
  94. X    - If your system has a rstat library,
  95. X      please adds compiler option -DRSTAT.(in defaults)
  96. X
  97. X    - If your system does not have a rstat liibrary,
  98. X      please remove -DRSTAT.
  99. X      Program gets a data from /dev/kmem
  100. X
  101. X    And executes make command.
  102. X
  103. X    Have fun !
  104. X
  105. SHAR_EOF
  106. chmod 0644 README || echo "restore of README fails"
  107. echo "x - extracting patch.sh (Text)"
  108. sed 's/^X//' << 'SHAR_EOF' > patch.sh &&
  109. X#!/bin/sh
  110. Xcat patch1 | patch
  111. Xmv xtacho.c xtachos.c
  112. Xmv xtacho.h xtachos.h
  113. SHAR_EOF
  114. chmod 0755 patch.sh || echo "restore of patch.sh fails"
  115. echo "x - extracting patch1 (Text)"
  116. sed 's/^X//' << 'SHAR_EOF' > patch1 &&
  117. XIndex: Makefile
  118. X*** Makefile.xtacho    Sat Nov 25 18:26:19 1989
  119. X--- Makefile    Sat Nov 25 18:31:17 1989
  120. X***************
  121. X*** 1,4 ****
  122. X! # SCCS ID @(#)Makefile    1.7   7/14/89
  123. X  #
  124. X  #   Makefile - Makefile for xtacho
  125. X  # 
  126. X--- 1,4 ----
  127. X! # SCCS ID @(#)Makefile    1.5   7/12/89
  128. X  #
  129. X  #   Makefile - Makefile for xtacho
  130. X  # 
  131. X***************
  132. X*** 9,20 ****
  133. X  #   comment and the author's name is retained.  The author assumes no 
  134. X  #   responsibility for lost sleep as a consequence of use of this software.
  135. X  #
  136. X! #   Send any comments, bug reports, etc. to: shutoh@isl.yamaha.JUNET or, 
  137. X! #   for oversea: shutoh%isl.yamaha.JUNET%kddlab@uunet.uu.net  
  138. X  #                 
  139. X  #
  140. X  CC         = /bin/cc
  141. X! CFLAGS         = -f68881 -O
  142. X  DESTDIR        = /usr/bin/X11
  143. X  MANDIR        = /usr/man/mann
  144. X  #
  145. X--- 9,26 ----
  146. X  #   comment and the author's name is retained.  The author assumes no 
  147. X  #   responsibility for lost sleep as a consequence of use of this software.
  148. X  #
  149. X! #   Send any comments, bug reports, etc. to shutoh@isl.yamaha.JUNET
  150. X  #                 
  151. X  #
  152. X  CC         = /bin/cc
  153. X! # for machines with rstat library 
  154. X! # for sun-3
  155. X! CFLAGS         = -f68881 -O -DRSTAT
  156. X! # for sun-4
  157. X! #CFLAGS         = -O -DRSTAT
  158. X! # for BSD without rstat library
  159. X! #CFLAGS         = -O
  160. X! 
  161. X  DESTDIR        = /usr/bin/X11
  162. X  MANDIR        = /usr/man/mann
  163. X  #
  164. X***************
  165. X*** 25,36 ****
  166. X  #    Libraries for X11R3
  167. X  #
  168. X  LIBS         = -lXaw -lXmu -lXt -lX11 -lm -lrpcsvc
  169. X  
  170. X  ##############################################################################
  171. X! PROGRAMS    = ./xtacho
  172. X! SRCS         = ./xtacho.c
  173. X! OBJS        = ./xtacho.o
  174. X! LOCALHDRS    = ./xtacho.h ./xtacho.icon
  175. X  EXTERNHDRS    = /usr/include/stdio.h \
  176. X            /usr/include/math.h \
  177. X            /usr/include/rpcsvc/rstat.h \
  178. X--- 31,44 ----
  179. X  #    Libraries for X11R3
  180. X  #
  181. X  LIBS         = -lXaw -lXmu -lXt -lX11 -lm -lrpcsvc
  182. X+ # without rstat library
  183. X+ #LIBS         = -lXaw -lXmu -lXt -lX11 -lm 
  184. X  
  185. X  ##############################################################################
  186. X! PROGRAMS    = ./xtachos
  187. X! SRCS         = ./xtachos.c
  188. X! OBJS        = ./xtachos.o
  189. X! LOCALHDRS    = ./xtachos.h ./xtacho.icon
  190. X  EXTERNHDRS    = /usr/include/stdio.h \
  191. X            /usr/include/math.h \
  192. X            /usr/include/rpcsvc/rstat.h \
  193. XIndex: xtacho.c
  194. X*** xtacho.c    Sat Nov 25 18:26:21 1989
  195. X--- xtachos.c    Sat Nov 25 18:32:28 1989
  196. X***************
  197. X*** 1,9 ****
  198. X! static char     sccsid[] = "@(#)xtacho.c    1.9   7/18/89";
  199. X  
  200. X  /*
  201. X   * xtacho - The cpu load tachometer for X11
  202. X   * 
  203. X   * Author: Kazuhiko Shutoh, 1989.
  204. X   * 
  205. X   * Permission to use, copy, modify and distribute without charge this software,
  206. X   * documentation, images, etc. is granted, provided that this comment and the
  207. X--- 1,10 ----
  208. X! static char     sccsid[] = "@(#)xtachos.c    1.5   7/12/89";
  209. X  
  210. X  /*
  211. X   * xtacho - The cpu load tachometer for X11
  212. X   * 
  213. X   * Author: Kazuhiko Shutoh, 1989.
  214. X+  * Revised by Shinji Sumimoto, 1989/9 (xtachos)
  215. X   * 
  216. X   * Permission to use, copy, modify and distribute without charge this software,
  217. X   * documentation, images, etc. is granted, provided that this comment and the
  218. X***************
  219. X*** 10,20 ****
  220. X   * author's name is retained.  The author assumes no responsibility for lost
  221. X   * sleep as a consequence of use of this software.
  222. X   * 
  223. X!  * Send any comments, bug reports, etc. to: shutoh@isl.yamaha.JUNET or, 
  224. X!  * for oversea: shutoh%isl.yamaha.JUNET%kddlab@uunet.uu.net  
  225. X!  *
  226. X   */
  227. X  
  228. X  #include <X11/Intrinsic.h>
  229. X  #include <X11/StringDefs.h>
  230. X  #include <X11/Shell.h>
  231. X--- 11,28 ----
  232. X   * author's name is retained.  The author assumes no responsibility for lost
  233. X   * sleep as a consequence of use of this software.
  234. X   * 
  235. X!  * Send any comments, bug reports, etc. to shutoh@isl.yamaha.JUNET
  236. X!  * 
  237. X   */
  238. X  
  239. X+ #include <stdio.h>
  240. X+ #include <math.h>
  241. X+ #ifdef RSTAT
  242. X+ #include <rpcsvc/rstat.h>
  243. X+ #else /* 4.3 BSD */
  244. X+ #include <nlist.h>
  245. X+ #include <sys/dk.h>
  246. X+ #endif
  247. X  #include <X11/Intrinsic.h>
  248. X  #include <X11/StringDefs.h>
  249. X  #include <X11/Shell.h>
  250. X***************
  251. X*** 22,34 ****
  252. X  #include <X11/Label.h>
  253. X  #include <X11/Command.h>
  254. X  #include <X11/Form.h>
  255. X! #include <stdio.h>
  256. X! #include <math.h>
  257. X! #include <rpcsvc/rstat.h>
  258. X! #include "xtacho.h"
  259. X  #include "xtacho.icon"
  260. X  
  261. X  XtCallbackProc  redraw_callback();
  262. X  XtTimerCallbackProc PollingCpuStatus();
  263. X  void            SetupTacho();
  264. X  void            GetGraphicContexts();
  265. X--- 30,40 ----
  266. X  #include <X11/Label.h>
  267. X  #include <X11/Command.h>
  268. X  #include <X11/Form.h>
  269. X! #include "xtachos.h"
  270. X  #include "xtacho.icon"
  271. X  
  272. X  XtCallbackProc  redraw_callback();
  273. X+ XtCallbackProc  Destroy();
  274. X  XtTimerCallbackProc PollingCpuStatus();
  275. X  void            SetupTacho();
  276. X  void            GetGraphicContexts();
  277. X***************
  278. X*** 41,56 ****
  279. X  void            DrawSingleNumber();
  280. X  void            DrawNeedle();
  281. X  
  282. X! Widget          toplevel, base, info, meter;
  283. X! GC              gcForeground, gcBackground, gcNeedle;
  284. X  
  285. X  char            hostname[MAXCHARS];
  286. X  unsigned char   monitor_item;
  287. X  long            update;
  288. X! Cardinal        current_status = 0;
  289. X! Cardinal        old_status = 0;
  290. X! Cardinal        old_status_time = 0;
  291. X  
  292. X  main(argc, argv)
  293. X      int             argc;
  294. X      char          **argv;
  295. X--- 47,75 ----
  296. X  void            DrawSingleNumber();
  297. X  void            DrawNeedle();
  298. X  
  299. X! Widget          toplevel, base, info[3], meter[3];
  300. X! GC              gcForeground, gcBackground, gcNeedle[3];
  301. X  
  302. X  char            hostname[MAXCHARS];
  303. X  unsigned char   monitor_item;
  304. X  long            update;
  305. X! Cardinal        current_status[3] = { 0,0,0 };
  306. X! Cardinal        old_status[3] = { 0,0,0 };
  307. X! Cardinal        old_status_time[3] = { 0,0,0 };
  308. X! #ifndef RSTAT
  309. X! struct  statstime {
  310. X!     long cp_time[4];
  311. X!     int tmp;
  312. X! }    ;
  313. X! struct nlist nl[]= {
  314. X!       {"_cp_time"},
  315. X!       {""},
  316. X!     };
  317. X  
  318. X+ #define KERNEL_NAME "/vmunix"
  319. X+ #define MEM_NAME "/dev/kmem"
  320. X+ int    mfd;
  321. X+ #endif
  322. X  main(argc, argv)
  323. X      int             argc;
  324. X      char          **argv;
  325. X***************
  326. X*** 57,63 ****
  327. X  {
  328. X  
  329. X      Arg             args[10];
  330. X!     Cardinal        i;
  331. X      XtIntervalId    intervalId;
  332. X      XtTranslations  newTranslations;
  333. X      static XtActionsRec redrawActions[] = {
  334. X--- 76,82 ----
  335. X  {
  336. X  
  337. X      Arg             args[10];
  338. X!     Cardinal        i, j;
  339. X      XtIntervalId    intervalId;
  340. X      XtTranslations  newTranslations;
  341. X      static XtActionsRec redrawActions[] = {
  342. X***************
  343. X*** 69,75 ****
  344. X       <ResReq>:    expose()";
  345. X  
  346. X      struct statstime cpu_status;
  347. X!     char            label[MAXCHARS];
  348. X  
  349. X  
  350. X      toplevel = XtInitialize("xtacho", "XTacho", NULL, 0, &argc, argv);
  351. X--- 88,94 ----
  352. X       <ResReq>:    expose()";
  353. X  
  354. X      struct statstime cpu_status;
  355. X!     char            label[3][MAXCHARS];
  356. X  
  357. X  
  358. X      toplevel = XtInitialize("xtacho", "XTacho", NULL, 0, &argc, argv);
  359. X***************
  360. X*** 84,130 ****
  361. X      SetupTacho(argc, argv);
  362. X  
  363. X      base = XtCreateManagedWidget("base", formWidgetClass, toplevel, NULL, 0);
  364. X  
  365. X!     switch (monitor_item) {
  366. X!     case USER_CPU:
  367. X!         sprintf(label, "%s : User", hostname);
  368. X!         break;
  369. X  
  370. X-     case SYSTEM_CPU:
  371. X-         sprintf(label, "%s : System", hostname);
  372. X-         break;
  373. X- 
  374. X-     case IDLE_CPU:
  375. X-         sprintf(label, "%s : Idle", hostname);
  376. X-         break;
  377. X- 
  378. X-     default:
  379. X-         break;
  380. X-     }
  381. X- 
  382. X-     i = 0;
  383. X-     XtSetArg(args[i], XtNlabel, label);i++;
  384. X-     XtSetArg(args[i], XtNwidth, 100);i++;
  385. X-     info = XtCreateManagedWidget("info", labelWidgetClass, base, args, i);
  386. X- 
  387. X-     i = 0;
  388. X-     XtSetArg(args[i], XtNwidth, 100);i++;
  389. X-     XtSetArg(args[i], XtNheight, 100);i++;
  390. X-     XtSetArg(args[i], XtNborderWidth, 0);i++;
  391. X-     XtSetArg(args[i], XtNfromVert, info);i++;
  392. X-     meter = XtCreateManagedWidget("meter", boxWidgetClass, base, args, i);
  393. X- 
  394. X-     GetGraphicContexts(meter);
  395. X- 
  396. X      XtAddActions(redrawActions, XtNumber(redrawActions));
  397. X      newTranslations = XtParseTranslationTable(overrideTranslations);
  398. X-     XtOverrideTranslations(meter, newTranslations);
  399. X  
  400. X!     rstat(hostname, &cpu_status);
  401. X! 
  402. X!     old_status_time = cpu_status.cp_time[monitor_item];
  403. X! 
  404. X! 
  405. X      /* Interval timer start     */
  406. X  
  407. X      intervalId = XtAddTimeOut(update, PollingCpuStatus, NULL);
  408. X--- 103,150 ----
  409. X      SetupTacho(argc, argv);
  410. X  
  411. X      base = XtCreateManagedWidget("base", formWidgetClass, toplevel, NULL, 0);
  412. X+     sprintf(label[0], "%s : User", hostname);
  413. X+     sprintf(label[1], "System");
  414. X+     sprintf(label[2], "Idle");
  415. X+     for(j = 0; j < 3; j++) {
  416. X+         i = 0;
  417. X+         XtSetArg(args[i], XtNlabel, label[j]);i++;
  418. X+         XtSetArg(args[i], XtNwidth, 100);i++;
  419. X+         if(j!=0)     {
  420. X+         XtSetArg(args[i], XtNfromHoriz, info[j-1]);i++;
  421. X+           }
  422. X+         info[j] = XtCreateManagedWidget("info", labelWidgetClass, base, args, i);
  423. X+       }
  424. X+     for(j = 0; j < 3; j++) {
  425. X+         i = 0;
  426. X+         XtSetArg(args[i], XtNwidth, 100);i++;
  427. X+         XtSetArg(args[i], XtNheight, 100);i++;
  428. X+         XtSetArg(args[i], XtNborderWidth, 0);i++;
  429. X+         XtSetArg(args[i], XtNfromVert, info[j]);i++;
  430. X+         if(j!=0)     {
  431. X+         XtSetArg(args[i], XtNfromHoriz, meter[j-1]);i++;
  432. X+           }
  433. X+         meter[j] = XtCreateManagedWidget("meter", boxWidgetClass, base, args, i);
  434. X  
  435. X!         GetGraphicContexts(meter[j], j);
  436. X!       }
  437. X! #ifdef RSTAT
  438. X!     rstat(hostname, &cpu_status);
  439. X! #else
  440. X!     sys_init();
  441. X!     get_stat(&cpu_status.cp_time[0]);
  442. X! #endif
  443. X!     cpu_status.cp_time[0] = cpu_status.cp_time[0] + cpu_status.cp_time[1];
  444. X!     cpu_status.cp_time[1] = cpu_status.cp_time[2];
  445. X!     cpu_status.cp_time[2] = cpu_status.cp_time[3];
  446. X  
  447. X      XtAddActions(redrawActions, XtNumber(redrawActions));
  448. X      newTranslations = XtParseTranslationTable(overrideTranslations);
  449. X  
  450. X!     for(j = 0; j < 3; j++) {
  451. X!         XtOverrideTranslations(meter[j], newTranslations);
  452. X!         old_status_time[j] = cpu_status.cp_time[j];
  453. X!       }
  454. X      /* Interval timer start     */
  455. X  
  456. X      intervalId = XtAddTimeOut(update, PollingCpuStatus, NULL);
  457. X***************
  458. X*** 169,176 ****
  459. X  }
  460. X  
  461. X  void
  462. X! GetGraphicContexts(w)
  463. X      Widget          w;
  464. X  {
  465. X  
  466. X      Arg             args[2];
  467. X--- 189,197 ----
  468. X  }
  469. X  
  470. X  void
  471. X! GetGraphicContexts(w, j)
  472. X      Widget          w;
  473. X+     Cardinal       j;
  474. X  {
  475. X  
  476. X      Arg             args[2];
  477. X***************
  478. X*** 189,195 ****
  479. X      gcv.foreground = args[0].value;
  480. X      gcv.foreground = args[0].value;
  481. X      gcv.function = GXinvert;
  482. X!     gcNeedle = XtGetGC(w, GCFunction, &gcv);
  483. X  }
  484. X  
  485. X  void
  486. X--- 210,216 ----
  487. X      gcv.foreground = args[0].value;
  488. X      gcv.foreground = args[0].value;
  489. X      gcv.function = GXinvert;
  490. X!     gcNeedle[j] = XtGetGC(w, GCFunction, &gcv);
  491. X  }
  492. X  
  493. X  void
  494. X***************
  495. X*** 224,229 ****
  496. X--- 245,251 ----
  497. X      Cardinal        d_ry;
  498. X      Cardinal        d_width;
  499. X      Cardinal        d_height;
  500. X+     Cardinal        j;
  501. X  
  502. X  
  503. X      XtSetArg(args[0], XtNwidth, 0);
  504. X***************
  505. X*** 253,261 ****
  506. X      /* Draw gauge */
  507. X  
  508. X      DrawGauge(w, gcForeground, d_rx, d_ry);
  509. X  
  510. X-     DrawNeedle(w, gcNeedle, current_status);
  511. X- 
  512. X  }
  513. X  
  514. X  void
  515. X--- 275,289 ----
  516. X      /* Draw gauge */
  517. X  
  518. X      DrawGauge(w, gcForeground, d_rx, d_ry);
  519. X+     for(j=0; j < 3; j++) {
  520. X+         if(meter[j] == w) {
  521. X+         goto find;
  522. X+           }
  523. X+       }
  524. X+     return;
  525. X+       find:
  526. X+     DrawNeedle(w, gcNeedle[j], current_status[j]);
  527. X  
  528. X  }
  529. X  
  530. X  void
  531. X***************
  532. X*** 446,480 ****
  533. X  {
  534. X  
  535. X      struct statstime system_status;
  536. X!     Cardinal        load_count, step;
  537. X  
  538. X      /* Get new CpuTime     */
  539. X! 
  540. X      rstat(hostname, &system_status);
  541. X!     current_status = (double) (system_status.cp_time[monitor_item] - old_status_time) / ((double) update / 2000.0);
  542. X!     old_status_time = system_status.cp_time[monitor_item];
  543. X  
  544. X!     if (current_status > 100)
  545. X!         current_status /= 2;
  546. X! 
  547. X!     if (current_status != old_status) {
  548. X          /* Move Needle */
  549. X  
  550. X!         if (current_status < old_status)
  551. X              step = -1;
  552. X          else
  553. X              step = 1;
  554. X  
  555. X!         for (load_count = old_status; load_count != current_status; load_count += step)
  556. X!             DrawNeedle(meter, gcNeedle, load_count);
  557. X  
  558. X!         for (load_count = old_status + step; load_count != current_status + step; load_count += step)
  559. X!             DrawNeedle(meter, gcNeedle, load_count);
  560. X  
  561. X!     }
  562. X  
  563. X      XtAddTimeOut(update, PollingCpuStatus, NULL);
  564. X  
  565. X-     old_status = current_status;
  566. X- 
  567. X  }
  568. X--- 474,544 ----
  569. X  {
  570. X  
  571. X      struct statstime system_status;
  572. X!     Cardinal        load_count, step, j, tmp;
  573. X  
  574. X      /* Get new CpuTime     */
  575. X! #ifdef RSTAT
  576. X      rstat(hostname, &system_status);
  577. X! #else
  578. X!     get_stat(&system_status.cp_time[0]);
  579. X! #endif
  580. X!     system_status.cp_time[0] = system_status.cp_time[0] + system_status.cp_time[1];
  581. X!     system_status.cp_time[1] = system_status.cp_time[2];
  582. X!     system_status.cp_time[2] = system_status.cp_time[3];
  583. X!     tmp = 0;
  584. X!     for(j = 0; j < 3; j++) {
  585. X!         tmp += (system_status.cp_time[j] - old_status_time[j]) ;
  586. X!       }
  587. X!     
  588. X!     for(j = 0; j < 3; j++) {
  589. X!         current_status[j] = (double) (system_status.cp_time[j] - old_status_time[j]) / ((double) tmp / 100.0);
  590. X!         old_status_time[j] = system_status.cp_time[j];
  591. X!         
  592. X!         if (current_status[j] > 100)
  593. X!         current_status[j] /= 2;
  594. X  
  595. X!         if (current_status[j] != old_status[j]) {
  596. X          /* Move Needle */
  597. X  
  598. X!         if (current_status[j] < old_status[j])
  599. X              step = -1;
  600. X          else
  601. X              step = 1;
  602. X  
  603. X!         for (load_count = old_status[j]; load_count != current_status[j]; load_count += step)
  604. X!             DrawNeedle(meter[j], gcNeedle[j], load_count);
  605. X  
  606. X!         for (load_count = old_status[j] + step; load_count != current_status[j] + step; load_count += step)
  607. X!             DrawNeedle(meter[j], gcNeedle[j], load_count);
  608. X  
  609. X!           }
  610. X  
  611. X+         old_status[j] = current_status[j];
  612. X+       }
  613. X+ 
  614. X      XtAddTimeOut(update, PollingCpuStatus, NULL);
  615. X  
  616. X  }
  617. X+ 
  618. X+ #ifndef RSTAT
  619. X+ /* get CPU status from kernel */
  620. X+ sys_init()
  621. X+   {
  622. X+     nlist("/vmunix", nl);
  623. X+     if(nl[0].n_type == 0) {
  624. X+     fprintf(stderr, "no namelist in %s\n", KERNEL_NAME);
  625. X+     exit(1);
  626. X+       }
  627. X+     if((mfd = open(MEM_NAME, 0)) < 0) {
  628. X+     fprintf(stderr, "fali to open %s\n", MEM_NAME);
  629. X+     exit(1);
  630. X+       }
  631. X+   }
  632. X+ get_stat(mem_ad)
  633. X+ int *mem_ad;
  634. X+   {
  635. X+     lseek(mfd, nl[0].n_value, 0);
  636. X+     read(mfd, mem_ad, 16);
  637. X+   }
  638. X+ 
  639. X+ #endif
  640. SHAR_EOF
  641. chmod 0644 patch1 || echo "restore of patch1 fails"
  642. exit 0
  643.  
  644. #---------------------  end of file ---------------------
  645.