HP3000-L Archives

January 1997, Week 4

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Stan Sieler <[log in to unmask]>
Reply To:
Stan Sieler <[log in to unmask]>
Date:
Fri, 24 Jan 1997 21:01:28 -0800
Content-Type:
text/plain
Parts/Attachments:
text/plain (86 lines)
Jim asks:

>  Can anyone suggest a programmatic method I can use to determine cpu
> utilization at a given point?
>

I know of 4 basic techniques that seem to work:

   1) Buying the AIF:MI
      (Architected Interface Facility : Measurement Interface)

      It will probably give you the information,
      BUT
      it's expensive (if I recall correctly)
      AND, simply turning on the MI costs between 5 and 40% of your
      CPU (trivially demonstratable) ... in a manner not visible to AIF:MI!

   2) compute it yourself: get CPU time of every process, pause, do it again,
      utilization is about (new_cpu - old_cpu) / pause time * 100.
      But...doesn't take into account the time it takes to get the CPU,
      and what happens when a process terminates (and thus isn't seen in
      the "new_cpu" number), and has other problems.

   3) Use SMTP.

      Enable SMTP on your 3000, and write a network-aware utility that
      uses SMTP protocols to ask your 3000 how busy it is.

      Note: CPU reporting isn't on by default ... turning it on requires
      an SMTP command (which I can look up) ... and when it is on, it has the
      Measurement Interface (see #1) turned on (with the same hidden cost).

or, perhaps the sneakiest,

   4) start a VERY LOW priority background process whose only purpose is
      to do:    while true do ;
      (i.e., it simply eats CPU)
      I'd set the priority:

          getprivmode;

          pri := [8/255, 8/"A"];    or, for hex:  pri := $ff41;

          getpriority (0 <<me>>, pri, 0);

      then, to see what CPU utilization is right.....now, do:


          get process CPU time for the background process.
          pause 10 seconds
          get process CPU time for the background process.

          CPU_percent := ((new - old) * 100) / 10;

      (be careful of rounding, integer overflow, etc)
      (works more accurately if you (process doing get/pause/get) have
       HIGH priority)

      You'll need one background process per CPU on the system.

      Cons:
         Every other performance measurement tool on the system will
         say "hey, the system is 100% busy"!

         When momentarily idle, takes a few instructions to launch the
         "idle" process (who cares), but more importantly ... when something
         occurs to make another process ready to run, we now have to
         quiesce the idle process, which means a very small system impact.
         (probably not measurable)

   How do you get the CPU time for a given process?

      1) AIF:PE, the procedure AIFPROCGET

      2) :SHOWPROC into a file

      3) int64 get_proc_cpu_time (pin) returns CPU time in microseconds
         (as a 64-bit integer).  If the process is dead, 0 is returned
         (AFAIK).

Good luck!

--
Stan Sieler                                          [log in to unmask]
                                     http://www.allegro.com/sieler.html

ATOM RSS1 RSS2