diff options
| author | 2017-05-24 19:33:54 -0400 | |
|---|---|---|
| committer | 2017-05-24 19:33:54 -0400 | |
| commit | 634229ff45f0780567d00114289a3c3ca7b3f424 (patch) | |
| tree | 2278bd436cd8887c0f35a6ef8fcb5fcb68adaae2 /src/core/telemetry_session.h | |
| parent | Merge pull request #2692 from Subv/vfp_ftz (diff) | |
| parent | telemetry: Log a few simple data fields throughout core. (diff) | |
| download | yuzu-634229ff45f0780567d00114289a3c3ca7b3f424.tar.gz yuzu-634229ff45f0780567d00114289a3c3ca7b3f424.tar.xz yuzu-634229ff45f0780567d00114289a3c3ca7b3f424.zip | |
Merge pull request #2683 from bunnei/telemetry-framework
Telemetry framework Part 1
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..cf53835c3 --- /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; ///< Tracks all added fields for the session | ||
| 35 | std::unique_ptr<Telemetry::VisitorInterface> backend; ///< Backend interface that logs fields | ||
| 36 | }; | ||
| 37 | |||
| 38 | } // namespace Core | ||