From 65ef82466c18636eb6c403987c131b98b2c147c9 Mon Sep 17 00:00:00 2001 From: baldurk Date: Fri, 19 Jan 2018 13:57:02 +0000 Subject: [PATCH] Re-organise Analytics structures a bit to be more processing friendly --- qrenderdoc/Code/CaptureContext.cpp | 2 +- qrenderdoc/Code/Interface/Analytics.cpp | 118 +++++++++--------- qrenderdoc/Code/Interface/Analytics.h | 99 ++++++++------- qrenderdoc/Code/ReplayManager.cpp | 4 +- qrenderdoc/Code/qrenderdoc.cpp | 14 +-- qrenderdoc/Windows/BufferViewer.cpp | 4 +- qrenderdoc/Windows/EventBrowser.cpp | 2 +- qrenderdoc/Windows/MainWindow.cpp | 2 +- .../PipelineState/PipelineStateViewer.cpp | 4 +- qrenderdoc/Windows/ShaderViewer.cpp | 6 +- qrenderdoc/Windows/TextureViewer.cpp | 4 +- 11 files changed, 129 insertions(+), 130 deletions(-) diff --git a/qrenderdoc/Code/CaptureContext.cpp b/qrenderdoc/Code/CaptureContext.cpp index 1080f6979..762554037 100644 --- a/qrenderdoc/Code/CaptureContext.cpp +++ b/qrenderdoc/Code/CaptureContext.cpp @@ -155,7 +155,7 @@ void CaptureContext::LoadCapture(const rdcstr &captureFile, const rdcstr &origFi [this]() { return !m_LoadInProgress; }, [this]() { return UpdateLoadProgress(); }); - ANALYTIC_ADDAVG(LoadTime, double(loadTimer.nsecsElapsed() * 1.0e-9)); + ANALYTIC_ADDAVG(Performance.LoadTime, double(loadTimer.nsecsElapsed() * 1.0e-9)); ANALYTIC_SET(CaptureFeatures.ShaderLinkage, m_APIProps.ShaderLinkage); ANALYTIC_SET(CaptureFeatures.YUVTextures, m_APIProps.YUVTextures); diff --git a/qrenderdoc/Code/Interface/Analytics.cpp b/qrenderdoc/Code/Interface/Analytics.cpp index 664810df1..590b5e31f 100644 --- a/qrenderdoc/Code/Interface/Analytics.cpp +++ b/qrenderdoc/Code/Interface/Analytics.cpp @@ -166,33 +166,37 @@ void AnalyticsSerialise(QVariantMap &values, AnalyticsSerialiseType type) } ANALYTIC_SERIALISE(Version); - // Environment + // Metadata { - ANALYTIC_SERIALISE(Environment.RenderDocVersion); - ANALYTIC_SERIALISE(Environment.DistributionVersion); - ANALYTIC_SERIALISE(Environment.OSVersion); - ANALYTIC_SERIALISE(Environment.GPUVendors); - ANALYTIC_SERIALISE(Environment.Bitness); - ANALYTIC_SERIALISE(Environment.DevelBuildRun); - ANALYTIC_SERIALISE(Environment.OfficialBuildRun); + ANALYTIC_SERIALISE(Metadata.RenderDocVersion); + ANALYTIC_SERIALISE(Metadata.DistributionVersion); + ANALYTIC_SERIALISE(Metadata.OSVersion); + ANALYTIC_SERIALISE(Metadata.Bitness); + ANALYTIC_SERIALISE(Metadata.DevelBuildRun); + ANALYTIC_SERIALISE(Metadata.OfficialBuildRun); + + // special handling for reporting DaysUsed, to flatten into a number + if(reporting) + { + int sum = 0; + for(bool day : Analytics::db->Metadata.DaysUsed) + sum += day ? 1 : 0; + + saveTo(values, lit("Metadata.DaysUsed"), sum, reporting); + } + else + { + ANALYTIC_SERIALISE(Metadata.DaysUsed); + } } - // special handling for reporting DaysUsed, to flatten into a number - if(reporting) + // Performance { - int sum = 0; - for(bool day : Analytics::db->DaysUsed) - sum += day ? 1 : 0; - - saveTo(values, lit("DaysUsed"), sum, reporting); - } - else - { - ANALYTIC_SERIALISE(DaysUsed); + ANALYTIC_SERIALISE(Performance.LoadTime); } - ANALYTIC_SERIALISE(LoadTime); - ANALYTIC_SERIALISE(APIsUsed); + ANALYTIC_SERIALISE(APIs); + ANALYTIC_SERIALISE(GPUVendors); // UIFeatures { @@ -207,47 +211,43 @@ void AnalyticsSerialise(QVariantMap &values, AnalyticsSerialiseType type) ANALYTIC_SERIALISE(UIFeatures.CustomTextureVisualise); ANALYTIC_SERIALISE(UIFeatures.ImageViewer); ANALYTIC_SERIALISE(UIFeatures.CaptureComments); + ANALYTIC_SERIALISE(UIFeatures.AndroidRemoteReplay); + ANALYTIC_SERIALISE(UIFeatures.NonAndroidRemoteReplay); + } - // Export - { - ANALYTIC_SERIALISE(UIFeatures.Export.EventBrowser); - ANALYTIC_SERIALISE(UIFeatures.Export.PipelineState); - ANALYTIC_SERIALISE(UIFeatures.Export.MeshOutput); - ANALYTIC_SERIALISE(UIFeatures.Export.RawBuffer); - ANALYTIC_SERIALISE(UIFeatures.Export.TextureSave); - ANALYTIC_SERIALISE(UIFeatures.Export.ShaderSave); - } + // Export + { + ANALYTIC_SERIALISE(Export.EventBrowser); + ANALYTIC_SERIALISE(Export.PipelineState); + ANALYTIC_SERIALISE(Export.MeshOutput); + ANALYTIC_SERIALISE(Export.RawBuffer); + ANALYTIC_SERIALISE(Export.Texture); + ANALYTIC_SERIALISE(Export.Shader); + } - // ShaderDebug - { - ANALYTIC_SERIALISE(UIFeatures.ShaderDebug.Vertex); - ANALYTIC_SERIALISE(UIFeatures.ShaderDebug.Pixel); - ANALYTIC_SERIALISE(UIFeatures.ShaderDebug.Compute); - } + // ShaderDebug + { + ANALYTIC_SERIALISE(ShaderDebug.Vertex); + ANALYTIC_SERIALISE(ShaderDebug.Pixel); + ANALYTIC_SERIALISE(ShaderDebug.Compute); + } - // TextureDebugOverlays - { - ANALYTIC_SERIALISE(UIFeatures.TextureDebugOverlays.Drawcall); - ANALYTIC_SERIALISE(UIFeatures.TextureDebugOverlays.Wireframe); - ANALYTIC_SERIALISE(UIFeatures.TextureDebugOverlays.Depth); - ANALYTIC_SERIALISE(UIFeatures.TextureDebugOverlays.Stencil); - ANALYTIC_SERIALISE(UIFeatures.TextureDebugOverlays.BackfaceCull); - ANALYTIC_SERIALISE(UIFeatures.TextureDebugOverlays.ViewportScissor); - ANALYTIC_SERIALISE(UIFeatures.TextureDebugOverlays.NaN); - ANALYTIC_SERIALISE(UIFeatures.TextureDebugOverlays.Clipping); - ANALYTIC_SERIALISE(UIFeatures.TextureDebugOverlays.ClearBeforePass); - ANALYTIC_SERIALISE(UIFeatures.TextureDebugOverlays.ClearBeforeDraw); - ANALYTIC_SERIALISE(UIFeatures.TextureDebugOverlays.QuadOverdrawPass); - ANALYTIC_SERIALISE(UIFeatures.TextureDebugOverlays.QuadOverdrawDraw); - ANALYTIC_SERIALISE(UIFeatures.TextureDebugOverlays.TriangleSizePass); - ANALYTIC_SERIALISE(UIFeatures.TextureDebugOverlays.TriangleSizeDraw); - } - - // RemoteReplay - { - ANALYTIC_SERIALISE(UIFeatures.RemoteReplay.Android); - ANALYTIC_SERIALISE(UIFeatures.RemoteReplay.NonAndroid); - } + // TextureOverlays + { + ANALYTIC_SERIALISE(TextureOverlays.Drawcall); + ANALYTIC_SERIALISE(TextureOverlays.Wireframe); + ANALYTIC_SERIALISE(TextureOverlays.Depth); + ANALYTIC_SERIALISE(TextureOverlays.Stencil); + ANALYTIC_SERIALISE(TextureOverlays.BackfaceCull); + ANALYTIC_SERIALISE(TextureOverlays.ViewportScissor); + ANALYTIC_SERIALISE(TextureOverlays.NaN); + ANALYTIC_SERIALISE(TextureOverlays.Clipping); + ANALYTIC_SERIALISE(TextureOverlays.ClearBeforePass); + ANALYTIC_SERIALISE(TextureOverlays.ClearBeforeDraw); + ANALYTIC_SERIALISE(TextureOverlays.QuadOverdrawPass); + ANALYTIC_SERIALISE(TextureOverlays.QuadOverdrawDraw); + ANALYTIC_SERIALISE(TextureOverlays.TriangleSizePass); + ANALYTIC_SERIALISE(TextureOverlays.TriangleSizeDraw); } // CaptureFeatures diff --git a/qrenderdoc/Code/Interface/Analytics.h b/qrenderdoc/Code/Interface/Analytics.h index 41b79e463..6293de016 100644 --- a/qrenderdoc/Code/Interface/Analytics.h +++ b/qrenderdoc/Code/Interface/Analytics.h @@ -142,9 +142,6 @@ struct Analytics // A human readable name of the operating system. QString OSVersion; - // A list of which GPU vendors have been used for replay - QStringList GPUVendors; - // Either 32 or 64 indicating which bit-depth the UI is running as int Bitness = 0; @@ -154,16 +151,22 @@ struct Analytics // whether an official build has been run - whether distributed from the RenderDoc website or // through a linux distribution bool OfficialBuildRun = false; - } Environment; - // Counts which unique days in the last month the program was run - bool DaysUsed[32] = {0}; + // Counts which unique days in the last month the program was run + bool DaysUsed[32] = {0}; + } Metadata; - // how long do captures take to load, on average - AnalyticsAverage LoadTime; + struct + { + // how long do captures take to load, on average + AnalyticsAverage LoadTime; + } Performance; // which APIs have been used - QStringList APIsUsed; + QStringList APIs; + + // A list of which GPU vendors have been used for replay + QStringList GPUVendors; // which UI features have been used, as a simple yes/no struct @@ -179,49 +182,45 @@ struct Analytics bool CustomTextureVisualise = false; bool ImageViewer = false; bool CaptureComments = false; - - struct - { - bool EventBrowser = false; - bool PipelineState = false; - bool MeshOutput = false; - bool RawBuffer = false; - bool TextureSave = false; - bool ShaderSave = false; - } Export; - - struct - { - bool Vertex = false; - bool Pixel = false; - bool Compute = false; - } ShaderDebug; - - struct - { - bool Drawcall = false; - bool Wireframe = false; - bool Depth = false; - bool Stencil = false; - bool BackfaceCull = false; - bool ViewportScissor = false; - bool NaN = false; - bool Clipping = false; - bool ClearBeforePass = false; - bool ClearBeforeDraw = false; - bool QuadOverdrawPass = false; - bool QuadOverdrawDraw = false; - bool TriangleSizePass = false; - bool TriangleSizeDraw = false; - } TextureDebugOverlays; - - struct - { - bool Android = false; - bool NonAndroid = false; - } RemoteReplay; + bool AndroidRemoteReplay = false; + bool NonAndroidRemoteReplay = false; } UIFeatures; + struct + { + bool EventBrowser = false; + bool PipelineState = false; + bool MeshOutput = false; + bool RawBuffer = false; + bool Texture = false; + bool Shader = false; + } Export; + + struct + { + bool Vertex = false; + bool Pixel = false; + bool Compute = false; + } ShaderDebug; + + struct + { + bool Drawcall = false; + bool Wireframe = false; + bool Depth = false; + bool Stencil = false; + bool BackfaceCull = false; + bool ViewportScissor = false; + bool NaN = false; + bool Clipping = false; + bool ClearBeforePass = false; + bool ClearBeforeDraw = false; + bool QuadOverdrawPass = false; + bool QuadOverdrawDraw = false; + bool TriangleSizePass = false; + bool TriangleSizeDraw = false; + } TextureOverlays; + // If some particular API specific features are seen in a capture, as a simple yes/no. See // APIProperties struct diff --git a/qrenderdoc/Code/ReplayManager.cpp b/qrenderdoc/Code/ReplayManager.cpp index e7a343f17..f592e3908 100644 --- a/qrenderdoc/Code/ReplayManager.cpp +++ b/qrenderdoc/Code/ReplayManager.cpp @@ -305,11 +305,11 @@ ReplayStatus ReplayManager::ConnectToRemoteServer(RemoteHost *host) if(host->IsADB()) { - ANALYTIC_SET(UIFeatures.RemoteReplay.Android, true); + ANALYTIC_SET(UIFeatures.AndroidRemoteReplay, true); } else { - ANALYTIC_SET(UIFeatures.RemoteReplay.NonAndroid, true); + ANALYTIC_SET(UIFeatures.NonAndroidRemoteReplay, true); } m_RemoteHost = host; diff --git a/qrenderdoc/Code/qrenderdoc.cpp b/qrenderdoc/Code/qrenderdoc.cpp index ede9d470a..6bf57c3b2 100644 --- a/qrenderdoc/Code/qrenderdoc.cpp +++ b/qrenderdoc/Code/qrenderdoc.cpp @@ -348,20 +348,20 @@ int main(int argc, char *argv[]) Analytics::Prompt(ctx, config); - ANALYTIC_SET(Environment.RenderDocVersion, lit(FULL_VERSION_STRING)); + ANALYTIC_SET(Metadata.RenderDocVersion, lit(FULL_VERSION_STRING)); #if defined(DISTRIBUTION_VERSION) - ANALYTIC_SET(Environment.DistributionVersion, lit(DISTRIBUTION_NAME)); + ANALYTIC_SET(Metadata.DistributionVersion, lit(DISTRIBUTION_NAME)); #endif - ANALYTIC_SET(Environment.Bitness, ((sizeof(void *) == sizeof(uint64_t)) ? 64 : 32)); - ANALYTIC_SET(Environment.OSVersion, QSysInfo::prettyProductName()); + ANALYTIC_SET(Metadata.Bitness, ((sizeof(void *) == sizeof(uint64_t)) ? 64 : 32)); + ANALYTIC_SET(Metadata.OSVersion, QSysInfo::prettyProductName()); #if RENDERDOC_STABLE_BUILD - ANALYTIC_SET(Environment.OfficialBuildRun, true); + ANALYTIC_SET(Metadata.OfficialBuildRun, true); #else - ANALYTIC_SET(Environment.DevelBuildRun, true); + ANALYTIC_SET(Metadata.DevelBuildRun, true); #endif - ANALYTIC_SET(DaysUsed[QDateTime::currentDateTime().date().day()], true); + ANALYTIC_SET(Metadata.DaysUsed[QDateTime::currentDateTime().date().day()], true); if(!pyscripts.isEmpty()) { diff --git a/qrenderdoc/Windows/BufferViewer.cpp b/qrenderdoc/Windows/BufferViewer.cpp index 491de96fc..b309e509f 100644 --- a/qrenderdoc/Windows/BufferViewer.cpp +++ b/qrenderdoc/Windows/BufferViewer.cpp @@ -3073,11 +3073,11 @@ void BufferViewer::exportData(const BufferExport ¶ms) if(m_MeshView) { - ANALYTIC_SET(UIFeatures.Export.MeshOutput, true); + ANALYTIC_SET(Export.MeshOutput, true); } else { - ANALYTIC_SET(UIFeatures.Export.RawBuffer, true); + ANALYTIC_SET(Export.RawBuffer, true); } BufferItemModel *model = (BufferItemModel *)m_CurView->model(); diff --git a/qrenderdoc/Windows/EventBrowser.cpp b/qrenderdoc/Windows/EventBrowser.cpp index e7b5e8f3b..8d3e7bfe5 100644 --- a/qrenderdoc/Windows/EventBrowser.cpp +++ b/qrenderdoc/Windows/EventBrowser.cpp @@ -565,7 +565,7 @@ void EventBrowser::on_exportDraws_clicked() if(!filename.isEmpty()) { - ANALYTIC_SET(UIFeatures.Export.EventBrowser, true); + ANALYTIC_SET(Export.EventBrowser, true); QDir dirinfo = QFileInfo(filename).dir(); if(dirinfo.exists()) diff --git a/qrenderdoc/Windows/MainWindow.cpp b/qrenderdoc/Windows/MainWindow.cpp index a0b5d5a28..cc7b21f52 100644 --- a/qrenderdoc/Windows/MainWindow.cpp +++ b/qrenderdoc/Windows/MainWindow.cpp @@ -679,7 +679,7 @@ void MainWindow::LoadCapture(const QString &filename, bool temporary, bool local } else { - ANALYTIC_ADDUNIQ(APIsUsed, driver); + ANALYTIC_ADDUNIQ(APIs, driver); } m_Ctx.LoadCapture(fileToLoad, origFilename, temporary, local); diff --git a/qrenderdoc/Windows/PipelineState/PipelineStateViewer.cpp b/qrenderdoc/Windows/PipelineState/PipelineStateViewer.cpp index a7b34f6fd..f707fb954 100644 --- a/qrenderdoc/Windows/PipelineState/PipelineStateViewer.cpp +++ b/qrenderdoc/Windows/PipelineState/PipelineStateViewer.cpp @@ -205,7 +205,7 @@ QXmlStreamWriter *PipelineStateViewer::beginHTMLExport() if(!filename.isEmpty()) { - ANALYTIC_SET(UIFeatures.Export.PipelineState, true); + ANALYTIC_SET(Export.PipelineState, true); QDir dirinfo = QFileInfo(filename).dir(); if(dirinfo.exists()) @@ -892,7 +892,7 @@ bool PipelineStateViewer::SaveShaderFile(const ShaderReflection *shader) if(!filename.isEmpty()) { - ANALYTIC_SET(UIFeatures.Export.ShaderSave, true); + ANALYTIC_SET(Export.Shader, true); QDir dirinfo = QFileInfo(filename).dir(); if(dirinfo.exists()) diff --git a/qrenderdoc/Windows/ShaderViewer.cpp b/qrenderdoc/Windows/ShaderViewer.cpp index 30038a4ea..c3fd1deb2 100644 --- a/qrenderdoc/Windows/ShaderViewer.cpp +++ b/qrenderdoc/Windows/ShaderViewer.cpp @@ -348,15 +348,15 @@ void ShaderViewer::debugShader(const ShaderBindpointMapping *bind, const ShaderR { if(m_Stage == ShaderStage::Vertex) { - ANALYTIC_SET(UIFeatures.ShaderDebug.Vertex, true); + ANALYTIC_SET(ShaderDebug.Vertex, true); } else if(m_Stage == ShaderStage::Pixel) { - ANALYTIC_SET(UIFeatures.ShaderDebug.Pixel, true); + ANALYTIC_SET(ShaderDebug.Pixel, true); } else if(m_Stage == ShaderStage::Compute) { - ANALYTIC_SET(UIFeatures.ShaderDebug.Compute, true); + ANALYTIC_SET(ShaderDebug.Compute, true); } m_DisassemblyView->usePopUp(SC_POPUP_NEVER); diff --git a/qrenderdoc/Windows/TextureViewer.cpp b/qrenderdoc/Windows/TextureViewer.cpp index 2d899d462..482529c34 100644 --- a/qrenderdoc/Windows/TextureViewer.cpp +++ b/qrenderdoc/Windows/TextureViewer.cpp @@ -2840,7 +2840,7 @@ void TextureViewer::on_overlay_currentIndexChanged(int index) m_TexDisplay.overlay = (DebugOverlay)ui->overlay->currentIndex(); #define ANALYTICS_OVERLAY(name) \ - case DebugOverlay::name: ANALYTIC_SET(UIFeatures.TextureDebugOverlays.name, true); break; + case DebugOverlay::name: ANALYTIC_SET(TextureOverlays.name, true); break; switch(m_TexDisplay.overlay) { @@ -3387,7 +3387,7 @@ void TextureViewer::on_saveTex_clicked() if(res) { - ANALYTIC_SET(UIFeatures.Export.TextureSave, true); + ANALYTIC_SET(Export.Texture, true); bool ret = false; QString fn = saveDialog.filename();