Added debug timer
This commit is contained in:
parent
aa9f621476
commit
cb7fe593bf
1 changed files with 12 additions and 0 deletions
|
|
@ -5,10 +5,22 @@ import base64
|
|||
from uuid import UUID
|
||||
import numpy as np
|
||||
import logging
|
||||
import time
|
||||
from collections import abc
|
||||
from functools import reduce
|
||||
from contextlib import contextmanager
|
||||
|
||||
class Timer(object):
|
||||
def __init__(self, name):
|
||||
self.name = name
|
||||
self.start = None
|
||||
self.end = None
|
||||
def __enter__(self):
|
||||
self.start = time.time()
|
||||
def __exit__(self, type, value, traceback):
|
||||
self.end = time.time()
|
||||
logging.debug(f"{self.name} time: {self.end - self.start}")
|
||||
|
||||
|
||||
def deserialise_array_b64(b64_string, dtype, shape):
|
||||
flat_arr = np.fromstring(base64.b64decode(b64_string), dtype)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue