summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2017-05-02 06:10:04 +0200
committerbunnei <bunneidev@gmail.com>2017-05-25 01:16:23 +0200
commit120b00fb1aee96aec42b1647ece98dcc3e192139 (patch)
tree2278bd436cd8887c0f35a6ef8fcb5fcb68adaae2 /src/core
parentcore: Keep track of telemetry for the current emulation session. (diff)
downloadyuzu-120b00fb1aee96aec42b1647ece98dcc3e192139.tar
yuzu-120b00fb1aee96aec42b1647ece98dcc3e192139.tar.gz
yuzu-120b00fb1aee96aec42b1647ece98dcc3e192139.tar.bz2
yuzu-120b00fb1aee96aec42b1647ece98dcc3e192139.tar.lz
yuzu-120b00fb1aee96aec42b1647ece98dcc3e192139.tar.xz
yuzu-120b00fb1aee96aec42b1647ece98dcc3e192139.tar.zst
yuzu-120b00fb1aee96aec42b1647ece98dcc3e192139.zip
Diffstat (limited to 'src/core')
-rw-r--r--src/core/loader/ncch.cpp3
-rw-r--r--src/core/telemetry_session.cpp18
-rw-r--r--src/core/telemetry_session.h2
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 @@
#include "common/logging/log.h"
#include "common/string_util.h"
#include "common/swap.h"
+#include "core/core.h"
#include "core/file_sys/archive_selfncch.h"
#include "core/hle/kernel/process.h"
#include "core/hle/kernel/resource_limit.h"
@@ -339,6 +340,8 @@ ResultStatus AppLoader_NCCH::Load() {
LOG_INFO(Loader, "Program ID: %016" PRIX64, ncch_header.program_id);
+ Core::Telemetry().AddField(Telemetry::FieldType::Session, "ProgramId", ncch_header.program_id);
+
is_loaded = true; // Set state to loaded
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 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
+#include <cstring>
+
#include "common/scm_rev.h"
#include "core/telemetry_session.h"
@@ -10,9 +12,25 @@ namespace Core {
TelemetrySession::TelemetrySession() {
// TODO(bunnei): Replace with a backend that logs to our web service
backend = std::make_unique<Telemetry::NullVisitor>();
+
+ // Log one-time session start information
+ const auto duration{std::chrono::steady_clock::now().time_since_epoch()};
+ const auto start_time{std::chrono::duration_cast<std::chrono::microseconds>(duration).count()};
+ AddField(Telemetry::FieldType::Session, "StartTime", start_time);
+
+ // Log one-time application information
+ const bool is_git_dirty{std::strstr(Common::g_scm_desc, "dirty") != nullptr};
+ AddField(Telemetry::FieldType::App, "GitIsDirty", is_git_dirty);
+ AddField(Telemetry::FieldType::App, "GitBranch", Common::g_scm_branch);
+ AddField(Telemetry::FieldType::App, "GitRevision", Common::g_scm_rev);
}
TelemetrySession::~TelemetrySession() {
+ // Log one-time session end information
+ const auto duration{std::chrono::steady_clock::now().time_since_epoch()};
+ const auto end_time{std::chrono::duration_cast<std::chrono::microseconds>(duration).count()};
+ AddField(Telemetry::FieldType::Session, "EndTime", end_time);
+
// Complete the session, submitting to web service if necessary
// This is just a placeholder to wrap up the session once the core completes and this is
// 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:
}
private:
- Telemetry::FieldCollection field_collection; ///< Field collection, tracks all added fields
+ Telemetry::FieldCollection field_collection; ///< Tracks all added fields for the session
std::unique_ptr<Telemetry::VisitorInterface> backend; ///< Backend interface that logs fields
};