Commit 43b9910f authored by ilevy@chromium.org's avatar ilevy@chromium.org

Only call SendProfile() on slow commands

Reduce calling SendProfile to long running commands. There's lots of low hanging fruit (slow commands) to optimize before we need perf stats from fast commands.

R=maruel@chromium.org
BUG=

Review URL: https://chromiumcodereview.appspot.com/11416230

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@170009 0039d316-1c4b-4281-b951-d872f2087c98
parent 8ef7ab25
...@@ -106,12 +106,12 @@ def SendStack(last_tb, stack, url=None, maxlen=50, verbose=True): ...@@ -106,12 +106,12 @@ def SendStack(last_tb, stack, url=None, maxlen=50, verbose=True):
p(post(url or DEFAULT_URL + '/breakpad', params)) p(post(url or DEFAULT_URL + '/breakpad', params))
def SendProfiling(url=None): def SendProfiling(duration, url=None):
params = { params = {
'argv': ' '.join(sys.argv), 'argv': ' '.join(sys.argv),
# Strip the hostname. # Strip the hostname.
'domain': _HOST_NAME.split('.', 1)[-1], 'domain': _HOST_NAME.split('.', 1)[-1],
'duration': time.time() - _TIME_STARTED, 'duration': duration,
'platform': sys.platform, 'platform': sys.platform,
} }
post(url or DEFAULT_URL + '/profiling', params) post(url or DEFAULT_URL + '/profiling', params)
...@@ -126,7 +126,9 @@ def CheckForException(): ...@@ -126,7 +126,9 @@ def CheckForException():
if last_tb: if last_tb:
SendStack(last_value, ''.join(traceback.format_tb(last_tb))) SendStack(last_value, ''.join(traceback.format_tb(last_tb)))
else: else:
SendProfiling() duration = time.time() - _TIME_STARTED
if duration > 90:
SendProfiling(duration)
def Register(): def Register():
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment