summaryrefslogtreecommitdiff
path: root/src/core/telemetry_session.cpp
diff options
context:
space:
mode:
authorGravatar Lioncash2018-08-14 18:48:28 -0400
committerGravatar Lioncash2018-08-14 18:57:46 -0400
commit60f476cd8f3aa4cf0c9c0091e53559d7e3d30116 (patch)
tree6581d46de9b751341990935cb604d9e29c1ff6a7 /src/core/telemetry_session.cpp
parentMerge pull request #1055 from lioncash/init (diff)
downloadyuzu-60f476cd8f3aa4cf0c9c0091e53559d7e3d30116.tar.gz
yuzu-60f476cd8f3aa4cf0c9c0091e53559d7e3d30116.tar.xz
yuzu-60f476cd8f3aa4cf0c9c0091e53559d7e3d30116.zip
common/telemetry: Migrate core-independent info gathering to common
Previously core itself was the library containing the code to gather common information (build info, CPU info, and OS info), however all of this isn't core-dependent and can be moved to the common code and use the common interfaces. We can then just call those functions from the core instead. This will allow replacing our CPU detection with Xbyak's which has better detection facilities than ours. It also keeps more architecture-dependent code in common instead of core.
Diffstat (limited to 'src/core/telemetry_session.cpp')
-rw-r--r--src/core/telemetry_session.cpp69
1 files changed, 7 insertions, 62 deletions
diff --git a/src/core/telemetry_session.cpp b/src/core/telemetry_session.cpp
index 69aa7a7be..7e4584fc2 100644
--- a/src/core/telemetry_session.cpp
+++ b/src/core/telemetry_session.cpp
@@ -2,34 +2,16 @@
2// Licensed under GPLv2 or any later version 2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included. 3// Refer to the license.txt file included.
4 4
5#include <cstring>
6
7#include "common/assert.h" 5#include "common/assert.h"
6#include "common/common_types.h"
8#include "common/file_util.h" 7#include "common/file_util.h"
9#include "common/scm_rev.h" 8
10#ifdef ARCHITECTURE_x86_64
11#include "common/x64/cpu_detect.h"
12#endif
13#include "core/core.h" 9#include "core/core.h"
14#include "core/settings.h" 10#include "core/settings.h"
15#include "core/telemetry_session.h" 11#include "core/telemetry_session.h"
16 12
17namespace Core { 13namespace Core {
18 14
19#ifdef ARCHITECTURE_x86_64
20static const char* CpuVendorToStr(Common::CPUVendor vendor) {
21 switch (vendor) {
22 case Common::CPUVendor::INTEL:
23 return "Intel";
24 case Common::CPUVendor::AMD:
25 return "Amd";
26 case Common::CPUVendor::OTHER:
27 return "Other";
28 }
29 UNREACHABLE();
30}
31#endif
32
33static u64 GenerateTelemetryId() { 15static u64 GenerateTelemetryId() {
34 u64 telemetry_id{}; 16 u64 telemetry_id{};
35 return telemetry_id; 17 return telemetry_id;
@@ -112,48 +94,11 @@ TelemetrySession::TelemetrySession() {
112 } 94 }
113 95
114 // Log application information 96 // Log application information
115 const bool is_git_dirty{std::strstr(Common::g_scm_desc, "dirty") != nullptr}; 97 Telemetry::AppendBuildInfo(field_collection);
116 AddField(Telemetry::FieldType::App, "Git_IsDirty", is_git_dirty); 98
117 AddField(Telemetry::FieldType::App, "Git_Branch", Common::g_scm_branch); 99 // Log user system information
118 AddField(Telemetry::FieldType::App, "Git_Revision", Common::g_scm_rev); 100 Telemetry::AppendCPUInfo(field_collection);
119 AddField(Telemetry::FieldType::App, "BuildDate", Common::g_build_date); 101 Telemetry::AppendOSInfo(field_collection);
120 AddField(Telemetry::FieldType::App, "BuildName", Common::g_build_name);
121
122// Log user system information
123#ifdef ARCHITECTURE_x86_64
124 AddField(Telemetry::FieldType::UserSystem, "CPU_Model", Common::GetCPUCaps().cpu_string);
125 AddField(Telemetry::FieldType::UserSystem, "CPU_BrandString",
126 Common::GetCPUCaps().brand_string);
127 AddField(Telemetry::FieldType::UserSystem, "CPU_Vendor",
128 CpuVendorToStr(Common::GetCPUCaps().vendor));
129 AddField(Telemetry::FieldType::UserSystem, "CPU_Extension_x64_AES", Common::GetCPUCaps().aes);
130 AddField(Telemetry::FieldType::UserSystem, "CPU_Extension_x64_AVX", Common::GetCPUCaps().avx);
131 AddField(Telemetry::FieldType::UserSystem, "CPU_Extension_x64_AVX2", Common::GetCPUCaps().avx2);
132 AddField(Telemetry::FieldType::UserSystem, "CPU_Extension_x64_BMI1", Common::GetCPUCaps().bmi1);
133 AddField(Telemetry::FieldType::UserSystem, "CPU_Extension_x64_BMI2", Common::GetCPUCaps().bmi2);
134 AddField(Telemetry::FieldType::UserSystem, "CPU_Extension_x64_FMA", Common::GetCPUCaps().fma);
135 AddField(Telemetry::FieldType::UserSystem, "CPU_Extension_x64_FMA4", Common::GetCPUCaps().fma4);
136 AddField(Telemetry::FieldType::UserSystem, "CPU_Extension_x64_SSE", Common::GetCPUCaps().sse);
137 AddField(Telemetry::FieldType::UserSystem, "CPU_Extension_x64_SSE2", Common::GetCPUCaps().sse2);
138 AddField(Telemetry::FieldType::UserSystem, "CPU_Extension_x64_SSE3", Common::GetCPUCaps().sse3);
139 AddField(Telemetry::FieldType::UserSystem, "CPU_Extension_x64_SSSE3",
140 Common::GetCPUCaps().ssse3);
141 AddField(Telemetry::FieldType::UserSystem, "CPU_Extension_x64_SSE41",
142 Common::GetCPUCaps().sse4_1);
143 AddField(Telemetry::FieldType::UserSystem, "CPU_Extension_x64_SSE42",
144 Common::GetCPUCaps().sse4_2);
145#else
146 AddField(Telemetry::FieldType::UserSystem, "CPU_Model", "Other");
147#endif
148#ifdef __APPLE__
149 AddField(Telemetry::FieldType::UserSystem, "OsPlatform", "Apple");
150#elif defined(_WIN32)
151 AddField(Telemetry::FieldType::UserSystem, "OsPlatform", "Windows");
152#elif defined(__linux__) || defined(linux) || defined(__linux)
153 AddField(Telemetry::FieldType::UserSystem, "OsPlatform", "Linux");
154#else
155 AddField(Telemetry::FieldType::UserSystem, "OsPlatform", "Unknown");
156#endif
157 102
158 // Log user configuration information 103 // Log user configuration information
159 AddField(Telemetry::FieldType::UserConfig, "Core_UseCpuJit", Settings::values.use_cpu_jit); 104 AddField(Telemetry::FieldType::UserConfig, "Core_UseCpuJit", Settings::values.use_cpu_jit);