summaryrefslogtreecommitdiff
path: root/src/utils
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/cpu.cpp18
-rw-r--r--src/utils/cpu.h2
2 files changed, 17 insertions, 3 deletions
diff --git a/src/utils/cpu.cpp b/src/utils/cpu.cpp
index e57956c06..91f49f5a7 100644
--- a/src/utils/cpu.cpp
+++ b/src/utils/cpu.cpp
@@ -32,7 +32,10 @@
#include "debug.h"
-int mCpuFlags = 0;
+namespace
+{
+ uint32_t mCpuFlags;
+} // namespace
void Cpu::detect()
{
@@ -99,16 +102,20 @@ void Cpu::detect()
}
}
fclose(file);
- logger->log("cpu features was not detected");
+ if (logger)
+ logger->log("cpu features was not detected");
#else // OTHER
- logger->log("cpu features not supported");
+ if (logger)
+ logger->log("cpu features not supported");
#endif // (defined(__amd64__) || defined(__i386__)) && defined(__GNUC__)
// && (GCC_VERSION >= 40800) && !defined(ANDROID)
}
void Cpu::printFlags()
{
+ if (!logger)
+ return;
std::string str("CPU features:");
if (mCpuFlags & FEATURE_MMX)
str.append(" mmx");
@@ -128,3 +135,8 @@ void Cpu::printFlags()
str.append(" avx2");
logger->log(str);
}
+
+uint32_t Cpu::getFlags()
+{
+ return mCpuFlags;
+}
diff --git a/src/utils/cpu.h b/src/utils/cpu.h
index 2780795bd..8be6ccbc3 100644
--- a/src/utils/cpu.h
+++ b/src/utils/cpu.h
@@ -41,6 +41,8 @@ namespace Cpu
void detect();
void printFlags();
+
+ uint32_t getFlags();
} // namespace Cpu
#endif // UTILS_CPU_H