Beispiel #1
0
    def format(self, record):
        """pretify the log output, annotate with simulation time"""
        if record.args: msg = record.msg % record.args
        else:           msg = record.msg

        msg = str(msg)
        level = record.levelname.ljust(_LEVEL_CHARS)
        timeh, timel = simulator.get_sim_time()

        return self._format(timeh, timel, level, record, msg)
Beispiel #2
0
    def format(self, record):
        """pretify the log output, annotate with simulation time"""

        if record.args: msg = record.msg % record.args
        else:           msg = record.msg

        msg = SimColourLogFormatter.loglevel2colour[record.levelno] % msg
        level = SimColourLogFormatter.loglevel2colour[record.levelno] % \
                                        record.levelname.ljust(_LEVEL_CHARS)

        timeh, timel = simulator.get_sim_time()
        return self._format(timeh, timel, level, record, msg)
Beispiel #3
0
def get_sim_time(units=None):
    """Retrieves the simulation time from the simulator

    Kwargs:
        units (str):  String specifying the units of the result. (None,'fs','ps','ns','us','ms','sec')
                      None will return the raw simulation time.

    Returns:
        The simulation time in the specified units
    """
    timeh, timel = simulator.get_sim_time()

    result = (timeh << 32 | timel)

    if units is not None:
        result = get_time_from_sim_steps(result, units)

    return result
Beispiel #4
0
def get_sim_time(units=None):
    """Retrieves the simulation time from the simulator

    Kwargs:
        units (str):  String specifying the units of the result. (None,'fs','ps','ns','us','ms','sec')
                      None will return the raw simulation time.

    Returns:
        The simulation time in the specified units
    """
    timeh, timel = simulator.get_sim_time()

    result = (timeh << 32 | timel)

    if units is not None:
        result = get_time_from_sim_steps(result, units)

    return result
Beispiel #5
0
def get_sim_time(units=None):
    """Retrieves the simulation time from the simulator.

    Args:
        units (str or None, optional): String specifying the units of the result
            (one of ``None``, ``'fs'``, ``'ps'``, ``'ns'``, ``'us'``, ``'ms'``, ``'sec'``).
            ``None`` will return the raw simulation time.

    Returns:
        The simulation time in the specified units.
    """
    timeh, timel = simulator.get_sim_time()

    result = (timeh << 32 | timel)

    if units is not None:
        result = get_time_from_sim_steps(result, units)

    return result
Beispiel #6
0
def get_sim_time(units=None):
    """Retrieves the simulation time from the simulator.

    Args:
        units (str or None, optional): String specifying the units of the result
            (one of ``None``, ``'fs'``, ``'ps'``, ``'ns'``, ``'us'``, ``'ms'``, ``'sec'``).
            ``None`` will return the raw simulation time.

    Returns:
        The simulation time in the specified units.
    """
    timeh, timel = simulator.get_sim_time()

    result = (timeh << 32 | timel)

    if units is not None:
        result = get_time_from_sim_steps(result, units)

    return result