diff -r 672acc730ce5 -r d628defebc17 devtools/stresstester.py --- a/devtools/stresstester.py Thu May 14 10:24:56 2009 +0200 +++ b/devtools/stresstester.py Thu May 14 11:38:40 2009 +0200 @@ -5,13 +5,13 @@ OPTIONS: -h / --help Display this help message and exit. - + -u / --user Connect as instead of being prompted to give it. -p / --password Automatically give for authentication instead of being prompted to give it. - + -n / --nb-times Repeat queries times. -t / --nb-threads @@ -21,7 +21,7 @@ -o / --report-output Write profiler report into rather than on stdout -Copyright (c) 2003-2006 LOGILAB S.A. (Paris, FRANCE), all rights reserved. +Copyright (c) 2003-2009 LOGILAB S.A. (Paris, FRANCE), all rights reserved. http://www.logilab.fr/ -- mailto:contact@logilab.fr """ @@ -49,7 +49,7 @@ self._times = times self._queries = queries self._reporter = reporter - + def run(self): cursor = self._cursor times = self._times @@ -80,7 +80,7 @@ threads and can write a report that summarizes all profile informations """ profiler_lock = threading.Lock() - + def __init__(self, queries): self._queries = tuple(queries) self._profile_results = [(0., 0)] * len(self._queries) @@ -111,8 +111,8 @@ table_layout = Table(3, rheaders = True, children = table_elems) TextWriter().format(table_layout, output) # output.write('\n'.join(tmp_output)) - - + + def run(args): """run the command line tool""" try: @@ -150,7 +150,7 @@ user = raw_input('login: ') if password is None: password = getpass('password: ') - from cubicweb.cwconfig import application_configuration + from cubicweb.cwconfig import application_configuration config = application_configuration(args[0]) # get local access to the repository print "Creating repo", prof_file @@ -176,7 +176,7 @@ else: QueryExecutor(repo_cursor, repeat, queries, reporter = reporter).run() reporter.dump_report(report_output) - - + + if __name__ == '__main__': run(sys.argv[1:])