add gl info and gpu free memory to user stats

This commit is contained in:
Brad Hefta-Gaub 2016-10-25 14:56:54 -07:00
parent 272055b6ee
commit e22a2e9e2f
2 changed files with 19 additions and 12 deletions

View file

@ -1181,8 +1181,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
properties["current_path"] = currentPath; properties["current_path"] = currentPath;
properties["build_version"] = BuildInfo::VERSION; properties["build_version"] = BuildInfo::VERSION;
qDebug() << "just sent stats with:" << currentDomain << currentPath << "build:" << BuildInfo::VERSION;
auto displayPlugin = qApp->getActiveDisplayPlugin(); auto displayPlugin = qApp->getActiveDisplayPlugin();
properties["fps"] = _frameCounter.rate(); properties["fps"] = _frameCounter.rate();
@ -1233,6 +1231,10 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
properties["active_display_plugin"] = getActiveDisplayPlugin()->getName(); properties["active_display_plugin"] = getActiveDisplayPlugin()->getName();
properties["using_hmd"] = isHMDMode(); properties["using_hmd"] = isHMDMode();
auto glInfo = getGLContextData();
properties["gl_info"] = glInfo;
properties["gpu_free_memory"] = (int)BYTES_TO_MB(gpu::Context::getFreeGPUMemory());
auto hmdHeadPose = getHMDSensorPose(); auto hmdHeadPose = getHMDSensorPose();
properties["hmd_head_pose_changed"] = isHMDMode() && (hmdHeadPose != lastHMDHeadPose); properties["hmd_head_pose_changed"] = isHMDMode() && (hmdHeadPose != lastHMDHeadPose);
lastHMDHeadPose = hmdHeadPose; lastHMDHeadPose = hmdHeadPose;

View file

@ -35,17 +35,22 @@ int glVersionToInteger(QString glVersion) {
} }
QJsonObject getGLContextData() { QJsonObject getGLContextData() {
QString glVersion = QString((const char*)glGetString(GL_VERSION)); static QJsonObject result;
QString glslVersion = QString((const char*) glGetString(GL_SHADING_LANGUAGE_VERSION)); static std::once_flag once;
QString glVendor = QString((const char*) glGetString(GL_VENDOR)); std::call_once(once, [] {
QString glRenderer = QString((const char*)glGetString(GL_RENDERER)); QString glVersion = QString((const char*)glGetString(GL_VERSION));
QString glslVersion = QString((const char*) glGetString(GL_SHADING_LANGUAGE_VERSION));
QString glVendor = QString((const char*) glGetString(GL_VENDOR));
QString glRenderer = QString((const char*)glGetString(GL_RENDERER));
return QJsonObject { result = QJsonObject {
{ "version", glVersion }, { "version", glVersion },
{ "slVersion", glslVersion }, { "slVersion", glslVersion },
{ "vendor", glVendor }, { "vendor", glVendor },
{ "renderer", glRenderer }, { "renderer", glRenderer },
}; };
});
return result;
} }
QThread* RENDER_THREAD = nullptr; QThread* RENDER_THREAD = nullptr;