Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
The get_AllCounters method retrieves an array that contains all of the counters supported by the interface.
HRESULT get_AllCounters(
SAFEARRAY(VARIANT)** psaCounters
);
Arguments
psaCounters |
[out] Pointer to a pointer to a VARIANT array containing the counters. |
Return Value
If the method succeeds, it returns S_OK. If it fails, it returns an HRESULT error code.
Return code |
Number |
Description |
|---|---|---|
E_POINTER |
0x80004003 |
Indicates that psaCounters is a NULL pointer argument. |
Remarks
The array is two-dimensional. The first element in each row contains the name of the counter property, and the second element in each row contains the value. The get_AllCounters method is used to speed up counter retrieval during remote administration, by making one call instead of multiple calls to retrieve multiple counter properties.
For more information about the counters returned in the array, see the following methods.
Method |
Description |
|---|---|
get_ConnectedPlayers |
Retrieves the maximum number of players that have been connected to the publishing point simultaneously. |
get_CountersStartTime |
Retrieves the date and time at which the publishing point started monitoring the peak counters. |
get_OutgoingDistributionAllocatedBandwidth |
Retrieves the maximum bandwidth that has been allocated to a distribution connection. |
get_OutgoingDistributionConnections |
Retrieves the maximum number of distribution connections permitted. |
get_PlayerAllocatedBandwidth |
Retrieves the maximum bandwidth that has been allocated to player connections. |
get_StreamingPlayers |
Retrieves the maximum number of players that have streamed content simultaneously from the publishing point. |
get_StreamingHTTPPlayers |
Retrieves the maximum number of players that have streamed content simultaneously by using the HTTP protocol from the publishing point. |
get_StreamingRTSPPlayers |
Retrieves the maximum number of players that have streamed content simultaneously by using the RTSP protocol from the publishing point. |
get_StreamingUDPPlayers |
Retrieves the maximum number of players that have streamed content simultaneously by using the User Datagram Protocol (UDP) from the publishing point. |
Example
#include <windows.h>
#include <atlbase.h> // Includes CComVariant.
#include "wmsserver.h"
// Declare variables and interfaces.
IWMSServer *pServer;
IWMSPublishingPoints *pPubPoints;
IWMSPublishingPoint *pPubPoint;
IWMSPublishingPointPeakCounters *pPeakCounters;
HRESULT hr;
SAFEARRAY *psaAllCounters;
CComVariant varIndex;
CComVariant varData;
long lCount;
long xMin, xMax;
long yMin, yMax;
long lArrayIndex[2];
// Initialize the COM library and retrieve a pointer
// to an IWMSServer interface.
hr = CoInitialize(NULL);
hr = CoCreateInstance(CLSID_WMSServer,
NULL,
CLSCTX_ALL,
IID_IWMSServer,
(void **)&pServer);
if (FAILED(hr)) goto EXIT;
// Retrieve a pointer to the IWMSPublishingPoints interface
// and retrieve the total count of publishing points.
hr = pServer->get_PublishingPoints(&pPubPoints);
if (FAILED(hr)) goto EXIT;
hr = pPubPoints->get_Count(&lCount);
if (FAILED(hr)) goto EXIT;
for (long x = 0; x < lCount; x++)
{
varIndex = x;
hr = pPubPoints->get_Item(varIndex, &pPubPoint);
if (FAILED(hr)) goto EXIT;
// Retrieve a pointer to a list of peak statistics
// for the publishing point.
hr = pPubPoint->get_PeakCounters(&pPeakCounters);
if (FAILED(hr)) goto EXIT;
// Retrieve an array of all the counters in this interface.
hr = pPeakCounters->get_AllCounters(&psaAllCounters);
if (FAILED(hr)) goto EXIT;
// Retrieve the upper and lower bounds of the
// rows in the array.
hr = SafeArrayGetLBound(psaAllCounters, 1, &xMin);
if (FAILED(hr)) goto EXIT;
hr = SafeArrayGetUBound(psaAllCounters, 1, &xMax);
if (FAILED(hr)) goto EXIT;
// Retrieve the upper and lower bounds of the
// columns in the array.
hr = SafeArrayGetLBound(psaAllCounters, 2, &yMin);
if (FAILED(hr)) goto EXIT;
hr = SafeArrayGetUBound(psaAllCounters, 2, &yMax);
if (FAILED(hr)) goto EXIT;
// Process each array element.
for (long y = xMin; y <= xMax; y++)
{
for (long z = yMin; z <= yMax; z++)
{
// Retrieve the next element in the array
lArrayIndex[0] = y;
lArrayIndex[1] = z;
hr = SafeArrayGetElement(psaAllCounters,
lArrayIndex,
&varData);
if (FAILED(hr)) goto EXIT;
if (varData.vt == VT_BSTR)
// TODO: Handle counter names.
if (varData.vt == VT_I4)
// TODO: Handle counter values.
}
}
// Release temporary COM objects.
pPubPoint->Release();
pPeakCounters->Release();
}
EXIT:
// TODO: Release temporary COM objects and uninitialize COM.
Requirements
Header: wmsserver.h.
Library: WMSServerTypeLib.dll.
Platform: Windows Server 2003 family, Windows Server 2008 family.
Note
Some counters are not available in the Windows Server 2003 family.