PerformanceWin.cpp revision 391cf11262671da62bcc02db361038e7ffbab8f7
/* $Id$ */
/** @file
*
* VBox Windows-specific Performance Classes implementation.
*/
/*
* Copyright (C) 2008 Sun Microsystems, Inc.
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
* Clara, CA 95054 USA or visit http://www.sun.com if you need
* additional information or have any questions.
*/
#include <pdh.h>
#include <pdhmsg.h>
#include "Performance.h"
//#pragma comment(lib, "pdh.lib")
namespace pm {
class CollectorWin : public CollectorHAL
{
public:
CollectorWin();
~CollectorWin();
virtual int getHostCpuMHz(unsigned long *mhz);
virtual int getHostMemoryUsage(unsigned long *total, unsigned long *used, unsigned long *available);
private:
};
{
mHAL = new CollectorWin();
}
{
if (pdhStatus != ERROR_SUCCESS)
return;
L"\\Processor(_Total)\\% User Time");
L"\\Processor(_Total)\\% Privileged Time");
L"\\Processor(_Total)\\% Idle Time");
}
{
if (mHostCpuLoadQuery)
}
{
switch (pdhStatus)
{
case PDH_INVALID_ARGUMENT:
return VERR_INVALID_PARAMETER;
case PDH_INVALID_HANDLE:
return VERR_INVALID_HANDLE;
}
return RTErrConvertFromWin32(pdhStatus);
}
{
if (pdhStatus != ERROR_SUCCESS)
return 0;
return hCounter;
}
{
NULL,
&fmtValue);
if (pdhStatus != ERROR_SUCCESS)
return convertPdhStatusToRTErr(pdhStatus);
return VINF_SUCCESS;
}
{
int rc;
if (pdhStatus != ERROR_SUCCESS)
return convertPdhStatusToRTErr(pdhStatus);
return VINF_SUCCESS;
}
{
return E_NOTIMPL;
}
int CollectorWin::getHostMemoryUsage(unsigned long *total, unsigned long *used, unsigned long *available)
{
if (GlobalMemoryStatusEx(&mstat))
{
}
else
return RTErrConvertFromWin32(GetLastError());
return VINF_SUCCESS;
}
{
return E_NOTIMPL;
}
{
return E_NOTIMPL;
}
}