2018-09-23 17:51:56 +03:00
|
|
|
/* 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>
|
2019-02-03 14:44:23 +07:00
|
|
|
* Copyright 2017-2019 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
2020-02-01 20:24:00 +07:00
|
|
|
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
|
|
|
|
|
* Copyright 2016-2020 XMRig <support@xmrig.com>
|
2018-09-23 17:51:56 +03:00
|
|
|
*
|
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
* (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef XMRIG_BASICCPUINFO_H
|
|
|
|
|
#define XMRIG_BASICCPUINFO_H
|
|
|
|
|
|
|
|
|
|
|
2019-06-29 09:51:23 +07:00
|
|
|
#include "backend/cpu/interfaces/ICpuInfo.h"
|
2018-09-23 17:51:56 +03:00
|
|
|
|
|
|
|
|
|
2020-05-08 22:25:13 +07:00
|
|
|
#include <bitset>
|
|
|
|
|
|
|
|
|
|
|
2018-09-23 17:51:56 +03:00
|
|
|
namespace xmrig {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class BasicCpuInfo : public ICpuInfo
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
BasicCpuInfo();
|
|
|
|
|
|
|
|
|
|
protected:
|
2019-07-23 14:19:41 +07:00
|
|
|
const char *backend() const override;
|
2019-09-28 02:02:20 +07:00
|
|
|
CpuThreads threads(const Algorithm &algorithm, uint32_t limit) const override;
|
2020-05-08 22:25:13 +07:00
|
|
|
rapidjson::Value toJSON(rapidjson::Document &doc) const override;
|
2018-09-23 17:51:56 +03:00
|
|
|
|
2019-06-28 13:08:08 +07:00
|
|
|
inline Assembly::Id assembly() const override { return m_assembly; }
|
2020-05-08 22:25:13 +07:00
|
|
|
inline bool has(Flag flag) const override { return m_flags.test(flag); }
|
|
|
|
|
inline bool hasAES() const override { return has(FLAG_AES); }
|
|
|
|
|
inline bool hasAVX2() const override { return has(FLAG_AVX2); }
|
|
|
|
|
inline bool hasBMI2() const override { return has(FLAG_BMI2); }
|
|
|
|
|
inline bool hasOneGbPages() const override { return has(FLAG_PDPE1GB); }
|
2020-07-13 17:23:18 +02:00
|
|
|
inline bool hasCatL3() const override { return has(FLAG_CAT_L3); }
|
2020-12-06 17:34:01 +01:00
|
|
|
inline bool isVM() const override { return has(FLAG_VM); }
|
2018-09-23 17:51:56 +03:00
|
|
|
inline const char *brand() const override { return m_brand; }
|
2019-12-17 02:27:07 +07:00
|
|
|
inline MsrMod msrMod() const override { return m_msrMod; }
|
2019-07-02 22:56:28 +07:00
|
|
|
inline size_t cores() const override { return 0; }
|
|
|
|
|
inline size_t L2() const override { return 0; }
|
|
|
|
|
inline size_t L3() const override { return 0; }
|
|
|
|
|
inline size_t nodes() const override { return 0; }
|
2019-07-23 00:40:24 +07:00
|
|
|
inline size_t packages() const override { return 1; }
|
2019-07-02 22:56:28 +07:00
|
|
|
inline size_t threads() const override { return m_threads; }
|
2019-12-10 12:49:42 +07:00
|
|
|
inline Vendor vendor() const override { return m_vendor; }
|
2020-09-18 20:51:25 +02:00
|
|
|
inline bool jccErratum() const override { return m_jccErratum; }
|
2018-09-23 17:51:56 +03:00
|
|
|
|
2019-07-23 00:40:24 +07:00
|
|
|
protected:
|
2019-12-10 12:49:42 +07:00
|
|
|
char m_brand[64 + 6]{};
|
2019-07-23 00:40:24 +07:00
|
|
|
size_t m_threads;
|
2020-05-08 22:25:13 +07:00
|
|
|
Vendor m_vendor = VENDOR_UNKNOWN;
|
2020-09-18 20:51:25 +02:00
|
|
|
bool m_jccErratum = false;
|
2019-07-23 00:40:24 +07:00
|
|
|
|
2018-09-23 17:51:56 +03:00
|
|
|
private:
|
2020-11-10 12:15:52 +01:00
|
|
|
uint32_t m_procInfo = 0;
|
|
|
|
|
uint32_t m_family = 0;
|
|
|
|
|
uint32_t m_model = 0;
|
|
|
|
|
uint32_t m_stepping = 0;
|
2019-12-10 12:49:42 +07:00
|
|
|
Assembly m_assembly = Assembly::NONE;
|
2019-12-17 02:27:07 +07:00
|
|
|
MsrMod m_msrMod = MSR_MOD_NONE;
|
2020-05-09 01:13:46 +07:00
|
|
|
std::bitset<FLAG_MAX> m_flags;
|
2018-09-23 17:51:56 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} /* namespace xmrig */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif /* XMRIG_BASICCPUINFO_H */
|