Added ARM CPU name detection based on lscpu code.

This commit is contained in:
XMRig 2020-08-16 15:47:29 +07:00
parent 43afa437e4
commit cac48cdd27
No known key found for this signature in database
GPG key ID: 446A53638BE94409
3 changed files with 338 additions and 6 deletions

View file

@ -1,10 +1,4 @@
/* XMRig
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
* Copyright 2017-2019 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2020 XMRig <support@xmrig.com>
*
@ -22,6 +16,10 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "base/tools/String.h"
#include <array>
#include <cstring>
#include <thread>
@ -37,6 +35,15 @@
#include "3rdparty/rapidjson/document.h"
#ifdef XMRIG_OS_UNIX
namespace xmrig {
extern String cpu_name_arm();
} // namespace xmrig
#endif
xmrig::BasicCpuInfo::BasicCpuInfo() :
m_threads(std::thread::hardware_concurrency())
{
@ -53,6 +60,13 @@ xmrig::BasicCpuInfo::BasicCpuInfo() :
m_flags.set(FLAG_AES, true);
# endif
# endif
# ifdef XMRIG_OS_UNIX
auto name = cpu_name_arm();
if (!name.isNull()) {
strncpy(m_brand, name, sizeof(m_brand) - 1);
}
# endif
}