diff options
| author | 2017-05-02 00:09:15 -0400 | |
|---|---|---|
| committer | 2017-05-24 19:16:22 -0400 | |
| commit | f3e14cae1e644b7e072796f2c26eab67b7a5d1b7 (patch) | |
| tree | 27a0b689d399425f54e1559c64a8cf935ce81c5e /src/core/telemetry_session.h | |
| parent | common: Add a generic interface for logging telemetry fields. (diff) | |
| download | yuzu-f3e14cae1e644b7e072796f2c26eab67b7a5d1b7.tar.gz yuzu-f3e14cae1e644b7e072796f2c26eab67b7a5d1b7.tar.xz yuzu-f3e14cae1e644b7e072796f2c26eab67b7a5d1b7.zip | |
core: Keep track of telemetry for the current emulation session.
Diffstat (limited to 'src/core/telemetry_session.h')
| -rw-r--r-- | src/core/telemetry_session.h | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/core/telemetry_session.h b/src/core/telemetry_session.h new file mode 100644 index 000000000..39e167868 --- /dev/null +++ b/src/core/telemetry_session.h | |||
| @@ -0,0 +1,38 @@ | |||
| 1 | // Copyright 2017 Citra Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #pragma once | ||
| 6 | |||
| 7 | #include <memory> | ||
| 8 | #include "common/telemetry.h" | ||
| 9 | |||
| 10 | namespace Core { | ||
| 11 | |||
| 12 | /** | ||
| 13 | * Instruments telemetry for this emulation session. Creates a new set of telemetry fields on each | ||
| 14 | * session, logging any one-time fields. Interfaces with the telemetry backend used for submitting | ||
| 15 | * data to the web service. Submits session data on close. | ||
| 16 | */ | ||
| 17 | class TelemetrySession : NonCopyable { | ||
| 18 | public: | ||
| 19 | TelemetrySession(); | ||
| 20 | ~TelemetrySession(); | ||
| 21 | |||
| 22 | /** | ||
| 23 | * Wrapper around the Telemetry::FieldCollection::AddField method. | ||
| 24 | * @param type Type of the field to add. | ||
| 25 | * @param name Name of the field to add. | ||
| 26 | * @param value Value for the field to add. | ||
| 27 | */ | ||
| 28 | template <typename T> | ||
| 29 | void AddField(Telemetry::FieldType type, const char* name, T value) { | ||
| 30 | field_collection.AddField(type, name, std::move(value)); | ||
| 31 | } | ||
| 32 | |||
| 33 | private: | ||
| 34 | Telemetry::FieldCollection field_collection; ///< Field collection, tracks all added fields | ||
| 35 | std::unique_ptr<Telemetry::VisitorInterface> backend; ///< Backend interface that logs fields | ||
| 36 | }; | ||
| 37 | |||
| 38 | } // namespace Core | ||