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

Unified Diff: gclient.py

Issue 18851005: Print time of long running hook actions (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Pretty print command, escape for shells. Created 7 years, 5 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 | gclient_utils.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gclient.py
diff --git a/gclient.py b/gclient.py
index d61540233362b4581ba8b5f7367f2560b8c57826..ed08e47f423cb96bbd6ba9c9ca2902cbc394cc62 100755
--- a/gclient.py
+++ b/gclient.py
@@ -81,6 +81,7 @@ import posixpath
import pprint
import re
import sys
+import time
import urllib
import urlparse
@@ -780,6 +781,7 @@ class Dependency(gclient_utils.WorkItem, DependencySettings):
self._hooks_ran = True
for hook in self.GetHooks(options):
try:
+ start_time = time.time()
gclient_utils.CheckCallAndFilterAndHeader(
hook, cwd=self.root.root_dir, always=True)
except (gclient_utils.Error, subprocess2.CalledProcessError), e:
@@ -788,6 +790,11 @@ class Dependency(gclient_utils.WorkItem, DependencySettings):
# differently from VC failures.
print >> sys.stderr, 'Error: %s' % str(e)
sys.exit(2)
+ finally:
+ elapsed_time = time.time() - start_time
+ if elapsed_time > 10:
+ print "Hook '%s' took %.2f secs" % (
+ gclient_utils.CommandToStr(hook), elapsed_time)
def subtree(self, include_all):
"""Breadth first recursion excluding root node."""
« no previous file with comments | « no previous file | gclient_utils.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698