Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(299)

Unified Diff: presubmit_support.py

Issue 174163: Print out how long presubmit checks took if it's more than 1 second. (Closed) Base URL: svn://chrome-svn/chrome/trunk/tools/depot_tools/
Patch Set: Created 11 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: presubmit_support.py
===================================================================
--- presubmit_support.py (revision 23862)
+++ presubmit_support.py (working copy)
@@ -27,6 +27,7 @@
import subprocess # Exposed through the API.
import sys # Parts exposed through API.
import tempfile # Exposed through the API.
+import time
import traceback # Exposed through the API.
import types
import unittest # Exposed through the API.
@@ -811,6 +812,7 @@
Return:
True if execution can continue, False if not.
"""
+ start_time = time.time()
presubmit_files = ListRelevantPresubmitFiles(change.AbsoluteLocalPaths(True),
change.RepositoryRoot())
if not presubmit_files and verbose:
@@ -859,6 +861,9 @@
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):
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698