[PVR][Estuary] Timer settings dialog: Show client name in timer type selection dialog...
[xbmc.git] / xbmc / utils / CPUInfo.cpp
blob9f43c1025ab81e13205017be6c6db36ec993dbc3
1 /*
2 * Copyright (C) 2005-2018 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
7 */
9 #include "CPUInfo.h"
11 #include "utils/StringUtils.h"
13 bool CCPUInfo::HasCoreId(int coreId) const
15 for (const auto& core : m_cores)
17 if (core.m_id == coreId)
18 return true;
21 return false;
24 const CoreInfo CCPUInfo::GetCoreInfo(int coreId)
26 CoreInfo coreInfo;
28 for (auto& core : m_cores)
30 if (core.m_id == coreId)
31 coreInfo = core;
34 return coreInfo;
37 std::string CCPUInfo::GetCoresUsageString()
39 std::string strCores;
41 if (SupportsCPUUsage())
43 GetUsedPercentage(); // must call it to recalculate pct values
45 if (!m_cores.empty())
47 for (const auto& core : m_cores)
49 if (!strCores.empty())
50 strCores += ' ';
51 if (core.m_usagePercent < 10.0)
52 strCores += StringUtils::Format("#{}: {:1.1f}%", core.m_id, core.m_usagePercent);
53 else
54 strCores += StringUtils::Format("#{}: {:3.0f}%", core.m_id, core.m_usagePercent);
57 else
59 strCores += StringUtils::Format("{:3.0f}%", static_cast<double>(m_lastUsedPercentage));
63 return strCores;