From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <96076335021712.tru64-unix-managers.marc@archive.invalid> From: "Randy M. Hayman" Date: Mon, 29 Jul 1996 23:19:35 +0000 To: tru64-unix-managers Subject: FYI: syd-3.1-k08 modifications X-MARC-Message: https://marc.info/?l=tru64-unix-managers&m=96076335021712 Claus Kalle (cc: alpha-osf-managers mailing list)- I've modified syd.c to include another option to provide for a potentially more useful "Command" column display. This is particularily useful for sites like us running multiple instances of oracle on a single host. I've tested this on Digital UNIX v3.2D-1 and v4.0 (output using 'syd' command): OSF1 V3.2 V.41 -- System Information Display syd3.1-k08 -- Jul 29 14:20:07 CPU Mode Total Current Processes devintr 292 Free 1111584 K User 19% 67% Runnable 10 cntxtsw 1583 pageflts 709 Nice 0% 0% Sleeping 137 syscall 12122 pagein 40 Kernel 25% 32% Inactive 740 forks 6 pageout 0 Idle 56% 0% UnintWait 1 vforks 0 Load 8.18 6.94 6.63 Stopped 4 ttinch 24 dkxfers 70 Uptime 1 day, 5:26 Other 0 ttoutch 4384 dkwords 11465 PID Username BP Pr Sleep RSize CP/RT CPUSeconds User Thr S Cur Command 1391 oracle 44 61 0 197M 2% 2788.0 85% 1 R 22% oracle 1394 oracle 44 50 0 189M 1% 1619.8 89% 1 R 8% oracle 30768 root 44 56 0 4128K 24% 1.7 11% 1 R 7% syd 1390 oracle 44 49 0 195M 5% 6064.1 90% 1 R 7% oracle 1393 oracle 44 49 0 192M 2% 2130.7 87% 1 R 7% oracle 1396 oracle 44 50 0 178M 0% 686.2 84% 1 R 6% oracle 1645 oracle 44 46 0 5840K 1% 1286.4 36% 1 R 5% oracle 1452 oracle 44 50 0 169M 0% 402.1 80% 1 R 5% oracle ... ... ... (output using 'syd -l' command - the 'l' stands for 'long command'): OSF1 V3.2 V.41 -- System Information Display syd3.1-k08 -- Jul 29 14:18:57 CPU Mode Total Current Processes devintr 320 Free 1107240 K User 19% 69% Runnable 9 cntxtsw 2189 pageflts 336 Nice 0% 0% Sleeping 141 syscall 20493 pagein 30 Kernel 25% 29% Inactive 740 forks 5 pageout 0 Idle 56% 1% UnintWait 0 vforks 0 Load 5.77 6.19 6.37 Stopped 4 ttinch 37 dkxfers 85 Uptime 1 day, 5:25 Other 0 ttoutch 4248 dkwords 16245 PID Username BP Pr Sleep RSize CP/RT CPUSeconds User Thr S Cur Command 1391 oracle 44 57 0 197M 2% 2752.5 85% 1 R 26% ora_s002_FINP 1645 oracle 44 42 0 5808K 1% 1275.5 36% 1 S 11% ora_d002_FINP 26631 sxfinp 44 49 0 73M 9% 2322.4 91% 1 R 10% oracleFINP 1390 oracle 44 49 0 194M 5% 6053.2 90% 1 R 10% ora_s001_FINP 1394 oracle 44 44 0 189M 1% 1612.5 89% 1 R 5% ora_s002_RPTS 1393 oracle 44 46 0 192M 2% 2120.3 87% 1 R 5% ora_s003_TEST 30247 root 44 49 0 4128K 8% 2.5 13% 1 R 3% /local/bin/syd 1653 oracle 44 44 1 4736K 0% 599.4 36% 1 S 3% ora_d003_FINP ... ... ... There is a single minor bug with this new argument which I've found, namely the command line for sendmail "sendmail: accepting connections" may have garbage appended to the string using the -l argument to the syd command. I believe this is due to the fact that sendmail changes his own command string to show that he is accepting connections, but doesn't terminate that string with '\0'. Randy M. Hayman haymanr@icefog.alaska.edu diff -c output of new (syd.c) and old (syd.c.pre_cmmd_option) files: *** syd.c Mon Jul 29 15:07:29 1996 --- syd.c.pre_cmmd_option Mon Jul 29 11:16:39 1996 *************** *** 180,193 **** static time_t curr_time; char *usage = ! /* +++ start of rmhayman mods */ ! "usage: %s [-s sleep] [-m mode] [-l]" "\n" ! /* --- end of rmhayman mods */ "" "\n" " sleep: time between updates, default=10 [seconds]" "\n" - /* +++ start of rmhayman mods */ - " long cmmd: full command" "\n" - /* --- end of rmhayman mods */ " mode: \"n\" => `top'-like display (default)" "\n" " \"b\" => barchart display" "\n"; #include --- 180,188 ---- static time_t curr_time; char *usage = ! "usage: %s [-s sleep] [-m mode]" "\n" "" "\n" " sleep: time between updates, default=10 [seconds]" "\n" " mode: \"n\" => `top'-like display (default)" "\n" " \"b\" => barchart display" "\n"; #include *************** *** 283,293 **** /*****/ - /* +++ start of rmhayman mods */ - char abuff[1024+1]; - int long_cmmd = 0; - /* --- end of rmhayman mods */ - main(int argc, char **argv) { --- 278,283 ---- *************** *** 301,309 **** prgname=argv[0]; errflg = 0; ! /* +++ start of rmhayman mods */ ! while((c = getopt(argc,argv,"n:m:s:tl")) != -1) ! /* --- end of rmhayman mods */ switch(c) { case 'm': switch (optarg[0]) { case 'n': dspmod=0; break; --- 291,297 ---- prgname=argv[0]; errflg = 0; ! while((c = getopt(argc,argv,"n:m:s:t")) != -1) switch(c) { case 'm': switch (optarg[0]) { case 'n': dspmod=0; break; *************** *** 312,320 **** } break; case 's': slptm = atoi(optarg); break; - /* +++ start of rmhayman mods */ - case 'l': long_cmmd++; break; - /* --- end of rmhayman mods */ default: errflg++; } if (errflg || (optind < argc) ) {fprintf(stderr,usage,prgname); exit(1);} --- 300,305 ---- *************** *** 997,1010 **** if (tprc->pi_pid == 0) { return("[kernel]"); } else if(tprc->pi_flag & SLOAD) { ! /* +++ start of rmhayman mods */ ! if(long_cmmd && (-1 != (table(TBL_ARGUMENTS, tprc->pi_pid, &abuff[0], 1, sizeof(abuff))) )) { ! return(abuff); ! } ! else { ! return(tprc->pi_comm); ! } ! /* --- end of rmhayman mods */ } else { return(""); } --- 982,988 ---- if (tprc->pi_pid == 0) { return("[kernel]"); } else if(tprc->pi_flag & SLOAD) { ! return(tprc->pi_comm); } else { return(""); } *************** *** 1094,1105 **** #else /* avoid 80th ("last") column - helps with `curses' on VT100 */ if(strlen(lstcmd) > scrcolumns - 65 - 1) lstcmd[scrcolumns - 65 - 1] = '\0'; #endif ! /* +++ start of rmhayman mods */ ! if(!long_cmmd) ! mvprintw(line,65,"%-s",lstcmd); ! else ! mvprintw(line,65,"%-s",lastcmd(tprc)); ! /* --- end of rmhayman mods */ } --- 1072,1078 ---- #else /* avoid 80th ("last") column - helps with `curses' on VT100 */ if(strlen(lstcmd) > scrcolumns - 65 - 1) lstcmd[scrcolumns - 65 - 1] = '\0'; #endif ! mvprintw(line,65,"%-s",lstcmd); }