Skip to content
Snippets Groups Projects
Select Git revision
  • fa45bf93574e2ee76cd2d5d4818660b1f6c899db
  • master default protected
  • L2SDP-LIFT
  • L2SDP-1113
  • HPR-158
5 results

ddrctrl.vhd

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    utils.py 667 B
    """
    common helper functions
    """
    import logging;
    from datetime import *
    import time
    
    logger = logging.getLogger(__name__)
    
    # this is a decorator that can be put in front (around) a function all to measure its execution time
    def timeit(method):
        def timed(*args, **kw):
            ts = time.time()
            result = method(*args, **kw)
            te = time.time()
            if 'log_time' in kw:
                name = kw.get('log_name', method.__name__.upper())
                kw['log_time'][name] = int((te - ts) * 1000)
            else:
                print('execution time: %r  %2.2f ms' % \
                      (method.__name__, (te - ts) * 1000))
            return result
        return timed