ICpuInfo refactoring.

This commit is contained in:
XMRig 2020-05-08 22:25:13 +07:00
parent 39ae24b138
commit 628506e266
No known key found for this signature in database
GPG key ID: 446A53638BE94409
10 changed files with 110 additions and 206 deletions

View file

@ -51,6 +51,19 @@ public:
MSR_MOD_MAX
};
enum Flag : uint32_t {
FLAG_AES,
FLAG_AVX2,
FLAG_AVX512F,
FLAG_BMI2,
FLAG_OSXSAVE,
FLAG_PDPE1GB,
FLAG_SSE2,
FLAG_SSSE3,
FLAG_XOP,
FLAG_MAX
};
virtual ~ICpuInfo() = default;
# if defined(__x86_64__) || defined(_M_AMD64) || defined (__arm64__) || defined (__aarch64__)
@ -60,6 +73,7 @@ public:
# endif
virtual Assembly::Id assembly() const = 0;
virtual bool has(Flag feature) const = 0;
virtual bool hasAES() const = 0;
virtual bool hasAVX2() const = 0;
virtual bool hasBMI2() const = 0;
@ -68,6 +82,7 @@ public:
virtual const char *brand() const = 0;
virtual CpuThreads threads(const Algorithm &algorithm, uint32_t limit) const = 0;
virtual MsrMod msrMod() const = 0;
virtual rapidjson::Value toJSON(rapidjson::Document &doc) const = 0;
virtual size_t cores() const = 0;
virtual size_t L2() const = 0;
virtual size_t L3() const = 0;