The mi_class_numvp() function

The mi_class_numvp() function obtains the number of active virtual processors (VPs) in a VP class.

Syntax

mi_integer mi_class_numvp(VPclass_id)
   mi_integer VPclass_id;
VPclass_id
A VP-class identifier for the VP class whose number of active VPs the function is to return. This argument can be either of the following values:
A valid VP-class identifier
Obtains the number of active VPs in the specified VP class.
MI_CURRENT_CLASS VP-class constant
Obtains the number of active VPs in the VP class of the current VP.
Valid in client LIBMI application? Valid in user-defined routine?
No Yes
Important: This advanced function can adversely affect your UDR if you use the function incorrectly. Use it only when no regular DataBlade API function can perform the task you need done.

Usage

The mi_class_numvp() function returns the number of active VPs in the VP class that the VPclass_id argument specifies. An active VP is a VP that is currently executing a task. The number of active VPs is initially the value assigned with the num option in the VPCLASS configuration parameter. For example, suppose you have the following VPCLASS configuration parameter:
VPCLASS=newvp, num=3, max=6

The mi_class_numvp() function returns the value of 3 when it receives the VP-class identifier for the newvp VP class. However, if the DBA dynamically adds or removes VPs, the value that mi_class_numvp() returns might not coincide with the num option. You can obtain a VP-class identifier with the mi_vpinfo_classid() or mi_class_id() function.

This function is useful to determine if the current VP is part of a single-instance VP class. For such a VP class, the mi_class_numvp() function returns a value of 1.
Tip: To obtain the maximum number of VPs defined for the VP class (by the max option of the VPCLASS configuration parameter), use the mi_class_maxvps() function.

For information about how to obtain information about VPs and VP classes, see the HCL Informix® DataBlade API Programmer's Guide.

Return values

>=0
The number of active VPs in the VP class associated with the specified VP-class identifier.
MI_ERROR
The function was not successful or that the specified VP class does not exist.

Copyright© 2019 HCL Technologies Limited