1
0
Fork 0
forked from suyu/suyu

Merge pull request #4546 from lioncash/telemetry

common/telemetry: Migrate namespace into the Common namespace
This commit is contained in:
bunnei 2020-08-20 14:29:13 -04:00 committed by GitHub
commit 3ea3de4ecd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 43 additions and 35 deletions

View file

@ -12,7 +12,7 @@
#include "common/x64/cpu_detect.h" #include "common/x64/cpu_detect.h"
#endif #endif
namespace Telemetry { namespace Common::Telemetry {
void FieldCollection::Accept(VisitorInterface& visitor) const { void FieldCollection::Accept(VisitorInterface& visitor) const {
for (const auto& field : fields) { for (const auto& field : fields) {
@ -88,4 +88,4 @@ void AppendOSInfo(FieldCollection& fc) {
#endif #endif
} }
} // namespace Telemetry } // namespace Common::Telemetry

View file

@ -10,7 +10,7 @@
#include <string> #include <string>
#include "common/common_types.h" #include "common/common_types.h"
namespace Telemetry { namespace Common::Telemetry {
/// Field type, used for grouping fields together in the final submitted telemetry log /// Field type, used for grouping fields together in the final submitted telemetry log
enum class FieldType : u8 { enum class FieldType : u8 {
@ -196,4 +196,4 @@ void AppendCPUInfo(FieldCollection& fc);
/// such as platform name, etc. /// such as platform name, etc.
void AppendOSInfo(FieldCollection& fc); void AppendOSInfo(FieldCollection& fc);
} // namespace Telemetry } // namespace Common::Telemetry

View file

@ -269,14 +269,14 @@ struct System::Impl {
// Log last frame performance stats if game was loded // Log last frame performance stats if game was loded
if (perf_stats) { if (perf_stats) {
const auto perf_results = GetAndResetPerfStats(); const auto perf_results = GetAndResetPerfStats();
telemetry_session->AddField(Telemetry::FieldType::Performance, constexpr auto performance = Common::Telemetry::FieldType::Performance;
"Shutdown_EmulationSpeed",
telemetry_session->AddField(performance, "Shutdown_EmulationSpeed",
perf_results.emulation_speed * 100.0); perf_results.emulation_speed * 100.0);
telemetry_session->AddField(Telemetry::FieldType::Performance, "Shutdown_Framerate", telemetry_session->AddField(performance, "Shutdown_Framerate", perf_results.game_fps);
perf_results.game_fps); telemetry_session->AddField(performance, "Shutdown_Frametime",
telemetry_session->AddField(Telemetry::FieldType::Performance, "Shutdown_Frametime",
perf_results.frametime * 1000.0); perf_results.frametime * 1000.0);
telemetry_session->AddField(Telemetry::FieldType::Performance, "Mean_Frametime_MS", telemetry_session->AddField(performance, "Mean_Frametime_MS",
perf_stats->GetMeanFrametime()); perf_stats->GetMeanFrametime());
} }

View file

@ -25,6 +25,8 @@
namespace Core { namespace Core {
namespace Telemetry = Common::Telemetry;
static u64 GenerateTelemetryId() { static u64 GenerateTelemetryId() {
u64 telemetry_id{}; u64 telemetry_id{};

View file

@ -52,7 +52,7 @@ public:
* @param value Value for the field to add. * @param value Value for the field to add.
*/ */
template <typename T> template <typename T>
void AddField(Telemetry::FieldType type, const char* name, T value) { void AddField(Common::Telemetry::FieldType type, const char* name, T value) {
field_collection.AddField(type, name, std::move(value)); field_collection.AddField(type, name, std::move(value));
} }
@ -63,7 +63,8 @@ public:
bool SubmitTestcase(); bool SubmitTestcase();
private: private:
Telemetry::FieldCollection field_collection; ///< Tracks all added fields for the session /// Tracks all added fields for the session
Common::Telemetry::FieldCollection field_collection;
}; };
/** /**

View file

@ -509,9 +509,10 @@ void RendererOpenGL::AddTelemetryFields() {
LOG_INFO(Render_OpenGL, "GL_RENDERER: {}", gpu_model); LOG_INFO(Render_OpenGL, "GL_RENDERER: {}", gpu_model);
auto& telemetry_session = system.TelemetrySession(); auto& telemetry_session = system.TelemetrySession();
telemetry_session.AddField(Telemetry::FieldType::UserSystem, "GPU_Vendor", gpu_vendor); constexpr auto user_system = Common::Telemetry::FieldType::UserSystem;
telemetry_session.AddField(Telemetry::FieldType::UserSystem, "GPU_Model", gpu_model); telemetry_session.AddField(user_system, "GPU_Vendor", gpu_vendor);
telemetry_session.AddField(Telemetry::FieldType::UserSystem, "GPU_OpenGL_Version", gl_version); telemetry_session.AddField(user_system, "GPU_Model", gpu_model);
telemetry_session.AddField(user_system, "GPU_OpenGL_Version", gl_version);
} }
void RendererOpenGL::CreateRasterizer() { void RendererOpenGL::CreateRasterizer() {

View file

@ -439,7 +439,7 @@ void RendererVulkan::Report() const {
LOG_INFO(Render_Vulkan, "Vulkan: {}", api_version); LOG_INFO(Render_Vulkan, "Vulkan: {}", api_version);
auto& telemetry_session = system.TelemetrySession(); auto& telemetry_session = system.TelemetrySession();
constexpr auto field = Telemetry::FieldType::UserSystem; constexpr auto field = Common::Telemetry::FieldType::UserSystem;
telemetry_session.AddField(field, "GPU_Vendor", vendor_name); telemetry_session.AddField(field, "GPU_Vendor", vendor_name);
telemetry_session.AddField(field, "GPU_Model", model_name); telemetry_session.AddField(field, "GPU_Model", model_name);
telemetry_session.AddField(field, "GPU_Vulkan_Driver", driver_name); telemetry_session.AddField(field, "GPU_Vulkan_Driver", driver_name);

View file

@ -10,6 +10,8 @@
namespace WebService { namespace WebService {
namespace Telemetry = Common::Telemetry;
struct TelemetryJson::Impl { struct TelemetryJson::Impl {
Impl(std::string host, std::string username, std::string token) Impl(std::string host, std::string username, std::string token)
: host{std::move(host)}, username{std::move(username)}, token{std::move(token)} {} : host{std::move(host)}, username{std::move(username)}, token{std::move(token)} {}

View file

@ -14,25 +14,25 @@ namespace WebService {
* Implementation of VisitorInterface that serialized telemetry into JSON, and submits it to the * Implementation of VisitorInterface that serialized telemetry into JSON, and submits it to the
* yuzu web service * yuzu web service
*/ */
class TelemetryJson : public Telemetry::VisitorInterface { class TelemetryJson : public Common::Telemetry::VisitorInterface {
public: public:
TelemetryJson(std::string host, std::string username, std::string token); TelemetryJson(std::string host, std::string username, std::string token);
~TelemetryJson() override; ~TelemetryJson() override;
void Visit(const Telemetry::Field<bool>& field) override; void Visit(const Common::Telemetry::Field<bool>& field) override;
void Visit(const Telemetry::Field<double>& field) override; void Visit(const Common::Telemetry::Field<double>& field) override;
void Visit(const Telemetry::Field<float>& field) override; void Visit(const Common::Telemetry::Field<float>& field) override;
void Visit(const Telemetry::Field<u8>& field) override; void Visit(const Common::Telemetry::Field<u8>& field) override;
void Visit(const Telemetry::Field<u16>& field) override; void Visit(const Common::Telemetry::Field<u16>& field) override;
void Visit(const Telemetry::Field<u32>& field) override; void Visit(const Common::Telemetry::Field<u32>& field) override;
void Visit(const Telemetry::Field<u64>& field) override; void Visit(const Common::Telemetry::Field<u64>& field) override;
void Visit(const Telemetry::Field<s8>& field) override; void Visit(const Common::Telemetry::Field<s8>& field) override;
void Visit(const Telemetry::Field<s16>& field) override; void Visit(const Common::Telemetry::Field<s16>& field) override;
void Visit(const Telemetry::Field<s32>& field) override; void Visit(const Common::Telemetry::Field<s32>& field) override;
void Visit(const Telemetry::Field<s64>& field) override; void Visit(const Common::Telemetry::Field<s64>& field) override;
void Visit(const Telemetry::Field<std::string>& field) override; void Visit(const Common::Telemetry::Field<std::string>& field) override;
void Visit(const Telemetry::Field<const char*>& field) override; void Visit(const Common::Telemetry::Field<const char*>& field) override;
void Visit(const Telemetry::Field<std::chrono::microseconds>& field) override; void Visit(const Common::Telemetry::Field<std::chrono::microseconds>& field) override;
void Complete() override; void Complete() override;
bool SubmitTestcase() override; bool SubmitTestcase() override;

View file

@ -54,7 +54,8 @@ void CompatDB::Submit() {
back(); back();
LOG_DEBUG(Frontend, "Compatibility Rating: {}", compatibility->checkedId()); LOG_DEBUG(Frontend, "Compatibility Rating: {}", compatibility->checkedId());
Core::System::GetInstance().TelemetrySession().AddField( Core::System::GetInstance().TelemetrySession().AddField(
Telemetry::FieldType::UserFeedback, "Compatibility", compatibility->checkedId()); Common::Telemetry::FieldType::UserFeedback, "Compatibility",
compatibility->checkedId());
button(NextButton)->setEnabled(false); button(NextButton)->setEnabled(false);
button(NextButton)->setText(tr("Submitting")); button(NextButton)->setText(tr("Submitting"));

View file

@ -1041,7 +1041,7 @@ bool GMainWindow::LoadROM(const QString& filename) {
} }
game_path = filename; game_path = filename;
system.TelemetrySession().AddField(Telemetry::FieldType::App, "Frontend", "Qt"); system.TelemetrySession().AddField(Common::Telemetry::FieldType::App, "Frontend", "Qt");
return true; return true;
} }

View file

@ -229,7 +229,7 @@ int main(int argc, char** argv) {
} }
} }
system.TelemetrySession().AddField(Telemetry::FieldType::App, "Frontend", "SDL"); system.TelemetrySession().AddField(Common::Telemetry::FieldType::App, "Frontend", "SDL");
// Core is loaded, start the GPU (makes the GPU contexts current to this thread) // Core is loaded, start the GPU (makes the GPU contexts current to this thread)
system.GPU().Start(); system.GPU().Start();

View file

@ -251,7 +251,8 @@ int main(int argc, char** argv) {
Service::Yuzu::InstallInterfaces(system.ServiceManager(), datastring, callback); Service::Yuzu::InstallInterfaces(system.ServiceManager(), datastring, callback);
system.TelemetrySession().AddField(Telemetry::FieldType::App, "Frontend", "SDLHideTester"); system.TelemetrySession().AddField(Common::Telemetry::FieldType::App, "Frontend",
"SDLHideTester");
system.GPU().Start(); system.GPU().Start();
system.Renderer().Rasterizer().LoadDiskResources(); system.Renderer().Rasterizer().LoadDiskResources();