summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authortonyg@chromium.org <tonyg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-19 20:13:55 +0000
committertonyg@chromium.org <tonyg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-19 20:13:55 +0000
commitb38fccb1e7d99a2e25ad77cd5ab8a61252b7ad24 (patch)
treefa49b3d18420c21a8d2dd5f6d1fb9476ba6338fa /tools
parent38f2b0095999ba43e7b5d175a3d66ca65b6a1c1f (diff)
downloadchromium_src-b38fccb1e7d99a2e25ad77cd5ab8a61252b7ad24.zip
chromium_src-b38fccb1e7d99a2e25ad77cd5ab8a61252b7ad24.tar.gz
chromium_src-b38fccb1e7d99a2e25ad77cd5ab8a61252b7ad24.tar.bz2
[Telemetry] Warm disk cache for all files used by SimpleHTTPServer.
Since switching the page cyclers to Telemetry, the first and only the first run of each page cycler has increased noise. This leads me to believe it is due to the disk cache not being warm, but I don't have a great way to test this theory. I'd like to land this change, watch the bots, and revert if it doesn't fix the new noise problem. BUG=196411 TEST=tools/perf/run_multipage_benchmarks --browser=system page_cycler tools/perf/page_sets/page_cycler/moz.json NOTRY=True Review URL: https://codereview.chromium.org/12574011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@189077 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools')
-rw-r--r--tools/telemetry/telemetry/core/temporary_http_server.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/tools/telemetry/telemetry/core/temporary_http_server.py b/tools/telemetry/telemetry/core/temporary_http_server.py
index d985e90..798eca1 100644
--- a/tools/telemetry/telemetry/core/temporary_http_server.py
+++ b/tools/telemetry/telemetry/core/temporary_http_server.py
@@ -22,6 +22,7 @@ class TemporaryHTTPServer(object):
assert os.path.isdir(path), path
self._devnull = open(os.devnull, 'w')
+ self._WarmDiskCache()
self._server = subprocess.Popen(
[sys.executable, '-m', 'SimpleHTTPServer', str(self._host_port)],
cwd=self._path,
@@ -48,6 +49,18 @@ class TemporaryHTTPServer(object):
def __del__(self):
self.Close()
+ def _WarmDiskCache(self):
+ """Warm the disk cache for all files in self._path. This decreases the
+ likelyhood of disk paging at serving time.
+ """
+ for root, _, files in os.walk(self._path):
+ for f in files:
+ file_path = os.path.join(root, f)
+ if not os.path.exists(file_path): # Allow for '.#' files
+ continue
+ with open(file_path, 'r') as fd:
+ self._devnull.write(fd.read())
+
def Close(self):
if self._forwarder:
self._forwarder.Close()