summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xci/verify.sh1
-rw-r--r--docker/storperf-master/storperf/utilities/data_handler.py7
-rw-r--r--docker/storperf-master/storperf/utilities/math.py58
-rw-r--r--docker/storperf-master/storperf/utilities/steady_state.py15
-rw-r--r--docker/storperf-master/tests/utilities_tests/math_range_test.py22
-rw-r--r--docker/storperf-master/tests/utilities_tests/math_slope_series_test.py48
6 files changed, 145 insertions, 6 deletions
diff --git a/ci/verify.sh b/ci/verify.sh
index aedbf26..40e94b6 100755
--- a/ci/verify.sh
+++ b/ci/verify.sh
@@ -22,7 +22,6 @@ pip install --upgrade setuptools
pip install autoflake==1.2
pip install autopep8==1.3.5
pip install coverage==4.5.1
-#pip install cryptography
pip install flake8==3.5.0
pip install mock==2.0.0
pip install nose==1.3.7
diff --git a/docker/storperf-master/storperf/utilities/data_handler.py b/docker/storperf-master/storperf/utilities/data_handler.py
index c7d70a7..cb662f5 100644
--- a/docker/storperf-master/storperf/utilities/data_handler.py
+++ b/docker/storperf-master/storperf/utilities/data_handler.py
@@ -59,6 +59,8 @@ class DataHandler(object):
metrics[metric][io_type]['series'] = series
metrics[metric][io_type]['steady_state'] = steady
+ metrics[metric][io_type]['series_slope'] = \
+ math.slope_series(series)
treated_data = DataTreatment.data_treatment(series)
metrics[metric][io_type]['slope'] = \
@@ -68,6 +70,11 @@ class DataHandler(object):
average = math.average(treated_data['average_data'])
metrics[metric][io_type]['average'] = average
+ metrics[metric][io_type]['series_min'] = \
+ math.min_series(treated_data['range_data'])
+ metrics[metric][io_type]['series_max'] = \
+ math.max_series(treated_data['range_data'])
+
metrics_key = '%s.%s.%s' % (workload, io_type, metric)
executor.metadata['details']['metrics'][metrics_key] = \
average
diff --git a/docker/storperf-master/storperf/utilities/math.py b/docker/storperf-master/storperf/utilities/math.py
index 8e04134..2e78c9d 100644
--- a/docker/storperf-master/storperf/utilities/math.py
+++ b/docker/storperf-master/storperf/utilities/math.py
@@ -8,6 +8,9 @@
##############################################################################
import copy
+RANGE_DEVIATION = 0.20
+SLOPE_DEVIATION = 0.10
+
def slope(data_series):
"""
@@ -114,3 +117,58 @@ def average(data_series):
average = data_sum / float(m)
return average
+
+
+def slope_series(data_series):
+ """
+ This function returns an adjusted series based on the average
+ for the supplied series and the slope of the series.
+ """
+
+ new_series = []
+ average_series = []
+ for l in data_series:
+ average_series.append(l[1])
+
+ avg = average(average_series)
+ slp = slope(data_series)
+
+ multiplier = float(len(data_series) + 1) / 2.0 - len(data_series)
+ for index, _ in data_series:
+ new_value = avg + (slp * multiplier)
+ new_series.append([index, new_value])
+ multiplier += 1
+
+ return new_series
+
+
+def min_series(data_series):
+ """
+ This function returns an copy of the series with only the
+ minimum allowed deviation as its values
+ """
+
+ new_series = []
+ avg = average(data_series)
+ low = avg - (avg * RANGE_DEVIATION)
+
+ for _ in data_series:
+ new_series.append(low)
+
+ return new_series
+
+
+def max_series(data_series):
+ """
+ This function returns an copy of the series with only the
+ maximum allowed deviation as its values
+ """
+
+ new_series = []
+ avg = average(data_series)
+ high = avg + (avg * RANGE_DEVIATION)
+
+ for _ in data_series:
+ new_series.append(high)
+
+ return new_series
diff --git a/docker/storperf-master/storperf/utilities/steady_state.py b/docker/storperf-master/storperf/utilities/steady_state.py
index 13f609d..23a74d7 100644
--- a/docker/storperf-master/storperf/utilities/steady_state.py
+++ b/docker/storperf-master/storperf/utilities/steady_state.py
@@ -9,7 +9,8 @@
import logging
from storperf.utilities import data_treatment as DataTreatment
-from storperf.utilities import math as math
+from storperf.utilities import math
+from storperf.utilities.math import RANGE_DEVIATION, SLOPE_DEVIATION
def steady_state(data_series):
@@ -38,15 +39,19 @@ def steady_state(data_series):
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)
+ range_condition = abs(range_value) <= RANGE_DEVIATION * \
+ abs(average_value)
+ slope_condition = abs(slope_value) <= SLOPE_DEVIATION * \
+ abs(average_value)
steady_state = range_condition and slope_condition
logger.debug("Range %s <= %s?" % (abs(range_value),
- (0.20 * abs(average_value))))
+ (RANGE_DEVIATION *
+ abs(average_value))))
logger.debug("Slope %s <= %s?" % (abs(slope_value),
- (0.10 * abs(average_value))))
+ (SLOPE_DEVIATION *
+ abs(average_value))))
logger.debug("Steady State? %s" % steady_state)
else:
steady_state = False
diff --git a/docker/storperf-master/tests/utilities_tests/math_range_test.py b/docker/storperf-master/tests/utilities_tests/math_range_test.py
index 90519e7..9208fb7 100644
--- a/docker/storperf-master/tests/utilities_tests/math_range_test.py
+++ b/docker/storperf-master/tests/utilities_tests/math_range_test.py
@@ -118,3 +118,25 @@ class MathRangeTest(unittest.TestCase):
data_series.insert(randrange(len(data_series)), -18954.98)
actual = Range.range_value(data_series)
self.assertEqual(expected, actual)
+
+ def test_min_series(self):
+ expected = [427.7333333333333,
+ 427.7333333333333,
+ 427.7333333333333,
+ 427.7333333333333,
+ 427.7333333333333,
+ 427.7333333333333]
+ data_series = [5, 351, 847, 2, 1985, 18]
+ actual = Range.min_series(data_series)
+ self.assertEqual(expected, actual)
+
+ def test_max_series(self):
+ expected = [641.5999999999999,
+ 641.5999999999999,
+ 641.5999999999999,
+ 641.5999999999999,
+ 641.5999999999999,
+ 641.5999999999999]
+ data_series = [5, 351, 847, 2, 1985, 18]
+ actual = Range.max_series(data_series)
+ self.assertEqual(expected, actual)
diff --git a/docker/storperf-master/tests/utilities_tests/math_slope_series_test.py b/docker/storperf-master/tests/utilities_tests/math_slope_series_test.py
new file mode 100644
index 0000000..cfa6efe
--- /dev/null
+++ b/docker/storperf-master/tests/utilities_tests/math_slope_series_test.py
@@ -0,0 +1,48 @@
+##############################################################################
+# Copyright (c) 2016 CENGN and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+import unittest
+from storperf.utilities import math
+
+
+class MathSlopeSeriesTest(unittest.TestCase):
+
+ def setUp(self):
+ unittest.TestCase.setUp(self)
+ pass
+
+ def test_slope_empty_series(self):
+ expected = []
+ actual = math.slope_series([])
+ self.assertEqual(expected, actual)
+
+ def test_slope_integer_series(self):
+ expected = [[1, 4.9], [2, 6.3], [3, 7.7], [4, 9.1]]
+ actual = math.slope_series([[1, 6], [2, 5], [3, 7], [4, 10]])
+ self.assertEqual(expected, actual)
+
+ def test_slope_mix_series(self):
+ expected = [[1, 4.9], [2, 6.3], [3, 7.7], [4, 9.1]]
+ actual = math.slope_series([[1.0, 6], [2, 5.0], [3, 7], [4.0, 10]])
+ self.assertEqual(expected, actual)
+
+ def test_slope_0_in_y(self):
+ expected = [
+ [15.5, 0.8333333333333333],
+ [16.5, 0.3333333333333333],
+ [17.5, -0.16666666666666669]]
+ actual = math.slope_series([[15.5, 1], [16.5, 0], [17.5, 0]])
+ self.assertEqual(expected, actual)
+
+ def test_slope_gaps_in_x(self):
+ expected = [
+ [1, 1.3571428571428572],
+ [2, 2.0],
+ [4, 2.642857142857143]]
+ actual = math.slope_series([[1, 1], [2, 2], [4, 3]])
+ self.assertEqual(expected, actual)