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.
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
)
24 const CoreInfo
CCPUInfo::GetCoreInfo(int coreId
)
28 for (auto& core
: m_cores
)
30 if (core
.m_id
== coreId
)
37 std::string
CCPUInfo::GetCoresUsageString()
41 if (SupportsCPUUsage())
43 GetUsedPercentage(); // must call it to recalculate pct values
47 for (const auto& core
: m_cores
)
49 if (!strCores
.empty())
51 if (core
.m_usagePercent
< 10.0)
52 strCores
+= StringUtils::Format("#{}: {:1.1f}%", core
.m_id
, core
.m_usagePercent
);
54 strCores
+= StringUtils::Format("#{}: {:3.0f}%", core
.m_id
, core
.m_usagePercent
);
59 strCores
+= StringUtils::Format("{:3.0f}%", static_cast<double>(m_lastUsedPercentage
));