Пример #1
0
def loglevel(request):
    level = max(40 - request.config.option.verbose * 10, 10)
    if sys.stdout.isatty():
        # enable console logging
        from switchy import utils
        utils.log_to_stderr(level)

    return level
Пример #2
0
def pytest_configure(config):
    if sys.stdout.isatty():
        # enable console logging
        from switchy import utils
        utils.log_to_stderr(max(40 - config.option.verbose * 10, 10))
Пример #3
0
        rates[rates > 300] = 300
        return rates

    @property
    def wm_rate(self):
        '''The rolling average call rate windowed over 100 calls
        '''
        return moving_avg(self.inst_rate, n=100)


try:
    from mpl_helpers import multiplot
except ImportError:
    log = utils.get_logger()
    if not log.handlers:
        utils.log_to_stderr()
    log.warn(
        "Matplotlib must be installed for graphing support"
    )
else:
    def plot(self, block=False):
            view = self.view
            view.sort(order='time')  # sort array by time stamp
            self.mng, self.fig, self.artists = multiplot(view, fieldspec=[
                ('time', None),  # this field will not be plotted
                # latencies
                ('answer_latency', (1, 1)),
                ('call_setup_latency', (1, 1)),
                ('invite_latency', (1, 1)),
                ('originate_latency', (1, 1)),
                ('originate_to_invite_latency', (1, 1)),
Пример #4
0
import signal
import atexit
import itertools
from collections import OrderedDict, deque
from contextlib import contextmanager
import tempfile
import csv
import os
from switchy import utils
import multiprocessing as mp
import time

try:
    import pandas as pd
except ImportError as ie:
    utils.log_to_stderr().warn(str(ie))
    pd = None
else:
    from . import shmarray
    # use the entire screen width + wrapping when viewing frames in the console
    pd.set_option('display.expand_frame_repr', False)


# app names should generally be shorter then this...
min_size = 30


def moving_avg(x, n=100):
    '''Compute the windowed arithmetic mean of `x` with window length `n`
    '''
    n = min(x.size, n)
Пример #5
0
def pytest_configure(config):
    if sys.stdout.isatty():
        # enable console logging
        from switchy import utils
        utils.log_to_stderr(max(40 - config.option.verbose * 10, 10))
Пример #6
0
        rates[rates > 300] = 300
        return rates

    @property
    def wm_rate(self):
        '''The rolling average call rate windowed over 100 calls
        '''
        return moving_avg(self.inst_rate, n=100)


try:
    from mpl_helpers import multiplot
except ImportError:
    log = utils.get_logger()
    if not log.handlers:
        utils.log_to_stderr()
    log.warn("Matplotlib must be installed for graphing support")
else:

    def plot(self, block=False):
        view = self.view
        view.sort(order='time')  # sort array by time stamp
        self.mng, self.fig, self.artists = multiplot(
            view,
            fieldspec=[
                ('time', None),  # this field will not be plotted
                # latencies
                ('answer_latency', (1, 1)),
                ('call_setup_latency', (1, 1)),
                ('invite_latency', (1, 1)),
                ('originate_latency', (1, 1)),