aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMunyoki Kilyungi2022-08-30 11:40:47 +0300
committerBonfaceKilz2022-08-31 23:14:30 +0300
commit2d9ad72cf8078610fc2cff8726e68a40dcf64685 (patch)
treedf7db9dd709b6dfc92c868cb3ef70c821e3f2a27
parent9d0f492d8a999c1a3eb6525b0ae72bbbcaad4279 (diff)
downloadgenenetwork2-2d9ad72cf8078610fc2cff8726e68a40dcf64685.tar.gz
Delete benchmark module
* wqflask/utility/benchmark.py: Delete module.
-rw-r--r--wqflask/utility/benchmark.py52
1 files changed, 0 insertions, 52 deletions
diff --git a/wqflask/utility/benchmark.py b/wqflask/utility/benchmark.py
deleted file mode 100644
index 6ece2f21..00000000
--- a/wqflask/utility/benchmark.py
+++ /dev/null
@@ -1,52 +0,0 @@
-import collections
-import inspect
-import time
-from utility.tools import LOG_BENCH
-
-from utility.logger import getLogger
-logger = getLogger(__name__)
-
-
-class Bench:
- entries = collections.OrderedDict()
-
- def __init__(self, name=None, write_output=LOG_BENCH):
- self.name = name
- self.write_output = write_output
-
- def __enter__(self):
- if self.write_output:
- if self.name:
- logger.debug("Starting benchmark: %s" % (self.name))
- else:
- logger.debug("Starting benchmark at: %s [%i]" % (
- inspect.stack()[1][3], inspect.stack()[1][2]))
- self.start_time = time.time()
-
- def __exit__(self, type, value, traceback):
- time_taken = time.time() - self.start_time
- if self.write_output:
- if self.name:
- name = self.name
- else:
- name = "That"
-
- logger.info(" %s took: %f seconds" % (name, (time_taken)))
-
- if self.name:
- Bench.entries[self.name] = Bench.entries.get(
- self.name, 0) + time_taken
-
- @classmethod
- def report(cls):
- total_time = sum(
- (time_taken for time_taken in list(cls.entries.values())))
- print("\nTiming report\n")
- for name, time_taken in list(cls.entries.items()):
- percent = int(round((time_taken / total_time) * 100))
- print("[{}%] {}: {}".format(percent, name, time_taken))
- print()
-
- def reset(cls):
- """Reset the entries"""
- cls.entries = collections.OrderedDict()