Beispiel #1
0
    def data_event(self, executor):
        self.logger.debug("Event received")

        if executor.terminated:
            self._push_to_db(executor)
        else:
            workload = '.'.join(executor.current_workload.split('.')[1:6])
            if 'metrics' not in executor.metadata:
                executor.metadata['metrics'] = {}

            steady_state = True
            metrics = {}
            for metric in ('lat_ns.mean', 'iops', 'bw'):
                metrics[metric] = {}
                for io_type in ('read', 'write'):
                    metrics[metric][io_type] = {}

                    series = self._lookup_prior_data(executor, metric, io_type)
                    series = self._convert_timestamps_to_samples(
                        executor, series)
                    steady = self._evaluate_prior_data(
                        series, executor.steady_state_samples)

                    self.logger.debug("Steady state for %s %s: %s" %
                                      (io_type, metric, steady))

                    metrics[metric][io_type]['series'] = series
                    metrics[metric][io_type]['steady_state'] = steady
                    treated_data = DataTreatment.data_treatment(series)

                    metrics[metric][io_type]['slope'] = \
                        math.slope(treated_data['slope_data'])
                    metrics[metric][io_type]['range'] = \
                        math.range_value(treated_data['range_data'])
                    average = math.average(treated_data['average_data'])
                    metrics[metric][io_type]['average'] = average

                    metrics_key = '%s.%s.%s' % (workload, io_type, metric)
                    executor.metadata['metrics'][metrics_key] = average

                    if not steady:
                        steady_state = False

            if 'report_data' not in executor.metadata:
                executor.metadata['report_data'] = {}

            if 'steady_state' not in executor.metadata:
                executor.metadata['steady_state'] = {}

            executor.metadata['report_data'][workload] = metrics
            executor.metadata['steady_state'][workload] = steady_state

            workload_name = executor.current_workload.split('.')[1]

            if steady_state and not workload_name.startswith('_'):
                executor.terminate_current_run()
Beispiel #2
0
def steady_state(data_series):
    """
    This function seeks to detect steady state given on a measurement
    window given the data series of that measurement window following
    the pattern : [[x1,y1], [x2,y2], ..., [xm,ym]]. m represents the number
    of points recorded in the measurement window, x which represents the
    time, and y which represents the Volume performance variable being
    tested e.g. IOPS, latency...
    The function returns a boolean describing wether or not steady state
    has been reached with the data that is passed to it.
    """

    logger = logging.getLogger('storperf.utilities.steady_state')

    # Pre conditioning the data to match the algorithms
    treated_data = DataTreatment.data_treatment(data_series)

    # Calculating useful values invoking dedicated functions
    slope_value = math.slope(treated_data['slope_data'])
    range_value = math.range_value(treated_data['range_data'])
    average_value = math.average(treated_data['average_data'])

    if (slope_value is not None and range_value is not None
            and average_value is not None):
        # Verification of the Steady State conditions following the SNIA
        # definition
        range_condition = abs(range_value) <= 0.20 * abs(average_value)
        slope_condition = abs(slope_value) <= 0.10 * abs(average_value)

        steady_state = range_condition and slope_condition

        logger.debug("Range %s <= %s?" % (abs(range_value),
                                          (0.20 * abs(average_value))))
        logger.debug("Slope %s <= %s?" % (abs(slope_value),
                                          (0.10 * abs(average_value))))
        logger.debug("Steady State? %s" % steady_state)
    else:
        steady_state = False

    return steady_state
Beispiel #3
0
 def test_single_value(self):
     expected = -66.6667
     data_series = [-66.6667]
     actual = math.average(data_series)
     self.assertEqual(expected, actual)
Beispiel #4
0
 def test_negative_values(self):
     expected = -17.314
     data_series = [-15.654, 59.5, 16.25, -150, 3.334]
     actual = math.average(data_series)
     self.assertEqual(expected, actual)
Beispiel #5
0
 def test_float_int_mix(self):
     expected = 472.104
     data_series = [10, 557.33, 862, 56.99, 874.2]
     actual = math.average(data_series)
     self.assertEqual(expected, actual)
Beispiel #6
0
 def test_float_series(self):
     expected = 63.475899999999996
     data_series = [78.6, 45.187, 33.334, 96.7826]
     actual = math.average(data_series)
     self.assertEqual(expected, actual)
Beispiel #7
0
 def test_integer_series(self):
     expected = 19.75
     data_series = [5, 12, 7, 55]
     actual = math.average(data_series)
     self.assertEqual(expected, actual)
Beispiel #8
0
 def test_empty_series(self):
     expected = None
     data_series = []
     actual = math.average(data_series)
     self.assertEqual(expected, actual)