diff options
Diffstat (limited to 'tests/dummyresourcewritebenchmark.cpp')
-rw-r--r-- | tests/dummyresourcewritebenchmark.cpp | 35 |
1 files changed, 1 insertions, 34 deletions
diff --git a/tests/dummyresourcewritebenchmark.cpp b/tests/dummyresourcewritebenchmark.cpp index c350b1a..9815f96 100644 --- a/tests/dummyresourcewritebenchmark.cpp +++ b/tests/dummyresourcewritebenchmark.cpp | |||
@@ -24,40 +24,7 @@ | |||
24 | #include "createentity_generated.h" | 24 | #include "createentity_generated.h" |
25 | 25 | ||
26 | #include "getrssusage.h" | 26 | #include "getrssusage.h" |
27 | 27 | #include "utils.h" | |
28 | static double variance(const QList<double> &values) | ||
29 | { | ||
30 | //The variance of a single value is 0 | ||
31 | if (values.size() == 1) { | ||
32 | return 0; | ||
33 | } | ||
34 | double mean = 0; | ||
35 | for (auto value : values) { | ||
36 | mean += value; | ||
37 | } | ||
38 | mean = mean / static_cast<double>(values.size()); | ||
39 | double variance = 0; | ||
40 | for (auto value : values) { | ||
41 | variance += pow(static_cast<double>(value) - mean, 2); | ||
42 | } | ||
43 | variance = variance / static_cast<double>(values.size() - 1); | ||
44 | return variance; | ||
45 | } | ||
46 | |||
47 | static double maxDifference(const QList<double> &values) | ||
48 | { | ||
49 | auto max = values.first(); | ||
50 | auto min = values.first(); | ||
51 | for (auto value : values) { | ||
52 | if (value > max) { | ||
53 | max = value; | ||
54 | } | ||
55 | if (value < min) { | ||
56 | min = value; | ||
57 | } | ||
58 | } | ||
59 | return max - min; | ||
60 | } | ||
61 | 28 | ||
62 | static QByteArray createEntityBuffer(int &bufferSize) | 29 | static QByteArray createEntityBuffer(int &bufferSize) |
63 | { | 30 | { |