diff options
author | Zachary Sloan | 2013-02-28 23:59:12 +0000 |
---|---|---|
committer | Zachary Sloan | 2013-02-28 23:59:12 +0000 |
commit | f65a92de7c65e6528c5d01117c202401f7681ab0 (patch) | |
tree | fef1de2c5568ba43b5abe526f414f58ddf4108c9 /wqflask | |
parent | fa4c4f116c37285d24edc9532bb223e18dfb1584 (diff) | |
download | genenetwork2-f65a92de7c65e6528c5d01117c202401f7681ab0.tar.gz |
Updated benchmark.py to aggregate run times when you run the
operation(s) multiple times
Diffstat (limited to 'wqflask')
-rw-r--r-- | wqflask/utility/benchmark.py | 19 | ||||
-rw-r--r-- | wqflask/wqflask/static/new/css/marker_regression.css | 2 | ||||
-rw-r--r-- | wqflask/wqflask/views.py | 1 |
3 files changed, 12 insertions, 10 deletions
diff --git a/wqflask/utility/benchmark.py b/wqflask/utility/benchmark.py index 0a6e422c..182187ae 100644 --- a/wqflask/utility/benchmark.py +++ b/wqflask/utility/benchmark.py @@ -7,6 +7,7 @@ import time class Bench(object): entries = collections.OrderedDict() + def __init__(self, name=None): self.name = name @@ -23,20 +24,22 @@ class Bench(object): else: name = "That" - time_took = time.time() - self.start_time - print(" %s took: %f seconds" % (name, (time_took))) + time_taken = time.time() - self.start_time + print(" %s took: %f seconds" % (name, (time_taken))) if self.name: - Bench.entries[self.name] = time_took + Bench.entries[self.name] = Bench.entries.get(self.name, 0) + time_taken + @classmethod def report(cls): - total_time = sum((time_took for time_took in cls.entries.itervalues())) + total_time = sum((time_taken for time_taken in cls.entries.itervalues())) print("\nTiming report\n") - for name, time_took in cls.entries.iteritems(): - percent = int(round((time_took/total_time) * 100)) - print("[{}%] {}: {}".format(percent, name, time_took)) + for name, time_taken in cls.entries.iteritems(): + percent = int(round((time_taken/total_time) * 100)) + print("[{}%] {}: {}".format(percent, name, time_taken)) print() - # Reset the entries after reporting + def reset(cls): + """Reset the entries""" cls.entries = collections.OrderedDict()
\ No newline at end of file diff --git a/wqflask/wqflask/static/new/css/marker_regression.css b/wqflask/wqflask/static/new/css/marker_regression.css index 82d7071c..054ef93e 100644 --- a/wqflask/wqflask/static/new/css/marker_regression.css +++ b/wqflask/wqflask/static/new/css/marker_regression.css @@ -23,7 +23,7 @@ rect { stroke: WhiteSmoke; - fill: grey; + fill: lightgrey; } /*rect { stroke: WhiteSmoke; diff --git a/wqflask/wqflask/views.py b/wqflask/wqflask/views.py index 5f2df8a4..9a250434 100644 --- a/wqflask/wqflask/views.py +++ b/wqflask/wqflask/views.py @@ -33,7 +33,6 @@ from pprint import pformat as pf @app.before_request def connect_db(): - print("blue app.config:", app.config, pf(vars(app.config))) g.db = sqlalchemy.create_engine(app.config['DB_URI']) @app.route("/") |