Collapse All
Parallels Virtualization SDK
ContentsIndex
PreviousUpNext
PrlVm_SubscribeToGuestStatistics Function
PHT_VIRTUAL_MACHINE  See Also

Subscribes to receive the specified virtual machine performance statistics on a periodic basis.

Syntax
PRL_HANDLE PrlVm_SubscribeToGuestStatistics(
    PRL_HANDLE hVm
);
File

PrlApiVm.h

Parameters

hVm
A handle of type PHT_VIRTUAL_MACHINE identifying the virtual machine.

Returns

A handle of type PHT_JOB containing the results of this asynchronous operation or PRL_INVALID_HANDLE if there's not enough memory to instantiate the job object.

Remarks

To obtain statistics, an event handler (callback function) is required. Within the event handler, first check the type of event. Events of type PET_DSP_EVT_VM_STATISTICS_UPDATED indicate an event containing performance data. To access the statistics handle (a handle of type PHT_SYSTEM_STATISTICS), first extract the event parameter using PrlEvent_GetParam, then convert the result (which will be a handle to an object of type PHT_EVENT_PARAMETER) to a handle using PrlEvtPrm_ToHandle. The functions that operate on PHT_SYSTEM_STATISTICS references can then be used to obtain statistics data. 

For the event handler to be called, it is necessary to register it with PrlVm_RegEventHandler. When statistics data is no longer required, unsubscribe from statistics events using PrlVm_UnsubscribeFromGuestStatistics. When events are no longer required, unregister the event handler using PrlVm_UnregEventHandler

To get the return code from the PHT_JOB object, use the PrlJob_GetRetCode function. Possible values are: 

PRL_ERR_INVALID_ARG - invalid handle was passed. 

PRL_ERR_SUCCESS - function completed successfully. 

See Also
Links
© 2021 Parallels International GmbH. All rights reserved.