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

Unified Diff: chrome/common/extensions/docs/server2/preview.py

Issue 13599004: Fix some low hanging inefficiencies in the docs server (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years, 8 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 | « chrome/common/extensions/docs/server2/object_store_creator_test.py ('k') | tools/json_comment_eater.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/extensions/docs/server2/preview.py
diff --git a/chrome/common/extensions/docs/server2/preview.py b/chrome/common/extensions/docs/server2/preview.py
index 9917f5fe7b7abe00dfb190dbee7b95fde3b45982..a1d0e64d44ce24de8b1a55bbeeeefd987094d256 100755
--- a/chrome/common/extensions/docs/server2/preview.py
+++ b/chrome/common/extensions/docs/server2/preview.py
@@ -34,6 +34,7 @@ import os
import shutil
from StringIO import StringIO
import sys
+import time
import urlparse
import build_server
@@ -96,6 +97,8 @@ if __name__ == '__main__':
'the server, e.g. apps/storage.html. The path may optionally end '
'with #n where n is the number of times to render the page before '
'printing it, e.g. apps/storage.html#50, to use for profiling.')
+ parser.add_option('-t', '--time', action='store_true',
+ help='Print the time taken rendering rather than the result.')
(opts, argv) = parser.parse_args()
@@ -117,6 +120,9 @@ if __name__ == '__main__':
path = opts.render
extra_iterations = 0
+ if opts.time:
+ start_time = time.time()
+
content, status, headers = _Render(path)
if status in [301, 302]:
# Handle a single level of redirection.
@@ -130,9 +136,12 @@ if __name__ == '__main__':
for _ in range(extra_iterations):
_Render(path)
- # Static paths will show up as /stable/static/foo but this only makes sense
- # from a webserver.
- print(content.replace('/stable/static', 'static'))
+ if opts.time:
+ print('Took %s seconds' % (time.time() - start_time))
+ else:
+ # Static paths will show up as /stable/static/foo but this only makes
+ # sense from a webserver.
+ print(content.replace('/stable/static', 'static'))
exit()
print('Starting previewserver on port %s' % opts.port)
« no previous file with comments | « chrome/common/extensions/docs/server2/object_store_creator_test.py ('k') | tools/json_comment_eater.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698