From c5a49592b1cbe19e8866e31f4727dac2e5a8dd64 Mon Sep 17 00:00:00 2001 From: "timurrrr@chromium.org" Date: Mon, 26 Jul 2010 08:55:34 +0000 Subject: Optimize memcheck_analyze.py for ui_tests by using the same log completion waiting scheme as it was before rev47547. Before 47547: memcheck_analyze.Analyze was called once for all log files. That means, wait 3 minutes max in total for logs to complete. After 47547: memcheck_analyze.Analyze is called once for each ui_test. (better logs) That means, wait 3 minutes max for each ui_test and there are many of them. (SLOW!!!) After this patch: memcheck_analyze.Analyze is called once for each ui_test. (better logs) But since AnalyzeStartTime is now global, we wait 3 minutes max in total for logs to complete. TEST=Valgrind/UI bots should become faster Review URL: http://codereview.chromium.org/3035025 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@53613 0039d316-1c4b-4281-b951-d872f2087c98 --- tools/valgrind/memcheck_analyze.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'tools/valgrind/memcheck_analyze.py') diff --git a/tools/valgrind/memcheck_analyze.py b/tools/valgrind/memcheck_analyze.py index d1db465..7388de1 100755 --- a/tools/valgrind/memcheck_analyze.py +++ b/tools/valgrind/memcheck_analyze.py @@ -24,6 +24,15 @@ import common # Global symbol table (yuck) TheAddressTable = None +# Contains the time when the we started analyzing the first log file. +# This variable is used to skip incomplete logs after some timeout. +# TODO(timurrrr): Currently, this needs to be a global variable +# because analyzer can be called multiple times (e.g. ui_tests) +# unless we re-factor the analyze system to avoid creating multiple analyzers. +AnalyzeStartTime = None + +# Max time to wait for memcheck logs to complete. +LOG_COMPLETION_TIMEOUT = 180.0 # These are functions (using C++ mangled names) that we look for in stack # traces. We don't show stack frames while pretty printing when they are below @@ -380,7 +389,10 @@ class MemcheckAnalyze: self._errors = set() self._suppcounts = {} badfiles = set() - start = time.time() + + global AnalyzeStartTime + if AnalyzeStartTime == None: + AnalyzeStartTime = time.time() self._parse_failed = False for file in files: # Wait up to three minutes for valgrind to finish writing all files, @@ -394,7 +406,8 @@ class MemcheckAnalyze: firstrun = True origsize = os.path.getsize(file) while (running and not found and - (firstrun or ((time.time() - start) < 180.0))): + (firstrun or + ((time.time() - AnalyzeStartTime) < LOG_COMPLETION_TIMEOUT))): firstrun = False f.seek(0) if pid: -- cgit v1.1