mirror of
https://github.com/chibicitiberiu/rainmeter-studio.git
synced 2024-02-24 04:33:31 +00:00
Disabled double update on initialization for measures
This commit is contained in:
parent
66a5579550
commit
bb4bcbdce3
@ -65,7 +65,6 @@ ULONG CMeasureCPU::c_BufferSize = 0;
|
||||
**
|
||||
*/
|
||||
CMeasureCPU::CMeasureCPU(CMeterWindow* meterWindow, const WCHAR* name) : CMeasure(meterWindow, name),
|
||||
m_FirstTime(true),
|
||||
m_Processor(),
|
||||
m_OldTime()
|
||||
{
|
||||
@ -99,24 +98,12 @@ void CMeasureCPU::ReadConfig(CConfigParser& parser, const WCHAR* section)
|
||||
{
|
||||
CMeasure::ReadConfig(parser, section);
|
||||
|
||||
int processor = parser.ReadInt(section, L"Processor", 0);
|
||||
m_Processor = parser.ReadInt(section, L"Processor", 0);
|
||||
|
||||
if (processor < 0 || processor > c_NumOfProcessors)
|
||||
if (m_Processor < 0 || m_Processor > c_NumOfProcessors)
|
||||
{
|
||||
LogWithArgs(LOG_WARNING, L"CPU: Processor=%i invalid in [%s]", processor, section);
|
||||
|
||||
processor = 0;
|
||||
}
|
||||
|
||||
if (processor != m_Processor)
|
||||
{
|
||||
m_Processor = processor;
|
||||
m_FirstTime = true;
|
||||
}
|
||||
|
||||
if (m_FirstTime)
|
||||
{
|
||||
m_OldTime[0] = m_OldTime[1] = 0.0;
|
||||
LogWithArgs(LOG_WARNING, L"CPU: Processor=%i invalid in [%s]", m_Processor, section);
|
||||
m_Processor = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -222,20 +209,11 @@ bool CMeasureCPU::Update()
|
||||
*/
|
||||
void CMeasureCPU::CalcUsage(double idleTime, double systemTime)
|
||||
{
|
||||
if (!m_FirstTime)
|
||||
{
|
||||
double dbCpuUsage;
|
||||
|
||||
// CurrentCpuUsage% = 100 - ((IdleTime / SystemTime) * 100)
|
||||
dbCpuUsage = 100.0 - ((idleTime - m_OldTime[0]) / (systemTime - m_OldTime[1])) * 100.0;
|
||||
double dbCpuUsage = 100.0 - ((idleTime - m_OldTime[0]) / (systemTime - m_OldTime[1])) * 100.0;
|
||||
|
||||
dbCpuUsage = min(dbCpuUsage, 100.0);
|
||||
m_Value = max(dbCpuUsage, 0.0);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_FirstTime = false;
|
||||
}
|
||||
|
||||
// store new CPU's idle and system time
|
||||
m_OldTime[0] = idleTime;
|
||||
|
@ -39,8 +39,6 @@ protected:
|
||||
private:
|
||||
void CalcUsage(double idleTime, double systemTime);
|
||||
|
||||
bool m_FirstTime;
|
||||
|
||||
int m_Processor;
|
||||
|
||||
double m_OldTime[2];
|
||||
|
@ -2798,7 +2798,7 @@ void CMeterWindow::Update(bool nodraw)
|
||||
{
|
||||
++m_UpdateCounter;
|
||||
|
||||
if (!m_Measures.empty())
|
||||
if (!nodraw && !m_Measures.empty())
|
||||
{
|
||||
// Pre-updates
|
||||
if (m_HasNetMeasures)
|
||||
|
@ -91,7 +91,6 @@
|
||||
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
|
||||
<DisableSpecificWarnings>4018;4090;4114;4351;4786;4800;4996</DisableSpecificWarnings>
|
||||
<AdditionalIncludeDirectories>.\sha2;.\taglib;.\taglib\toolkit;.\taglib\mpeg\id3v2\frames;.\taglib\ogg;.\taglib\asf;.\taglib\mp4;.\taglib\ogg\vorbis;.\taglib\ogg\flac;.\taglib\ogg\speex;.\taglib\riff;.\taglib\riff\wav;.\taglib\riff\aiff;.\taglib\flac;.\taglib\mpeg;.\taglib\mpeg\id3v1;.\taglib\mpeg\id3v2;.\taglib\mpc;.\taglib\ape;.\taglib\trueaudio;.\taglib\wavpack;.\SDKs\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<RuntimeTypeInfo>false</RuntimeTypeInfo>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
|
Loading…
Reference in New Issue
Block a user