mirror of
https://github.com/xmrig/xmrig.git
synced 2024-12-23 12:09:22 +00:00
Added basic system reader.
This commit is contained in:
parent
24c290963a
commit
dea5be0a57
4 changed files with 13 additions and 4 deletions
|
@ -142,6 +142,8 @@ static void print_memory()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const bool vm = Cpu::info()->isVM();
|
||||||
|
|
||||||
for (const auto &memory : reader.memory()) {
|
for (const auto &memory : reader.memory()) {
|
||||||
if (!memory.isValid()) {
|
if (!memory.isValid()) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -151,12 +153,14 @@ static void print_memory()
|
||||||
Log::print(WHITE_BOLD(" %-13s") "%s: " CYAN_BOLD("%" PRIu64) CYAN(" GB ") WHITE_BOLD("%s @ %" PRIu64 " MHz ") BLACK_BOLD("%s"),
|
Log::print(WHITE_BOLD(" %-13s") "%s: " CYAN_BOLD("%" PRIu64) CYAN(" GB ") WHITE_BOLD("%s @ %" PRIu64 " MHz ") BLACK_BOLD("%s"),
|
||||||
"", memory.slot().data(), memory.size() / oneGiB, memory.type(), memory.speed() / 1000000ULL, memory.product().data());
|
"", memory.slot().data(), memory.size() / oneGiB, memory.type(), memory.speed() / 1000000ULL, memory.product().data());
|
||||||
}
|
}
|
||||||
else if (!Cpu::info()->isVM()) {
|
else if (!vm) {
|
||||||
Log::print(WHITE_BOLD(" %-13s") "%s: " BLACK_BOLD("<empty>"), "", memory.slot().data());
|
Log::print(WHITE_BOLD(" %-13s") "%s: " BLACK_BOLD("<empty>"), "", memory.slot().data());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (reader.board().isValid()) {
|
const auto &board = vm ? reader.system() : reader.board();
|
||||||
|
|
||||||
|
if (board.isValid()) {
|
||||||
Log::print(GREEN_BOLD(" * ") WHITE_BOLD("%-13s") WHITE_BOLD("%s") " - " WHITE_BOLD("%s"), "MOTHERBOARD", reader.board().vendor().data(), reader.board().product().data());
|
Log::print(GREEN_BOLD(" * ") WHITE_BOLD("%-13s") WHITE_BOLD("%s") " - " WHITE_BOLD("%s"), "MOTHERBOARD", reader.board().vendor().data(), reader.board().product().data());
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
|
|
|
@ -23,7 +23,6 @@
|
||||||
#include "hw/dmi/DmiTools.h"
|
#include "hw/dmi/DmiTools.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void xmrig::DmiBoard::decode(dmi_header *h)
|
void xmrig::DmiBoard::decode(dmi_header *h)
|
||||||
{
|
{
|
||||||
if (h->length < 0x08) {
|
if (h->length < 0x08) {
|
||||||
|
|
|
@ -82,6 +82,10 @@ bool xmrig::DmiReader::decode(uint8_t *buf)
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (h.type) {
|
switch (h.type) {
|
||||||
|
case 1:
|
||||||
|
m_system.decode(&h);
|
||||||
|
break;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
m_board.decode(&h);
|
m_board.decode(&h);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -38,6 +38,7 @@ public:
|
||||||
DmiReader() = default;
|
DmiReader() = default;
|
||||||
|
|
||||||
inline const DmiBoard &board() const { return m_board; }
|
inline const DmiBoard &board() const { return m_board; }
|
||||||
|
inline const DmiBoard &system() const { return m_system; }
|
||||||
inline const std::vector<DmiMemory> &memory() const { return m_memory; }
|
inline const std::vector<DmiMemory> &memory() const { return m_memory; }
|
||||||
inline uint32_t size() const { return m_size; }
|
inline uint32_t size() const { return m_size; }
|
||||||
inline uint32_t version() const { return m_version; }
|
inline uint32_t version() const { return m_version; }
|
||||||
|
@ -51,9 +52,10 @@ private:
|
||||||
bool decode(uint8_t *buf);
|
bool decode(uint8_t *buf);
|
||||||
|
|
||||||
DmiBoard m_board;
|
DmiBoard m_board;
|
||||||
|
DmiBoard m_system;
|
||||||
|
std::vector<DmiMemory> m_memory;
|
||||||
uint32_t m_size = 0;
|
uint32_t m_size = 0;
|
||||||
uint32_t m_version = 0;
|
uint32_t m_version = 0;
|
||||||
std::vector<DmiMemory> m_memory;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue