aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xbmc/utils/CPUInfo.cpp34
-rw-r--r--xbmc/windows/GUIWindowDebugInfo.cpp18
2 files changed, 32 insertions, 20 deletions
diff --git a/xbmc/utils/CPUInfo.cpp b/xbmc/utils/CPUInfo.cpp
index 054c9667b0..a2a775fd94 100644
--- a/xbmc/utils/CPUInfo.cpp
+++ b/xbmc/utils/CPUInfo.cpp
@@ -108,8 +108,8 @@ CCPUInfo::CCPUInfo(void)
m_fProcStat = m_fProcTemperature = m_fCPUFreq = NULL;
m_cpuInfoForFreq = false;
#elif defined(TARGET_WINDOWS)
- m_cpuQueryFreq = NULL;
- m_cpuQueryLoad = NULL;
+ m_cpuQueryFreq = nullptr;
+ m_cpuQueryLoad = nullptr;
#endif
m_lastUsedPercentage = 0;
m_cpuFeatures = 0;
@@ -159,7 +159,7 @@ CCPUInfo::CCPUInfo(void)
std::vector<CoreInfo> cpuCores;
wchar_t subKeyName[200]; // more than enough
DWORD subKeyNameLen = sizeof(subKeyName) / sizeof(wchar_t);
- while (RegEnumKeyExW(hKeyCpuRoot, num++, subKeyName, &subKeyNameLen, NULL, NULL, NULL, NULL) == ERROR_SUCCESS)
+ while (RegEnumKeyExW(hKeyCpuRoot, num++, subKeyName, &subKeyNameLen, nullptr, nullptr, nullptr, nullptr) == ERROR_SUCCESS)
{
HKEY hCpuKey;
if (RegOpenKeyExW(hKeyCpuRoot, subKeyName, 0, KEY_QUERY_VALUE, &hCpuKey) == ERROR_SUCCESS)
@@ -170,7 +170,7 @@ CCPUInfo::CCPUInfo(void)
wchar_t buf[300]; // more than enough
DWORD bufSize = sizeof(buf);
DWORD valType;
- if (RegQueryValueExW(hCpuKey, L"ProcessorNameString", NULL, &valType, (LPBYTE)buf, &bufSize) == ERROR_SUCCESS &&
+ if (RegQueryValueExW(hCpuKey, L"ProcessorNameString", nullptr, &valType, LPBYTE(buf), &bufSize) == ERROR_SUCCESS &&
valType == REG_SZ)
{
g_charsetConverter.wToUTF8(std::wstring(buf, bufSize / sizeof(wchar_t)), cpuCore.m_strModel);
@@ -179,7 +179,7 @@ CCPUInfo::CCPUInfo(void)
StringUtils::Trim(cpuCore.m_strModel);
}
bufSize = sizeof(buf);
- if (RegQueryValueExW(hCpuKey, L"VendorIdentifier", NULL, &valType, (LPBYTE)buf, &bufSize) == ERROR_SUCCESS &&
+ if (RegQueryValueExW(hCpuKey, L"VendorIdentifier", nullptr, &valType, LPBYTE(buf), &bufSize) == ERROR_SUCCESS &&
valType == REG_SZ)
{
g_charsetConverter.wToUTF8(std::wstring(buf, bufSize / sizeof(wchar_t)), cpuCore.m_strVendor);
@@ -187,7 +187,7 @@ CCPUInfo::CCPUInfo(void)
}
DWORD mhzVal;
bufSize = sizeof(mhzVal);
- if (RegQueryValueExW(hCpuKey, L"~MHz", NULL, &valType, (LPBYTE)&mhzVal, &bufSize) == ERROR_SUCCESS &&
+ if (RegQueryValueExW(hCpuKey, L"~MHz", nullptr, &valType, LPBYTE(&mhzVal), &bufSize) == ERROR_SUCCESS &&
valType == REG_DWORD)
cpuCore.m_fSpeed = double(mhzVal);
@@ -214,24 +214,24 @@ CCPUInfo::CCPUInfo(void)
GetNativeSystemInfo(&siSysInfo);
m_cpuCount = siSysInfo.dwNumberOfProcessors;
- if (PdhOpenQueryW(NULL, 0, &m_cpuQueryFreq) == ERROR_SUCCESS)
+ if (PdhOpenQueryW(nullptr, 0, &m_cpuQueryFreq) == ERROR_SUCCESS)
{
if (PdhAddEnglishCounterW(m_cpuQueryFreq, L"\\Processor Information(0,0)\\Processor Frequency", 0, &m_cpuFreqCounter) != ERROR_SUCCESS)
- m_cpuFreqCounter = NULL;
+ m_cpuFreqCounter = nullptr;
}
else
- m_cpuQueryFreq = NULL;
+ m_cpuQueryFreq = nullptr;
- if (PdhOpenQueryW(NULL, 0, &m_cpuQueryLoad) == ERROR_SUCCESS)
+ if (PdhOpenQueryW(nullptr, 0, &m_cpuQueryLoad) == ERROR_SUCCESS)
{
for (size_t i = 0; i < m_cores.size(); i++)
{
if (PdhAddEnglishCounterW(m_cpuQueryLoad, StringUtils::Format(L"\\Processor(%d)\\%% Idle Time", int(i)).c_str(), 0, &m_cores[i].m_coreCounter) != ERROR_SUCCESS)
- m_cores[i].m_coreCounter = NULL;
+ m_cores[i].m_coreCounter = nullptr;
}
}
else
- m_cpuQueryLoad = NULL;
+ m_cpuQueryLoad = nullptr;
#elif defined(TARGET_FREEBSD)
size_t len;
int i;
@@ -417,6 +417,14 @@ CCPUInfo::CCPUInfo(void)
#if defined(TARGET_ANDROID)
if (CAndroidFeatures::GetCPUCount() > m_cpuCount)
{
+ for (int i = m_cpuCount; i < CAndroidFeatures::GetCPUCount(); i++)
+ {
+ // Copy info from cpu 0
+ CoreInfo core(m_cores[0]);
+ core.m_id = i;
+ m_cores[core.m_id] = core;
+ }
+
m_cpuCount = CAndroidFeatures::GetCPUCount();
}
#endif
@@ -499,7 +507,7 @@ int CCPUInfo::getUsedPercentage()
if(userTicks + niceTicks + systemTicks + idleTicks + ioTicks == 0)
return m_lastUsedPercentage;
- int result = (int) (double(userTicks + niceTicks + systemTicks) * 100.0 / double(userTicks + niceTicks + systemTicks + idleTicks + ioTicks) + 0.5);
+ int result = static_cast<int>(double(userTicks + niceTicks + systemTicks) * 100.0 / double(userTicks + niceTicks + systemTicks + idleTicks + ioTicks) + 0.5);
m_userTicks += userTicks;
m_niceTicks += niceTicks;
diff --git a/xbmc/windows/GUIWindowDebugInfo.cpp b/xbmc/windows/GUIWindowDebugInfo.cpp
index 17407008b7..43f8a93180 100644
--- a/xbmc/windows/GUIWindowDebugInfo.cpp
+++ b/xbmc/windows/GUIWindowDebugInfo.cpp
@@ -39,7 +39,7 @@ CGUIWindowDebugInfo::CGUIWindowDebugInfo(void)
: CGUIDialog(WINDOW_DEBUG_INFO, "", DialogModalityType::MODELESS)
{
m_needsScaling = false;
- m_layout = NULL;
+ m_layout = nullptr;
m_renderOrder = RENDER_ORDER_WINDOW_DEBUG;
}
@@ -60,7 +60,7 @@ bool CGUIWindowDebugInfo::OnMessage(CGUIMessage &message)
if (message.GetMessage() == GUI_MSG_WINDOW_DEINIT)
{
delete m_layout;
- m_layout = NULL;
+ m_layout = nullptr;
}
return CGUIDialog::OnMessage(message);
}
@@ -73,8 +73,8 @@ void CGUIWindowDebugInfo::Process(unsigned int currentTime, CDirtyRegionList &di
static int yShift = 20;
static int xShift = 40;
- static unsigned int lastShift = time(NULL);
- time_t now = time(NULL);
+ static unsigned int lastShift = time(nullptr);
+ time_t now = time(nullptr);
if (now - lastShift > 10)
{
yShift *= -1;
@@ -111,8 +111,12 @@ void CGUIWindowDebugInfo::Process(unsigned int currentTime, CDirtyRegionList &di
double dCPU = m_resourceCounter.GetCPUUsage();
std::string ucAppName = lcAppName;
StringUtils::ToUpper(ucAppName);
- info = StringUtils::Format("LOG: %s%s.log\nMEM: %" PRIu64"/%" PRIu64" KB - FPS: %2.1f fps\nCPU: %s (CPU-%s %4.2f%%%s)", CSpecialProtocol::TranslatePath("special://logpath").c_str(), lcAppName.c_str(),
- stat.ullAvailPhys/1024, stat.ullTotalPhys/1024, g_infoManager.GetFPS(), strCores.c_str(), ucAppName.c_str(), dCPU, profiling.c_str());
+ info = StringUtils::Format("LOG: %s%s.log\n"
+ "MEM: %" PRIu64"/%" PRIu64" KB - FPS: %2.1f fps\n"
+ "CPU: %s (CPU-%s %4.2f%%%s)",
+ CSpecialProtocol::TranslatePath("special://logpath").c_str(), lcAppName.c_str(),
+ stat.ullAvailPhys/1024, stat.ullTotalPhys/1024, g_infoManager.GetFPS(),
+ strCores.c_str(), ucAppName.c_str(), dCPU, profiling.c_str());
#endif
}
@@ -140,7 +144,7 @@ void CGUIWindowDebugInfo::Process(unsigned int currentTime, CDirtyRegionList &di
point.y *= g_graphicsContext.GetGUIScaleY();
g_graphicsContext.SetRenderingResolution(g_graphicsContext.GetResInfo(), false);
}
- info += StringUtils::Format("Mouse: (%d,%d) ", (int)point.x, (int)point.y);
+ info += StringUtils::Format("Mouse: (%d,%d) ", static_cast<int>(point.x), static_cast<int>(point.y));
if (window)
{
CGUIControl *control = window->GetFocusedControl();