- Added the function that measures the CPU usage for multi core/processors.

For instance:

[MeasureCPU]
Measure=CPU

[MeasureCPU1]
Measure=CPU
Processor=1

[MeasureCPU2]
Measure=CPU
Processor=2

MeasureCPU returns the average of the CPU usage across all core/processors. This is same as Processor=0.

MeasureCPU1/2 returns the CPU usage of each core/processor.

-----

- Fixed the problem that the correct value is not returned if the Interface=0 in NetIn/NetOut/NetTotal measure. The cause of this problem is because the value of all filter devices is summed in Vista or newer.

-----

- Added the option (Debug) for debug logging. This must be put under [Rainmeter]-section in Rainmeter.ini.

This option specifies whether extra debugging log from Rainmeter.dll is output to Rainmeter.log.

[Rainmeter]
Debug=1

Default is 0.

-----

- Application: Fixed a wrong return value type from MainWndProc.
This commit is contained in:
spx
2010-02-13 03:07:34 +00:00
parent 506b6b84f3
commit be3b4114bb
15 changed files with 910 additions and 257 deletions

View File

@ -21,22 +21,16 @@
#include "Measure.h"
typedef struct
{
LARGE_INTEGER liIdleTime;
DWORD dwSpare[76];
} SYSTEM_PERFORMANCE_INFORMATION;
typedef struct
{
LARGE_INTEGER liKeBootTime;
LARGE_INTEGER liKeSystemTime;
LARGE_INTEGER liExpTimeZoneBias;
ULONG uCurrentTimeZoneId;
DWORD dwReserved;
} SYSTEM_TIME_INFORMATION;
typedef struct _SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION {
LARGE_INTEGER IdleTime;
LARGE_INTEGER KernelTime;
LARGE_INTEGER UserTime;
LARGE_INTEGER Reserved1[2];
ULONG Reserved2;
} SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION, *PSYSTEM_PROCESSOR_PERFORMANCE_INFORMATION;
typedef LONG (WINAPI *PROCNTQSI)(UINT,PVOID,ULONG,PULONG);
typedef BOOL (WINAPI *PROCGST)(LPFILETIME lpIdleTime, LPFILETIME lpKernelTime, LPFILETIME lpUserTime);
class CMeasureCPU : public CMeasure
{
@ -44,19 +38,23 @@ public:
CMeasureCPU(CMeterWindow* meterWindow);
virtual ~CMeasureCPU();
virtual void ReadConfig(CConfigParser& parser, const WCHAR* section);
virtual bool Update();
protected:
void CalcUsage(double idleTime, double systemTime);
void CalcAverageUsage(SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION* systemPerfInfo);
bool m_CPUFromRegistry;
bool m_FirstTime;
PROCNTQSI m_NtQuerySystemInformation;
int m_Processor;
int m_NumOfProcessors;
SYSTEM_PERFORMANCE_INFORMATION m_SysPerfInfo;
SYSTEM_TIME_INFORMATION m_SysTimeInfo;
SYSTEM_INFO m_SystemInfo;
LARGE_INTEGER m_OldIdleTime;
LARGE_INTEGER m_OldSystemTime;
PROCNTQSI m_NtQuerySystemInformation;
PROCGST m_GetSystemTimes;
std::vector<double> m_OldTime;
};
#endif