Bug 1068280 - If there are multiple bloat views in a single leak log, use the largest one. r=jmaher
authorAndrew McCreight <continuation@gmail.com>
Mon, 22 Sep 2014 11:07:46 -0700
changeset 206578 caadbd3acebfb80ce78c01825780c9dba91d4ad8
parent 206577 77995516ba17d01f6db4e3d4d59f9266161724de
child 206579 40d6ccba44f1610b61a84dbe9acd08f472907991
push id27532
push userkwierso@gmail.com
push dateTue, 23 Sep 2014 01:57:26 +0000
treeherdermozilla-central@790f41c631cc [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjmaher
bugs1068280
milestone35.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1068280 - If there are multiple bloat views in a single leak log, use the largest one. r=jmaher
build/automationutils.py
--- a/build/automationutils.py
+++ b/build/automationutils.py
@@ -207,17 +207,19 @@ def processSingleLeakFile(leakLogFileNam
                       r"(?P<size>-?\d+)\s+(?P<bytesLeaked>-?\d+)\s+"
                       r"-?\d+\s+(?P<numLeaked>-?\d+)")
 
   processString = " %s process:" % processType
   crashedOnPurpose = False
   totalBytesLeaked = None
   logAsWarning = False
   leakAnalysis = []
+  leakedObjectAnalysis = []
   leakedObjectNames = []
+  recordLeakedObjects = False
   with open(leakLogFileName, "r") as leaks:
     for line in leaks:
       if line.find("purposefully crash") > -1:
         crashedOnPurpose = True
       matches = lineRe.match(line)
       if not matches:
         # eg: the leak table header row
         log.info(line.rstrip())
@@ -227,26 +229,43 @@ def processSingleLeakFile(leakLogFileNam
       bytesLeaked = int(matches.group("bytesLeaked"))
       numLeaked = int(matches.group("numLeaked"))
       # Output the raw line from the leak log table if it is the TOTAL row,
       # or is for an object row that has been leaked.
       if numLeaked != 0 or name == "TOTAL":
         log.info(line.rstrip())
       # Analyse the leak log, but output later or it will interrupt the leak table
       if name == "TOTAL":
-        totalBytesLeaked = bytesLeaked
+        # Multiple default processes can end up writing their bloat views into a single
+        # log, particularly on B2G. Eventually, these should be split into multiple
+        # logs (bug 1068869), but for now, we report the largest leak.
+        if totalBytesLeaked != None:
+          leakAnalysis.append("WARNING | leakcheck |%s multiple BloatView byte totals found"
+                              % processString)
+        else:
+          totalBytesLeaked = 0
+        if bytesLeaked > totalBytesLeaked:
+          totalBytesLeaked = bytesLeaked
+          # Throw out the information we had about the previous bloat view.
+          leakedObjectNames = []
+          leakedObjectAnalysis = []
+          recordLeakedObjects = True
+        else:
+          recordLeakedObjects = False
       if size < 0 or bytesLeaked < 0 or numLeaked < 0:
         leakAnalysis.append("TEST-UNEXPECTED-FAIL | leakcheck |%s negative leaks caught!"
                             % processString)
         logAsWarning = True
         continue
-      if name != "TOTAL" and numLeaked != 0:
+      if name != "TOTAL" and numLeaked != 0 and recordLeakedObjects:
         leakedObjectNames.append(name)
-        leakAnalysis.append("TEST-INFO | leakcheck |%s leaked %d %s (%s bytes)"
-                            % (processString, numLeaked, name, bytesLeaked))
+        leakedObjectAnalysis.append("TEST-INFO | leakcheck |%s leaked %d %s (%s bytes)"
+                                    % (processString, numLeaked, name, bytesLeaked))
+
+  leakAnalysis.extend(leakedObjectAnalysis)
   if logAsWarning:
     log.warning('\n'.join(leakAnalysis))
   else:
     log.info('\n'.join(leakAnalysis))
 
   logAsWarning = False
 
   if totalBytesLeaked is None: