Parallels Desktop® 10 for Mac — C API Reference Guide
|
Obtains a handle of type PHT_SYSTEM_STATISTICS containing the host resource usage statistics.
PRL_HANDLE PrlSrv_GetStatistics( PRL_HANDLE hServer );
PrlApiStat.h
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.
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.
To get the result from the PHT_JOB object:
The following example illustrates how to obtain a handle of type PHT_SYSTEM_STATISTICS .
PRL_RESULT err = PRL_ERR_UNINITIALIZED; PRL_RESULT rc = PRL_ERR_UNINITIALIZED; PRL_HANDLE hJob = PRL_INVALID_HANDLE; PRL_HANDLE hJobResult = PRL_INVALID_HANDLE; PRL_HANDLE hServer = PRL_INVALID_HANDLE; // Initialize API library. err = PrlApi_Init(PARALLELS_API_VER); if (PRL_FAILED(err)) { // Error handling goes here... return -1; } // Create server handle. err = PrlSrv_Create(&hServer); // if (err != PRL_ERR_SUCCESS), process the error here. hJob = PrlSrv_Login( hServer, // Server handle "10.30.21.243", // Server IP address "jdoe", // User "secret", // Password 0, // Previous session ID 0, // Port number 0, // Timeout PSL_LOW_SECURITY); // Security // Wait for the job to complete. err = PrlJob_Wait(hJob, 1000); // if (err != PRL_ERR_SUCCESS), process the error here. // Get job return code. err = PrlJob_GetRetCode(hJob, &rc); // if (err != PRL_ERR_SUCCESS), process the error here. // if (rc != PRL_ERR_SUCCESS), process the error here. // Free job handle. PrlHandle_Free(hJob); // Get statistics. hJob = PrlSrv_GetStatistics(hServer); err = PrlJob_Wait(hJob, 10000); // if (err != PRL_ERR_SUCCESS), process the error here. err = PrlJob_GetRetCode(hJob, &rc); // if (err != PRL_ERR_SUCCESS), process the error here. // if (rc != PRL_ERR_SUCCESS), process the error here. err = PrlJob_GetResult(hJob, &hJobResult); PrlHandle_Free(hJob); // Get the PHT_SYSTEM_STATISTICS handle. PRL_HANDLE hHandle = PRL_INVALID_HANDLE; err = PrlResult_GetParam(hJobResult, &hHandle); // if (err != PRL_ERR_SUCCESS), process the error here. PrlHandle_Free(hJobResult);
Copyright © 1999-2015 Parallels IP Holdings GmbH and its affiliates. All rights reserved.
|
What do you think about this topic?
Send feedback!
|