[prev in list] [next in list] [prev in thread] [next in thread]
List: mesos-commits
Subject: [mesos] 02/02: Added 25th and 75th percentiles to `Statistics`.
From: alexr () apache ! org
Date: 2018-08-30 20:40:29
Message-ID: 20180830204027.39656851A6 () gitbox ! apache ! org
[Download RAW message or body]
This is an automated email from the ASF dual-hosted git repository.
alexr pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mesos.git
commit 9513916f55249c00f188e902f1d40e5483ae47fb
Author: Alexander Rukletsov <alexr@apache.org>
AuthorDate: Thu Aug 2 15:03:19 2018 +0200
Added 25th and 75th percentiles to `Statistics`.
Review: https://reviews.apache.org/r/68225
---
3rdparty/libprocess/include/process/statistics.hpp | 4 ++++
3rdparty/libprocess/src/metrics/metrics.cpp | 1 +
3rdparty/libprocess/src/tests/statistics_tests.cpp | 4 ++++
3 files changed, 9 insertions(+)
diff --git a/3rdparty/libprocess/include/process/statistics.hpp \
b/3rdparty/libprocess/include/process/statistics.hpp index 7d787c4..aac736c 100644
--- a/3rdparty/libprocess/include/process/statistics.hpp
+++ b/3rdparty/libprocess/include/process/statistics.hpp
@@ -86,7 +86,9 @@ struct Statistics
T max;
// TODO(dhamon): Consider making the percentiles we store dynamic.
+ T p25;
T p50;
+ T p75;
T p90;
T p95;
T p99;
@@ -111,7 +113,9 @@ private:
statistics.min = values.front();
statistics.max = values.back();
+ statistics.p25 = percentile(values, 0.25);
statistics.p50 = percentile(values, 0.5);
+ statistics.p75 = percentile(values, 0.75);
statistics.p90 = percentile(values, 0.90);
statistics.p95 = percentile(values, 0.95);
statistics.p99 = percentile(values, 0.99);
diff --git a/3rdparty/libprocess/src/metrics/metrics.cpp \
b/3rdparty/libprocess/src/metrics/metrics.cpp index ba1962f..623d44a 100644
--- a/3rdparty/libprocess/src/metrics/metrics.cpp
+++ b/3rdparty/libprocess/src/metrics/metrics.cpp
@@ -250,6 +250,7 @@ Future<map<string, double>> MetricsProcess::__snapshot(
snapshot.end(),
key + "/count",
static_cast<double>(statistics_.count));
+ // TODO(alexr): Consider exposing p25 and p75 percentiles.
snapshot.emplace_hint(snapshot.end(), key + "/max", statistics_.max);
snapshot.emplace_hint(snapshot.end(), key + "/min", statistics_.min);
snapshot.emplace_hint(snapshot.end(), key + "/p50", statistics_.p50);
diff --git a/3rdparty/libprocess/src/tests/statistics_tests.cpp \
b/3rdparty/libprocess/src/tests/statistics_tests.cpp index 96f5fd3..b348830 100644
--- a/3rdparty/libprocess/src/tests/statistics_tests.cpp
+++ b/3rdparty/libprocess/src/tests/statistics_tests.cpp
@@ -66,7 +66,9 @@ TEST(StatisticsTest, StatisticsFromTimeSeries)
EXPECT_DOUBLE_EQ(-5.0, statistics->min);
EXPECT_DOUBLE_EQ(5.0, statistics->max);
+ EXPECT_DOUBLE_EQ(-2.5, statistics->p25);
EXPECT_DOUBLE_EQ(0.0, statistics->p50);
+ EXPECT_DOUBLE_EQ(2.5, statistics->p75);
EXPECT_DOUBLE_EQ(4.0, statistics->p90);
EXPECT_DOUBLE_EQ(4.5, statistics->p95);
EXPECT_DOUBLE_EQ(4.9, statistics->p99);
@@ -91,6 +93,8 @@ TEST(StatisticsTest, StatisticsFromDurationList)
EXPECT_EQ(Seconds(0), statistics->min);
EXPECT_EQ(Seconds(100), statistics->max);
+ EXPECT_EQ(Seconds(25), statistics->p25);
EXPECT_EQ(Seconds(50), statistics->p50);
+ EXPECT_EQ(Seconds(75), statistics->p75);
EXPECT_EQ(Seconds(90), statistics->p90);
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic