diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/loader/ncch.cpp | 3 | ||||
| -rw-r--r-- | src/core/telemetry_session.cpp | 18 | ||||
| -rw-r--r-- | src/core/telemetry_session.h | 2 |
3 files changed, 22 insertions, 1 deletions
diff --git a/src/core/loader/ncch.cpp b/src/core/loader/ncch.cpp index 1a4e3efa8..beeb13ffa 100644 --- a/src/core/loader/ncch.cpp +++ b/src/core/loader/ncch.cpp | |||
| @@ -9,6 +9,7 @@ | |||
| 9 | #include "common/logging/log.h" | 9 | #include "common/logging/log.h" |
| 10 | #include "common/string_util.h" | 10 | #include "common/string_util.h" |
| 11 | #include "common/swap.h" | 11 | #include "common/swap.h" |
| 12 | #include "core/core.h" | ||
| 12 | #include "core/file_sys/archive_selfncch.h" | 13 | #include "core/file_sys/archive_selfncch.h" |
| 13 | #include "core/hle/kernel/process.h" | 14 | #include "core/hle/kernel/process.h" |
| 14 | #include "core/hle/kernel/resource_limit.h" | 15 | #include "core/hle/kernel/resource_limit.h" |
| @@ -339,6 +340,8 @@ ResultStatus AppLoader_NCCH::Load() { | |||
| 339 | 340 | ||
| 340 | LOG_INFO(Loader, "Program ID: %016" PRIX64, ncch_header.program_id); | 341 | LOG_INFO(Loader, "Program ID: %016" PRIX64, ncch_header.program_id); |
| 341 | 342 | ||
| 343 | Core::Telemetry().AddField(Telemetry::FieldType::Session, "ProgramId", ncch_header.program_id); | ||
| 344 | |||
| 342 | is_loaded = true; // Set state to loaded | 345 | is_loaded = true; // Set state to loaded |
| 343 | 346 | ||
| 344 | result = LoadExec(); // Load the executable into memory for booting | 347 | result = LoadExec(); // Load the executable into memory for booting |
diff --git a/src/core/telemetry_session.cpp b/src/core/telemetry_session.cpp index ec8f7d95e..ddc8b262e 100644 --- a/src/core/telemetry_session.cpp +++ b/src/core/telemetry_session.cpp | |||
| @@ -2,6 +2,8 @@ | |||
| 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 | |||
| 5 | #include "common/scm_rev.h" | 7 | #include "common/scm_rev.h" |
| 6 | #include "core/telemetry_session.h" | 8 | #include "core/telemetry_session.h" |
| 7 | 9 | ||
| @@ -10,9 +12,25 @@ namespace Core { | |||
| 10 | TelemetrySession::TelemetrySession() { | 12 | TelemetrySession::TelemetrySession() { |
| 11 | // TODO(bunnei): Replace with a backend that logs to our web service | 13 | // TODO(bunnei): Replace with a backend that logs to our web service |
| 12 | backend = std::make_unique<Telemetry::NullVisitor>(); | 14 | backend = std::make_unique<Telemetry::NullVisitor>(); |
| 15 | |||
| 16 | // Log one-time session start information | ||
| 17 | const auto duration{std::chrono::steady_clock::now().time_since_epoch()}; | ||
| 18 | const auto start_time{std::chrono::duration_cast<std::chrono::microseconds>(duration).count()}; | ||
| 19 | AddField(Telemetry::FieldType::Session, "StartTime", start_time); | ||
| 20 | |||
| 21 | // Log one-time application information | ||
| 22 | const bool is_git_dirty{std::strstr(Common::g_scm_desc, "dirty") != nullptr}; | ||
| 23 | AddField(Telemetry::FieldType::App, "GitIsDirty", is_git_dirty); | ||
| 24 | AddField(Telemetry::FieldType::App, "GitBranch", Common::g_scm_branch); | ||
| 25 | AddField(Telemetry::FieldType::App, "GitRevision", Common::g_scm_rev); | ||
| 13 | } | 26 | } |
| 14 | 27 | ||
| 15 | TelemetrySession::~TelemetrySession() { | 28 | TelemetrySession::~TelemetrySession() { |
| 29 | // Log one-time session end information | ||
| 30 | const auto duration{std::chrono::steady_clock::now().time_since_epoch()}; | ||
| 31 | const auto end_time{std::chrono::duration_cast<std::chrono::microseconds>(duration).count()}; | ||
| 32 | AddField(Telemetry::FieldType::Session, "EndTime", end_time); | ||
| 33 | |||
| 16 | // Complete the session, submitting to web service if necessary | 34 | // Complete the session, submitting to web service if necessary |
| 17 | // This is just a placeholder to wrap up the session once the core completes and this is | 35 | // This is just a placeholder to wrap up the session once the core completes and this is |
| 18 | // destroyed. This will be moved elsewhere once we are actually doing real I/O with the service. | 36 | // destroyed. This will be moved elsewhere once we are actually doing real I/O with the service. |
diff --git a/src/core/telemetry_session.h b/src/core/telemetry_session.h index 39e167868..cf53835c3 100644 --- a/src/core/telemetry_session.h +++ b/src/core/telemetry_session.h | |||
| @@ -31,7 +31,7 @@ public: | |||
| 31 | } | 31 | } |
| 32 | 32 | ||
| 33 | private: | 33 | private: |
| 34 | Telemetry::FieldCollection field_collection; ///< Field collection, tracks all added fields | 34 | Telemetry::FieldCollection field_collection; ///< Tracks all added fields for the session |
| 35 | std::unique_ptr<Telemetry::VisitorInterface> backend; ///< Backend interface that logs fields | 35 | std::unique_ptr<Telemetry::VisitorInterface> backend; ///< Backend interface that logs fields |
| 36 | }; | 36 | }; |
| 37 | 37 | ||