-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a per-core percentile utilization metric
Summary: We want to replace the current host average cpu utilization with a percentile that works for a variety of hardware and network RX configurations. The idea is that RX/RPS cores may have different utilization compared to the rest of them. This change allows tracking per-core utilization and computing a configured percentile of those utilizations. Differential Revision: D49079695 fbshipit-source-id: ad97227fb9cedfd66eb487e78b7eb378aa27cac0
- Loading branch information
1 parent
be18754
commit f0500bd
Showing
4 changed files
with
119 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the BSD-style license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
#include "proxygen/lib/stats/ResourceData.h" | ||
#include <folly/portability/GTest.h> | ||
|
||
using namespace ::testing; | ||
using namespace proxygen; | ||
|
||
class ResourceDataTest : public ::testing::Test {}; | ||
|
||
TEST_F(ResourceDataTest, Percentiles) { | ||
std::vector<double> values{0.1, 0.5, 0.6, 0.7, 0.8}; | ||
EXPECT_EQ(ResourceData::computePercentile(values, 0), 0.1); | ||
EXPECT_EQ(ResourceData::computePercentile(values, 19), 0.1); | ||
EXPECT_EQ(ResourceData::computePercentile(values, 20), 0.5); | ||
EXPECT_EQ(ResourceData::computePercentile(values, 21), 0.5); | ||
EXPECT_EQ(ResourceData::computePercentile(values, 39), 0.5); | ||
EXPECT_EQ(ResourceData::computePercentile(values, 40), 0.6); | ||
EXPECT_EQ(ResourceData::computePercentile(values, 41), 0.6); | ||
EXPECT_EQ(ResourceData::computePercentile(values, 59), 0.6); | ||
EXPECT_EQ(ResourceData::computePercentile(values, 60), 0.7); | ||
EXPECT_EQ(ResourceData::computePercentile(values, 61), 0.7); | ||
EXPECT_EQ(ResourceData::computePercentile(values, 79), 0.7); | ||
EXPECT_EQ(ResourceData::computePercentile(values, 80), 0.8); | ||
EXPECT_EQ(ResourceData::computePercentile(values, 81), 0.8); | ||
EXPECT_EQ(ResourceData::computePercentile(values, 90), 0.8); | ||
EXPECT_EQ(ResourceData::computePercentile(values, 99), 0.8); | ||
EXPECT_EQ(ResourceData::computePercentile(values, 100), 0.8); | ||
} |