Cover V01, I03
Article
Figure 1
Figure 2
Figure 3
Figure 4
Listing 1
Listing 2
Listing 3

sep92.tar


Listing 2: The a Script

1: #
2: #   a:  Analyze number of system/user processes and system load.
3: #       Written by Leor Zolman, 3/91
4: #
5: #   usage:
6: #       a
7: #
8: # assumes:
9: #   1) "uptime" command (equivalent to "w -t") is available
10: #   2) printer processes are all run with user-id "lp"
11: #
12:
13: echo
14: uptime
15: echo
16: echo Analyzing...
17:
18: rootpros=`expr \`ps -u root | wc -l \` - 1`
19: lppros=`expr \`ps -u lp | wc -l \` - 1`
20:
21: otherpros=`expr $rootpros + $lppros`
22: totpros=`expr \`ps -e | wc -l \` - 3`
23:
24: userpros=`expr $totpros - $otherpros`
25: shpros=`ps -ef | awk '{
26:  if (($8 == "-sh" || $8 == "-ksh" || $8 == -csh) && $1 != root)
27:     print
28:  }' | wc -l`
29: nonshpros=`expr $userpros - $shpros`
30: nusers=`expr \`who | awk '{print $1}' | sort | uniq | wc -l\``
31: int=`expr $userpros / $nusers`
32: mod100=`expr \`expr $userpros '*' 100 /  $nusers\` % 100`
33: intnonsh=`expr $nonshpros / $nusers`
34: mod100nonsh=`expr \`expr $nonshpros '*' 100 /  $nusers\` % 100`
35: echo
36:
37: echo "User processes................. $userpros    ($nusers distinct users)"
38: echo "Avg processes per user......... $int.$mod100"
39: echo "Avg non-shell procs per user... $intnonsh.$mod100nonsh"
40: echo "Root processes................. $rootpros"
41: echo "Printer processes.............. $lppros"
42: echo "------------------------------------"
43: echo "TOTAL PROCESSES................ $totpros"
44: