(0002) Accessing MONITOR per-CPU Information

Archive of the OpenVMS Ask the Wizard (ATW) questions and answers database.
Locked

Topic author
User
Visitor
Posts: 0
Joined: Mon Jan 10, 2022 8:16 am
Reputation: 0
Status: Offline

(0002) Accessing MONITOR per-CPU Information

Post by User » Thu Jan 10, 2002 8:18 am

How can I determine the CPU-usage of a system by using
C-functions.

I want the same information as I get with the
'monitor system' command (CPU busy)


Wizard
Visitor
Posts: 0
Joined: Mon Jan 10, 2022 8:17 am
Reputation: 0
Status: Offline

Re: (0002) Accessing MONITOR per-CPU Information

Post by Wizard » Fri Jan 11, 2002 8:18 am

There is no documented interface to MONITOR, but with access to the
OpenVMS source listings CD-ROM set (Order QB-MT1AB-E8 for OpenVMS Alpha,
QB-001AB-E8 for OpenVMS VAX) and look at the facility [MONTOR] (yes,
"MONTOR", not "MONITOR"), and specifically look at the (undocumented,
unsupported, and subject to change without notice) exe$getspi interface
used within MONITOR. (You will need to LINK against a MONITOR shareable
image to resolve your references to the exe$getspi interface.)

Alternatively, you will want to acquire and read through the Internals
and Data Structures Manual (editions for OpenVMS VAX and OpenVMS Alpha)
from Digital Press (www.bh.com) and create a small kernel-mode routine
to acquire the information from the vector that is the source of the
information reported by MONITOR and other utilities

In the per-CPU database referenced by the SMP$GL_CPU_DATA address, look
at the CPU$Q_NULLCPU cell for each CPU.

Additionally, the SNMP MIB for OpenVMS containing performance data may
be of interest.

The OpenVMS Wizard would not be surprised to learn there are various
programs available from the Encompass (formerly DECUS) library and
from other sources that could be used as examples of the exe$getspi
and/or the kernel per-CPU database. One such example of calling the
MONITOR interface exe$getspi is included on various of the OpenVMS
Freeware: [SRH_EXAMPLES]I_SPI.* and related.

Also potentially of interest will be the OpenVMS Galaxy GCU processor
load-balancing and SMP process/processor (re)scheduling example,
provided on V7.2 and later releases: sys$example:GCU$BALANCER.C. A
related class scheduler example is available in sys$examples:class.c

With OpenVMS V7.3 and later, the (undocumented and unsupported)
exe$getspi interface was replaced with the (documented and supported)
sys$getrmi interface.

Related topics in Ask The Wizard include (2), (697), (1639), (3398),
(3687), (4059), (4626), (5235), (5702), (7054), (7155), and likely
others.

Locked