diff options
author | maruel@chromium.org <maruel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-29 17:25:34 +0000 |
---|---|---|
committer | maruel@chromium.org <maruel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-29 17:25:34 +0000 |
commit | cb155a802bdc49cfafea1c41e0f0a92168f1da09 (patch) | |
tree | bf0fae4855c7f4458d8e959455b9d12d6cd54d9d /tools/python/google/gethash_timer.py | |
parent | 9bec23957253b83955c4096903ad6293d1c6e1bb (diff) | |
download | chromium_src-cb155a802bdc49cfafea1c41e0f0a92168f1da09.zip chromium_src-cb155a802bdc49cfafea1c41e0f0a92168f1da09.tar.gz chromium_src-cb155a802bdc49cfafea1c41e0f0a92168f1da09.tar.bz2 |
Fix python scripts in src/tools/
Make sure that:
- shebang is only present for executable files
- shebang is #!/usr/bin/env python
- __main__ is only present for executable files
- file's executable bit is coherent
Also fix EOF LF to be only one.
TBR=timurrrr@chromium.org
BUG=105108
TEST=
Review URL: http://codereview.chromium.org/8678023
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@111960 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools/python/google/gethash_timer.py')
-rwxr-xr-x[-rw-r--r--] | tools/python/google/gethash_timer.py | 47 |
1 files changed, 26 insertions, 21 deletions
diff --git a/tools/python/google/gethash_timer.py b/tools/python/google/gethash_timer.py index e59690b..9c4bd46 100644..100755 --- a/tools/python/google/gethash_timer.py +++ b/tools/python/google/gethash_timer.py @@ -1,24 +1,25 @@ -#!/usr/bin/python -# Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +#!/usr/bin/env python +# Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -# Issue a series of GetHash requests to the SafeBrowsing servers and measure the -# response times. -# -# Usage: -# -# $ ./gethash_timer.py --period=600 --samples=20 --output=resp.csv -# -# --period (or -p): The amount of time (in seconds) to wait between GetHash -# requests. Using a value of more than 300 (5 minutes) to -# include the effect of DNS. -# -# --samples (or -s): The number of requests to issue. If this parameter is not -# specified, the test will run indefinitely. -# -# --output (or -o): The path to a file where the output will be written in -# CSV format: sample_number,response_code,elapsed_time_ms +"""Issue a series of GetHash requests to the SafeBrowsing servers and measure +the response times. + +Usage: + + $ ./gethash_timer.py --period=600 --samples=20 --output=resp.csv + + --period (or -p): The amount of time (in seconds) to wait between GetHash + requests. Using a value of more than 300 (5 minutes) to + include the effect of DNS. + + --samples (or -s): The number of requests to issue. If this parameter is not + specified, the test will run indefinitely. + + --output (or -o): The path to a file where the output will be written in + CSV format: sample_number,response_code,elapsed_time_ms +""" import getopt import httplib @@ -26,7 +27,8 @@ import sys import time _GETHASH_HOST = 'safebrowsing.clients.google.com' -_GETHASH_REQUEST = '/safebrowsing/gethash?client=googleclient&appver=1.0&pver=2.1' +_GETHASH_REQUEST = ( + '/safebrowsing/gethash?client=googleclient&appver=1.0&pver=2.1') # Global logging file handle. g_file_handle = None @@ -115,7 +117,7 @@ def SetupOutputFile(file_name): g_file_handle = open(file_name, 'w') -if __name__ == '__main__': +def main(): period = 10 samples = None @@ -131,7 +133,7 @@ if __name__ == '__main__': file_name = value else: print 'Bad option: %s' % option - sys.exit(1) + return 1 try: print 'Starting Timed GetHash ----------' SetupOutputFile(file_name) @@ -142,3 +144,6 @@ if __name__ == '__main__': print 'Timed GetHash complete ----------' g_file_handle.close() + +if __name__ == '__main__': + sys.exit(main()) |