diff options
| author | 2017-05-02 00:10:04 -0400 | |
|---|---|---|
| committer | 2017-05-24 19:16:23 -0400 | |
| commit | 120b00fb1aee96aec42b1647ece98dcc3e192139 (patch) | |
| tree | 2278bd436cd8887c0f35a6ef8fcb5fcb68adaae2 /src/core/telemetry_session.cpp | |
| parent | core: Keep track of telemetry for the current emulation session. (diff) | |
| download | yuzu-120b00fb1aee96aec42b1647ece98dcc3e192139.tar.gz yuzu-120b00fb1aee96aec42b1647ece98dcc3e192139.tar.xz yuzu-120b00fb1aee96aec42b1647ece98dcc3e192139.zip | |
telemetry: Log a few simple data fields throughout core.
Diffstat (limited to 'src/core/telemetry_session.cpp')
| -rw-r--r-- | src/core/telemetry_session.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
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. |