diff options
| author | 2017-08-03 18:37:03 -0600 | |
|---|---|---|
| committer | 2017-08-03 18:37:03 -0600 | |
| commit | 0dc285dcfd1085c7725b7db474266371226de672 (patch) | |
| tree | 1246eca78bc61a5122c12804f3bc70b93245118d /src | |
| parent | Merge pull request #2850 from j-selby/fix_invalid_paths (diff) | |
| parent | telemetry: Add field for OsPlatform. (diff) | |
| download | yuzu-0dc285dcfd1085c7725b7db474266371226de672.tar.gz yuzu-0dc285dcfd1085c7725b7db474266371226de672.tar.xz yuzu-0dc285dcfd1085c7725b7db474266371226de672.zip | |
Merge pull request #2855 from bunnei/telemetry-additional-fields
Telemetry: Add several more useful fields
Diffstat (limited to '')
| -rw-r--r-- | src/common/scm_rev.cpp.in | 2 | ||||
| -rw-r--r-- | src/common/scm_rev.h | 1 | ||||
| -rw-r--r-- | src/core/core.h | 9 | ||||
| -rw-r--r-- | src/core/hle/service/apt/apt.cpp | 4 | ||||
| -rw-r--r-- | src/core/loader/loader.h | 9 | ||||
| -rw-r--r-- | src/core/loader/ncch.cpp | 20 | ||||
| -rw-r--r-- | src/core/loader/ncch.h | 14 | ||||
| -rw-r--r-- | src/core/telemetry_session.cpp | 17 |
8 files changed, 60 insertions, 16 deletions
diff --git a/src/common/scm_rev.cpp.in b/src/common/scm_rev.cpp.in index 0080db5d5..4083095d5 100644 --- a/src/common/scm_rev.cpp.in +++ b/src/common/scm_rev.cpp.in | |||
| @@ -8,6 +8,7 @@ | |||
| 8 | #define GIT_BRANCH "@GIT_BRANCH@" | 8 | #define GIT_BRANCH "@GIT_BRANCH@" |
| 9 | #define GIT_DESC "@GIT_DESC@" | 9 | #define GIT_DESC "@GIT_DESC@" |
| 10 | #define BUILD_NAME "@REPO_NAME@" | 10 | #define BUILD_NAME "@REPO_NAME@" |
| 11 | #define BUILD_DATE "@BUILD_DATE@" | ||
| 11 | 12 | ||
| 12 | namespace Common { | 13 | namespace Common { |
| 13 | 14 | ||
| @@ -15,6 +16,7 @@ const char g_scm_rev[] = GIT_REV; | |||
| 15 | const char g_scm_branch[] = GIT_BRANCH; | 16 | const char g_scm_branch[] = GIT_BRANCH; |
| 16 | const char g_scm_desc[] = GIT_DESC; | 17 | const char g_scm_desc[] = GIT_DESC; |
| 17 | const char g_build_name[] = BUILD_NAME; | 18 | const char g_build_name[] = BUILD_NAME; |
| 19 | const char g_build_date[] = BUILD_DATE; | ||
| 18 | 20 | ||
| 19 | } // namespace | 21 | } // namespace |
| 20 | 22 | ||
diff --git a/src/common/scm_rev.h b/src/common/scm_rev.h index e22389803..18aaa1735 100644 --- a/src/common/scm_rev.h +++ b/src/common/scm_rev.h | |||
| @@ -10,5 +10,6 @@ extern const char g_scm_rev[]; | |||
| 10 | extern const char g_scm_branch[]; | 10 | extern const char g_scm_branch[]; |
| 11 | extern const char g_scm_desc[]; | 11 | extern const char g_scm_desc[]; |
| 12 | extern const char g_build_name[]; | 12 | extern const char g_build_name[]; |
| 13 | extern const char g_build_date[]; | ||
| 13 | 14 | ||
| 14 | } // namespace | 15 | } // namespace |
diff --git a/src/core/core.h b/src/core/core.h index 4e3b6b409..9805cc694 100644 --- a/src/core/core.h +++ b/src/core/core.h | |||
| @@ -7,6 +7,7 @@ | |||
| 7 | #include <memory> | 7 | #include <memory> |
| 8 | #include <string> | 8 | #include <string> |
| 9 | #include "common/common_types.h" | 9 | #include "common/common_types.h" |
| 10 | #include "core/loader/loader.h" | ||
| 10 | #include "core/memory.h" | 11 | #include "core/memory.h" |
| 11 | #include "core/perf_stats.h" | 12 | #include "core/perf_stats.h" |
| 12 | #include "core/telemetry_session.h" | 13 | #include "core/telemetry_session.h" |
| @@ -14,10 +15,6 @@ | |||
| 14 | class EmuWindow; | 15 | class EmuWindow; |
| 15 | class ARM_Interface; | 16 | class ARM_Interface; |
| 16 | 17 | ||
| 17 | namespace Loader { | ||
| 18 | class AppLoader; | ||
| 19 | } | ||
| 20 | |||
| 21 | namespace Core { | 18 | namespace Core { |
| 22 | 19 | ||
| 23 | class System { | 20 | class System { |
| @@ -119,6 +116,10 @@ public: | |||
| 119 | return status_details; | 116 | return status_details; |
| 120 | } | 117 | } |
| 121 | 118 | ||
| 119 | Loader::AppLoader& GetAppLoader() const { | ||
| 120 | return *app_loader; | ||
| 121 | } | ||
| 122 | |||
| 122 | private: | 123 | private: |
| 123 | /** | 124 | /** |
| 124 | * Initialize the emulated system. | 125 | * Initialize the emulated system. |
diff --git a/src/core/hle/service/apt/apt.cpp b/src/core/hle/service/apt/apt.cpp index 4e6b7b6f5..0109fa2b2 100644 --- a/src/core/hle/service/apt/apt.cpp +++ b/src/core/hle/service/apt/apt.cpp | |||
| @@ -75,6 +75,10 @@ void Initialize(Service::Interface* self) { | |||
| 75 | void GetSharedFont(Service::Interface* self) { | 75 | void GetSharedFont(Service::Interface* self) { |
| 76 | IPC::RequestParser rp(Kernel::GetCommandBuffer(), 0x44, 0, 0); // 0x00440000 | 76 | IPC::RequestParser rp(Kernel::GetCommandBuffer(), 0x44, 0, 0); // 0x00440000 |
| 77 | IPC::RequestBuilder rb = rp.MakeBuilder(2, 2); | 77 | IPC::RequestBuilder rb = rp.MakeBuilder(2, 2); |
| 78 | |||
| 79 | // Log in telemetry if the game uses the shared font | ||
| 80 | Core::Telemetry().AddField(Telemetry::FieldType::Session, "RequiresSharedFont", true); | ||
| 81 | |||
| 78 | if (!shared_font_loaded) { | 82 | if (!shared_font_loaded) { |
| 79 | LOG_ERROR(Service_APT, "shared font file missing - go dump it from your 3ds"); | 83 | LOG_ERROR(Service_APT, "shared font file missing - go dump it from your 3ds"); |
| 80 | rb.Push<u32>(-1); // TODO: Find the right error code | 84 | rb.Push<u32>(-1); // TODO: Find the right error code |
diff --git a/src/core/loader/loader.h b/src/core/loader/loader.h index 48bbf687d..e731888a2 100644 --- a/src/core/loader/loader.h +++ b/src/core/loader/loader.h | |||
| @@ -166,6 +166,15 @@ public: | |||
| 166 | return ResultStatus::ErrorNotImplemented; | 166 | return ResultStatus::ErrorNotImplemented; |
| 167 | } | 167 | } |
| 168 | 168 | ||
| 169 | /** | ||
| 170 | * Get the title of the application | ||
| 171 | * @param title Reference to store the application title into | ||
| 172 | * @return ResultStatus result of function | ||
| 173 | */ | ||
| 174 | virtual ResultStatus ReadTitle(std::string& title) { | ||
| 175 | return ResultStatus::ErrorNotImplemented; | ||
| 176 | } | ||
| 177 | |||
| 169 | protected: | 178 | protected: |
| 170 | FileUtil::IOFile file; | 179 | FileUtil::IOFile file; |
| 171 | bool is_loaded = false; | 180 | bool is_loaded = false; |
diff --git a/src/core/loader/ncch.cpp b/src/core/loader/ncch.cpp index fc4d14a59..c007069a9 100644 --- a/src/core/loader/ncch.cpp +++ b/src/core/loader/ncch.cpp | |||
| @@ -4,7 +4,9 @@ | |||
| 4 | 4 | ||
| 5 | #include <algorithm> | 5 | #include <algorithm> |
| 6 | #include <cinttypes> | 6 | #include <cinttypes> |
| 7 | #include <codecvt> | ||
| 7 | #include <cstring> | 8 | #include <cstring> |
| 9 | #include <locale> | ||
| 8 | #include <memory> | 10 | #include <memory> |
| 9 | #include "common/logging/log.h" | 11 | #include "common/logging/log.h" |
| 10 | #include "common/string_util.h" | 12 | #include "common/string_util.h" |
| @@ -420,4 +422,22 @@ ResultStatus AppLoader_NCCH::ReadRomFS(std::shared_ptr<FileUtil::IOFile>& romfs_ | |||
| 420 | return ResultStatus::ErrorNotUsed; | 422 | return ResultStatus::ErrorNotUsed; |
| 421 | } | 423 | } |
| 422 | 424 | ||
| 425 | ResultStatus AppLoader_NCCH::ReadTitle(std::string& title) { | ||
| 426 | std::vector<u8> data; | ||
| 427 | Loader::SMDH smdh; | ||
| 428 | ReadIcon(data); | ||
| 429 | |||
| 430 | if (!Loader::IsValidSMDH(data)) { | ||
| 431 | return ResultStatus::ErrorInvalidFormat; | ||
| 432 | } | ||
| 433 | |||
| 434 | memcpy(&smdh, data.data(), sizeof(Loader::SMDH)); | ||
| 435 | |||
| 436 | const auto& short_title = smdh.GetShortTitle(SMDH::TitleLanguage::English); | ||
| 437 | auto title_end = std::find(short_title.begin(), short_title.end(), u'\0'); | ||
| 438 | title = Common::UTF16ToUTF8(std::u16string{short_title.begin(), title_end}); | ||
| 439 | |||
| 440 | return ResultStatus::Success; | ||
| 441 | } | ||
| 442 | |||
| 423 | } // namespace Loader | 443 | } // namespace Loader |
diff --git a/src/core/loader/ncch.h b/src/core/loader/ncch.h index 0ebd47fd5..e40cef764 100644 --- a/src/core/loader/ncch.h +++ b/src/core/loader/ncch.h | |||
| @@ -191,23 +191,13 @@ public: | |||
| 191 | 191 | ||
| 192 | ResultStatus ReadLogo(std::vector<u8>& buffer) override; | 192 | ResultStatus ReadLogo(std::vector<u8>& buffer) override; |
| 193 | 193 | ||
| 194 | /** | ||
| 195 | * Get the program id of the application | ||
| 196 | * @param out_program_id Reference to store program id into | ||
| 197 | * @return ResultStatus result of function | ||
| 198 | */ | ||
| 199 | ResultStatus ReadProgramId(u64& out_program_id) override; | 194 | ResultStatus ReadProgramId(u64& out_program_id) override; |
| 200 | 195 | ||
| 201 | /** | ||
| 202 | * Get the RomFS of the application | ||
| 203 | * @param romfs_file Reference to buffer to store data | ||
| 204 | * @param offset Offset in the file to the RomFS | ||
| 205 | * @param size Size of the RomFS in bytes | ||
| 206 | * @return ResultStatus result of function | ||
| 207 | */ | ||
| 208 | ResultStatus ReadRomFS(std::shared_ptr<FileUtil::IOFile>& romfs_file, u64& offset, | 196 | ResultStatus ReadRomFS(std::shared_ptr<FileUtil::IOFile>& romfs_file, u64& offset, |
| 209 | u64& size) override; | 197 | u64& size) override; |
| 210 | 198 | ||
| 199 | ResultStatus ReadTitle(std::string& title) override; | ||
| 200 | |||
| 211 | private: | 201 | private: |
| 212 | /** | 202 | /** |
| 213 | * Reads an application ExeFS section of an NCCH file into AppLoader (e.g. .code, .logo, etc.) | 203 | * Reads an application ExeFS section of an NCCH file into AppLoader (e.g. .code, .logo, etc.) |
diff --git a/src/core/telemetry_session.cpp b/src/core/telemetry_session.cpp index 841d6cfa1..94483f385 100644 --- a/src/core/telemetry_session.cpp +++ b/src/core/telemetry_session.cpp | |||
| @@ -7,6 +7,7 @@ | |||
| 7 | #include "common/assert.h" | 7 | #include "common/assert.h" |
| 8 | #include "common/scm_rev.h" | 8 | #include "common/scm_rev.h" |
| 9 | #include "common/x64/cpu_detect.h" | 9 | #include "common/x64/cpu_detect.h" |
| 10 | #include "core/core.h" | ||
| 10 | #include "core/settings.h" | 11 | #include "core/settings.h" |
| 11 | #include "core/telemetry_session.h" | 12 | #include "core/telemetry_session.h" |
| 12 | 13 | ||
| @@ -39,12 +40,19 @@ TelemetrySession::TelemetrySession() { | |||
| 39 | std::chrono::system_clock::now().time_since_epoch()) | 40 | std::chrono::system_clock::now().time_since_epoch()) |
| 40 | .count()}; | 41 | .count()}; |
| 41 | AddField(Telemetry::FieldType::Session, "Init_Time", init_time); | 42 | AddField(Telemetry::FieldType::Session, "Init_Time", init_time); |
| 43 | std::string program_name; | ||
| 44 | const Loader::ResultStatus res{System::GetInstance().GetAppLoader().ReadTitle(program_name)}; | ||
| 45 | if (res == Loader::ResultStatus::Success) { | ||
| 46 | AddField(Telemetry::FieldType::Session, "ProgramName", program_name); | ||
| 47 | } | ||
| 42 | 48 | ||
| 43 | // Log application information | 49 | // Log application information |
| 44 | const bool is_git_dirty{std::strstr(Common::g_scm_desc, "dirty") != nullptr}; | 50 | const bool is_git_dirty{std::strstr(Common::g_scm_desc, "dirty") != nullptr}; |
| 45 | AddField(Telemetry::FieldType::App, "Git_IsDirty", is_git_dirty); | 51 | AddField(Telemetry::FieldType::App, "Git_IsDirty", is_git_dirty); |
| 46 | AddField(Telemetry::FieldType::App, "Git_Branch", Common::g_scm_branch); | 52 | AddField(Telemetry::FieldType::App, "Git_Branch", Common::g_scm_branch); |
| 47 | AddField(Telemetry::FieldType::App, "Git_Revision", Common::g_scm_rev); | 53 | AddField(Telemetry::FieldType::App, "Git_Revision", Common::g_scm_rev); |
| 54 | AddField(Telemetry::FieldType::App, "BuildDate", Common::g_build_date); | ||
| 55 | AddField(Telemetry::FieldType::App, "BuildName", Common::g_build_name); | ||
| 48 | 56 | ||
| 49 | // Log user system information | 57 | // Log user system information |
| 50 | AddField(Telemetry::FieldType::UserSystem, "CPU_Model", Common::GetCPUCaps().cpu_string); | 58 | AddField(Telemetry::FieldType::UserSystem, "CPU_Model", Common::GetCPUCaps().cpu_string); |
| @@ -68,6 +76,15 @@ TelemetrySession::TelemetrySession() { | |||
| 68 | Common::GetCPUCaps().sse4_1); | 76 | Common::GetCPUCaps().sse4_1); |
| 69 | AddField(Telemetry::FieldType::UserSystem, "CPU_Extension_x64_SSE42", | 77 | AddField(Telemetry::FieldType::UserSystem, "CPU_Extension_x64_SSE42", |
| 70 | Common::GetCPUCaps().sse4_2); | 78 | Common::GetCPUCaps().sse4_2); |
| 79 | #ifdef __APPLE__ | ||
| 80 | AddField(Telemetry::FieldType::UserSystem, "OsPlatform", "Apple"); | ||
| 81 | #elif defined(_WIN32) | ||
| 82 | AddField(Telemetry::FieldType::UserSystem, "OsPlatform", "Windows"); | ||
| 83 | #elif defined(__linux__) || defined(linux) || defined(__linux) | ||
| 84 | AddField(Telemetry::FieldType::UserSystem, "OsPlatform", "Linux"); | ||
| 85 | #else | ||
| 86 | AddField(Telemetry::FieldType::UserSystem, "OsPlatform", "Unknown"); | ||
| 87 | #endif | ||
| 71 | 88 | ||
| 72 | // Log user configuration information | 89 | // Log user configuration information |
| 73 | AddField(Telemetry::FieldType::UserConfig, "Audio_EnableAudioStretching", | 90 | AddField(Telemetry::FieldType::UserConfig, "Audio_EnableAudioStretching", |