Title: [286562] trunk/PerformanceTests
Revision
286562
Author
[email protected]
Date
2021-12-06 13:01:35 -0800 (Mon, 06 Dec 2021)

Log Message

[RAMification] Add support for dumping smaps rollups on Linux
https://bugs.webkit.org/show_bug.cgi?id=233867

Patch by Zan Dobersek <[email protected]> on 2021-12-06
Reviewed by Yusuke Suzuki.

Add the option to dump smaps rollup after the end of each RAMification
test case. This mirrors the vmmap functionality and is implemented
alongside that option.

Once the jsc binary is left idle after the test case run, the
smaps_rollup output for the given jsc process is collected from the
proc filesystem. This material is then printed out after the test
is done, following the memory footprint dump.

For now this prefers the smaps_rollup instead of the complete smaps.
In this form, it already gives a good insight into the balance between
the proportional and residential set size amounts. Complete smaps could
be beneficial later, especially if we can implement differentiation
between allocations of different types and/or purposes.

* JetStream2/RAMification.py:
(parseArgs):
(BaseRunner.__init__):
(BaseRunner.getResults):
(LocalRunner.runOneTest):
(main):
(main.runTestList):

Modified Paths

Diff

Modified: trunk/PerformanceTests/ChangeLog (286561 => 286562)


--- trunk/PerformanceTests/ChangeLog	2021-12-06 20:52:54 UTC (rev 286561)
+++ trunk/PerformanceTests/ChangeLog	2021-12-06 21:01:35 UTC (rev 286562)
@@ -1,3 +1,33 @@
+2021-12-06  Zan Dobersek  <[email protected]>
+
+        [RAMification] Add support for dumping smaps rollups on Linux
+        https://bugs.webkit.org/show_bug.cgi?id=233867
+
+        Reviewed by Yusuke Suzuki.
+
+        Add the option to dump smaps rollup after the end of each RAMification
+        test case. This mirrors the vmmap functionality and is implemented
+        alongside that option.
+
+        Once the jsc binary is left idle after the test case run, the
+        smaps_rollup output for the given jsc process is collected from the
+        proc filesystem. This material is then printed out after the test
+        is done, following the memory footprint dump.
+
+        For now this prefers the smaps_rollup instead of the complete smaps.
+        In this form, it already gives a good insight into the balance between
+        the proportional and residential set size amounts. Complete smaps could
+        be beneficial later, especially if we can implement differentiation
+        between allocations of different types and/or purposes.
+
+        * JetStream2/RAMification.py:
+        (parseArgs):
+        (BaseRunner.__init__):
+        (BaseRunner.getResults):
+        (LocalRunner.runOneTest):
+        (main):
+        (main.runTestList):
+
 2021-11-21  Cathie Chen  <[email protected]>
 
         [Performance test][css-contain] Add case to test contain: layout inside a complex document

Modified: trunk/PerformanceTests/JetStream2/RAMification.py (286561 => 286562)


--- trunk/PerformanceTests/JetStream2/RAMification.py	2021-12-06 20:52:54 UTC (rev 286561)
+++ trunk/PerformanceTests/JetStream2/RAMification.py	2021-12-06 21:01:35 UTC (rev 286562)
@@ -43,7 +43,7 @@
 footprintRE = re.compile(r"Current Footprint: (\d+(?:.\d+)?)")
 peakFootprintRE = re.compile(r"Peak Footprint: (\d+(?:.\d+)?)")
 
-TestResult = collections.namedtuple("TestResult", ["name", "returnCode", "footprint", "peakFootprint", "vmmapOutput"])
+TestResult = collections.namedtuple("TestResult", ["name", "returnCode", "footprint", "peakFootprint", "vmmapOutput", "smapsOutput"])
 
 ramification_dir = os.path.abspath(os.path.dirname(os.path.realpath(__file__)))
 
@@ -121,6 +121,7 @@
     parser.add_argument("-n", "--run-no-jit", dest="runNoJITTests", nargs="?", const=True, default=None, type=optStrToBool, metavar="true / false", help="Run no JIT tests [default]")
     parser.add_argument("-o", "--output", dest="jsonFilename", type=str, default=None, metavar="JSON-output-file", help="Path to JSON output")
     parser.add_argument("-m", "--vmmap", dest="takeVmmap", action="" default=False, help="Take a vmmap after each test")
+    parser.add_argument("--smaps", dest="takeSmaps", action="" default=False, help="Take a smaps rollup after each test")
 
     args = parser.parse_args()
 
@@ -147,7 +148,8 @@
     def __init__(self, args):
         self.rootDir = args.testDir
         self.environmentVars = {}
-        self.vmmapOutput = ""
+        self.vmmapOutput = "" if args.takeVmmap else None
+        self.smapsOutput = "" if args.takeSmaps else None
 
     def setup(self):
         pass
@@ -180,7 +182,7 @@
         self.returnCode = returnCode
 
     def getResults(self):
-        return TestResult(name=self.testName, returnCode=self.returnCode, footprint=self.footprint, peakFootprint=self.peakFootprint, vmmapOutput=self.vmmapOutput)
+        return TestResult(name=self.testName, returnCode=self.returnCode, footprint=self.footprint, peakFootprint=self.peakFootprint, vmmapOutput=self.vmmapOutput, smapsOutput=self.smapsOutput)
 
 
 class LocalRunner(BaseRunner):
@@ -211,9 +213,12 @@
             self.processLine(line)
 
             if "js shell waiting for input to exit" in line:
-                self.vmmapOutput = subprocess.Popen(['vmmap', '--summary', '{}'.format(proc.pid)], shell=False, stderr=subprocess.PIPE, stdout=subprocess.PIPE).stdout.read()
-                if sys.version_info[0] >= 3:
-                    self.vmmapOutput = str(self.vmmapOutput, "utf-8")
+                if self.vmmapOutput is not None:
+                    self.vmmapOutput = subprocess.Popen(['vmmap', '--summary', '{}'.format(proc.pid)], shell=False, stderr=subprocess.PIPE, stdout=subprocess.PIPE).stdout.read()
+                    if sys.version_info[0] >= 3:
+                        self.vmmapOutput = str(self.vmmapOutput, "utf-8")
+                if self.smapsOutput is not None:
+                    self.smapsOutput = subprocess.Popen(['cat', '/proc/{}/smaps_rollup'.format(proc.pid)], shell=False, stderr=subprocess.PIPE, stdout=subprocess.PIPE).stdout.read()
                 proc.stdin.write(b"done\n")
                 proc.stdin.flush()
 
@@ -235,8 +240,7 @@
 
     testRunner = args.runner(args)
 
-
-    if args.takeVmmap:
+    if args.takeVmmap or args.takeSmaps:
         testRunner.setEnv("JS_SHELL_WAIT_FOR_INPUT_TO_EXIT", "1")
 
     dyldFrameworkPath = frameworkPathFromExecutablePath(args.jscCommand)
@@ -270,6 +274,8 @@
                     print("footprint: {}, peak footprint: {}".format(testResult.footprint, testResult.peakFootprint))
                     if testResult.vmmapOutput:
                         print(testResult.vmmapOutput)
+                    if testResult.smapsOutput:
+                        print(testResult.smapsOutput)
                 else:
                     print
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to