From ed9a0833659f3348a61fb627c90567cceafbd7d4 Mon Sep 17 00:00:00 2001 From: "pam@chromium.org" Date: Wed, 9 Sep 2009 22:48:55 +0000 Subject: [PATCH] Report computation time before showing a prompt, so the response time isn't included in the calculation. BUG=none TEST=submit change with presubmit warning, note reported time git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@25806 0039d316-1c4b-4281-b951-d872f2087c98 --- presubmit_support.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/presubmit_support.py b/presubmit_support.py index 05ef8ffda..78dae3093 100755 --- a/presubmit_support.py +++ b/presubmit_support.py @@ -866,6 +866,11 @@ def DoPresubmitChecks(change, may_prompt=False): error_count += 1 output_stream.write('\n') + + total_time = time.time() - start_time + if total_time > 1.0: + print "Presubmit checks took %.1fs to calculate." % total_time + if not errors and warnings and may_prompt: output_stream.write( 'There were presubmit warnings. Sure you want to continue? (y/N): ') @@ -873,9 +878,6 @@ def DoPresubmitChecks(change, if response.strip().lower() != 'y': error_count += 1 - total_time = time.time() - start_time - if total_time > 1.0: - print "Presubmit checks took %.1fs to calculate." % total_time global _ASKED_FOR_FEEDBACK # Ask for feedback one time out of 5. if (len(results) and random.randint(0, 4) == 0 and not _ASKED_FOR_FEEDBACK):