Title: [102291] trunk/Tools
- Revision
- 102291
- Author
- [email protected]
- Date
- 2011-12-07 17:50:51 -0800 (Wed, 07 Dec 2011)
Log Message
Use free memory to determine if we have space for DRT instances instead of total memory
https://bugs.webkit.org/show_bug.cgi?id=74021
Reviewed by Adam Barth.
This will hopefully make the Mac buildbots behave better.
I also reduced the expected memory needed per DRT now that
we're properly accounting for the system memory in our calculations.
* Scripts/webkitpy/common/system/platforminfo.py:
(PlatformInfo.total_bytes_memory):
(PlatformInfo._compute_free_bytes_from_vm_stat_output):
* Scripts/webkitpy/common/system/platforminfo_mock.py:
(MockPlatformInfo.total_bytes_memory):
* Scripts/webkitpy/layout_tests/port/base.py:
(Port.default_child_processes):
* Scripts/webkitpy/layout_tests/port/base_unittest.py:
(PortTest.test_default_child_processes):
Modified Paths
Diff
Modified: trunk/Tools/ChangeLog (102290 => 102291)
--- trunk/Tools/ChangeLog 2011-12-08 01:44:52 UTC (rev 102290)
+++ trunk/Tools/ChangeLog 2011-12-08 01:50:51 UTC (rev 102291)
@@ -1,3 +1,25 @@
+2011-12-07 Eric Seidel <[email protected]>
+
+ Use free memory to determine if we have space for DRT instances instead of total memory
+ https://bugs.webkit.org/show_bug.cgi?id=74021
+
+ Reviewed by Adam Barth.
+
+ This will hopefully make the Mac buildbots behave better.
+
+ I also reduced the expected memory needed per DRT now that
+ we're properly accounting for the system memory in our calculations.
+
+ * Scripts/webkitpy/common/system/platforminfo.py:
+ (PlatformInfo.total_bytes_memory):
+ (PlatformInfo._compute_free_bytes_from_vm_stat_output):
+ * Scripts/webkitpy/common/system/platforminfo_mock.py:
+ (MockPlatformInfo.total_bytes_memory):
+ * Scripts/webkitpy/layout_tests/port/base.py:
+ (Port.default_child_processes):
+ * Scripts/webkitpy/layout_tests/port/base_unittest.py:
+ (PortTest.test_default_child_processes):
+
2011-12-07 Dirk Pranke <[email protected]>
fix build-webkit --chromium after breakage in r102201
Modified: trunk/Tools/Scripts/webkitpy/common/system/platforminfo.py (102290 => 102291)
--- trunk/Tools/Scripts/webkitpy/common/system/platforminfo.py 2011-12-08 01:44:52 UTC (rev 102290)
+++ trunk/Tools/Scripts/webkitpy/common/system/platforminfo.py 2011-12-08 01:50:51 UTC (rev 102291)
@@ -27,6 +27,7 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import platform
+import re
# We use this instead of calls to platform directly to allow mocking.
@@ -49,3 +50,19 @@
if system_name == "Darwin":
return int(self._executive.run_command(["sysctl", "-n", "hw.memsize"]))
return None
+
+ def _compute_free_bytes_from_vm_stat_output(self, vm_stat_output):
+ page_size_match = re.search(r"page size of (\d+) bytes", vm_stat_output)
+ free_pages_match = re.search(r"Pages free:\s+(\d+).", vm_stat_output)
+ if not page_size_match or not free_pages_match:
+ return None
+ free_page_count = int(free_pages_match.group(1))
+ page_size = int(page_size_match.group(1))
+ return free_page_count * page_size
+
+ def free_bytes_memory(self):
+ system_name = platform.system()
+ if system_name == "Darwin":
+ vm_stat_output = self._executive.run_command(["vm_stat"])
+ return self._compute_free_bytes_from_vm_stat_output(vm_stat_output)
+ return None
Modified: trunk/Tools/Scripts/webkitpy/common/system/platforminfo_mock.py (102290 => 102291)
--- trunk/Tools/Scripts/webkitpy/common/system/platforminfo_mock.py 2011-12-08 01:44:52 UTC (rev 102290)
+++ trunk/Tools/Scripts/webkitpy/common/system/platforminfo_mock.py 2011-12-08 01:50:51 UTC (rev 102291)
@@ -33,3 +33,6 @@
def total_bytes_memory(self):
return 2 * 1024 * 1024 * 1024 # 2GB is a reasonable amount of ram to mock.
+
+ def free_bytes_memory(self):
+ return 1 * 1024 * 1024 * 1024 # 1GB is a reasonable amount of ram to mock as free.
Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/base.py (102290 => 102291)
--- trunk/Tools/Scripts/webkitpy/layout_tests/port/base.py 2011-12-08 01:44:52 UTC (rev 102290)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/base.py 2011-12-08 01:50:51 UTC (rev 102291)
@@ -166,10 +166,10 @@
"""Return the number of DumpRenderTree instances to use for this port."""
cpu_count = self._executive.cpu_count()
# Make sure we have enough ram to support that many instances:
- total_memory = self.host.platform.total_bytes_memory()
- if total_memory:
- bytes_per_drt = 400 * 1024 * 1024 # Assume each DRT needs 400MB to run.
- supportable_instances = total_memory / bytes_per_drt
+ free_memory = self.host.platform.free_bytes_memory()
+ if free_memory:
+ bytes_per_drt = 200 * 1024 * 1024 # Assume each DRT needs 200MB to run.
+ supportable_instances = free_memory / bytes_per_drt
if supportable_instances < cpu_count:
# FIXME: The Printer isn't initialized when this is called, so using _log would just show an unitialized logger error.
print "This machine could support %s child processes, but only has enough memory for %s." % (cpu_count, supportable_instances)
Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/base_unittest.py (102290 => 102291)
--- trunk/Tools/Scripts/webkitpy/layout_tests/port/base_unittest.py 2011-12-08 01:44:52 UTC (rev 102290)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/base_unittest.py 2011-12-08 01:50:51 UTC (rev 102291)
@@ -55,15 +55,17 @@
def test_default_child_processes(self):
port = self.make_port()
+ # Even though the MockPlatformInfo shows 1GB free memory (enough for 5 DRT instances)
+ # we're still limited by the 2 mock cores we have:
self.assertEqual(port.default_child_processes(), 2)
- bytes_for_drt = 400 * 1024 * 1024
+ bytes_for_drt = 200 * 1024 * 1024
- port.host.platform.total_bytes_memory = lambda: bytes_for_drt
+ port.host.platform.free_bytes_memory = lambda: bytes_for_drt
expected_stdout = "This machine could support 2 child processes, but only has enough memory for 1.\n"
child_processes = OutputCapture().assert_outputs(self, port.default_child_processes, (), expected_stdout=expected_stdout)
self.assertEqual(child_processes, 1)
- port.host.platform.total_bytes_memory = lambda: bytes_for_drt - 1
+ port.host.platform.free_bytes_memory = lambda: bytes_for_drt - 1
expected_stdout = "This machine could support 2 child processes, but only has enough memory for 0.\n"
child_processes = OutputCapture().assert_outputs(self, port.default_child_processes, (), expected_stdout=expected_stdout)
self.assertEqual(child_processes, 0)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes