Ver código fonte

Fixes #5909 hash file stats missing from AP stats log (#5913)

The "begin and end" markers were removed due to a merge conflict.  This restores them.
It also stops printing out sections that are empty - for example, if the AP runs without
processing anything, there will no longer be a "top 10 processed files" section.
Signed-off-by: lawsonamzn <[email protected]>
Nicholas Lawson 3 anos atrás
pai
commit
c492d644da

+ 6 - 0
Code/Tools/AssetProcessor/native/utilities/StatsCapture.cpp

@@ -132,6 +132,12 @@ namespace AssetProcessor
             // calls PrintStat on each element in the vector.
             void PrintStatsArray(AZStd::vector<AZStd::string>& keys, int maxToPrint, const char* header)
             {
+                // don't print anything out at all, not even a header, if the keys are empty.
+                if (keys.empty())
+                {
+                    return;
+                }
+
                 if ((m_dumpHumanReadableStats)&&(header))
                 {
                     AZ_TracePrintf(AssetProcessor::ConsoleChannel,"Top %i %s\n", maxToPrint, header);

+ 4 - 0
Code/Tools/AssetProcessor/native/utilities/assetUtils.cpp

@@ -1182,7 +1182,11 @@ namespace AssetUtilities
             }
         }
 
+        // keep track of how much time we spend actually hashing files.
+        AZStd::string statName = AZStd::string::format("HashFile,%s", filePath);
+        AssetProcessor::StatsCapture::BeginCaptureStat(statName.c_str());
         hash = AssetBuilderSDK::GetFileHash(filePath, bytesReadOut, hashMsDelay);
+        AssetProcessor::StatsCapture::EndCaptureStat(statName.c_str());
         return hash;
     }