aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/lib/channel
diff options
context:
space:
mode:
authorGravatar ncteisen <ncteisen@gmail.com>2018-10-05 12:33:03 -0700
committerGravatar ncteisen <ncteisen@gmail.com>2018-10-05 12:33:03 -0700
commit4b36519c40db7619a335cf3a01ee78730ff2ccdb (patch)
tree8ebb6d793383014d0876d0fd2c1254f96099971f /src/core/lib/channel
parent7136072e3480918a9c6a0ced5e538348f89cf529 (diff)
reviewer feedback
Diffstat (limited to 'src/core/lib/channel')
-rw-r--r--src/core/lib/channel/channelz_registry.cc10
-rw-r--r--src/core/lib/channel/channelz_registry.h6
2 files changed, 8 insertions, 8 deletions
diff --git a/src/core/lib/channel/channelz_registry.cc b/src/core/lib/channel/channelz_registry.cc
index 3cc8bd8ea7..4deb8c29aa 100644
--- a/src/core/lib/channel/channelz_registry.cc
+++ b/src/core/lib/channel/channelz_registry.cc
@@ -59,7 +59,7 @@ intptr_t ChannelzRegistry::InternalRegister(BaseNode* node) {
return ++uuid_generator_;
}
-void ChannelzRegistry::MaybePerformCompaction() {
+void ChannelzRegistry::MaybePerformCompactionLocked() {
constexpr double kEmptinessTheshold = 1 / 3;
double emptiness_ratio =
double(num_empty_slots_) / double(entities_.capacity());
@@ -77,7 +77,7 @@ void ChannelzRegistry::MaybePerformCompaction() {
}
}
-int ChannelzRegistry::FindByUuid(intptr_t target_uuid) {
+int ChannelzRegistry::FindByUuidLocked(intptr_t target_uuid) {
size_t left = 0;
size_t right = entities_.size() - 1;
while (left <= right) {
@@ -107,11 +107,11 @@ void ChannelzRegistry::InternalUnregister(intptr_t uuid) {
GPR_ASSERT(uuid >= 1);
MutexLock lock(&mu_);
GPR_ASSERT(uuid <= uuid_generator_);
- int idx = FindByUuid(uuid);
+ int idx = FindByUuidLocked(uuid);
GPR_ASSERT(idx >= 0);
entities_[idx] = nullptr;
num_empty_slots_++;
- MaybePerformCompaction();
+ MaybePerformCompactionLocked();
}
BaseNode* ChannelzRegistry::InternalGet(intptr_t uuid) {
@@ -119,7 +119,7 @@ BaseNode* ChannelzRegistry::InternalGet(intptr_t uuid) {
if (uuid < 1 || uuid > uuid_generator_) {
return nullptr;
}
- int idx = FindByUuid(uuid);
+ int idx = FindByUuidLocked(uuid);
return idx < 0 ? nullptr : entities_[idx];
}
diff --git a/src/core/lib/channel/channelz_registry.h b/src/core/lib/channel/channelz_registry.h
index f9dacd95a3..9c43d960d3 100644
--- a/src/core/lib/channel/channelz_registry.h
+++ b/src/core/lib/channel/channelz_registry.h
@@ -87,12 +87,12 @@ class ChannelzRegistry {
char* InternalGetTopChannels(intptr_t start_channel_id);
char* InternalGetServers(intptr_t start_server_id);
- // If entities_ has a over a certain threshold of empty slots, it will
+ // If entities_ has over a certain threshold of empty slots, it will
// compact the vector and move all used slots to the front.
- void MaybePerformCompaction();
+ void MaybePerformCompactionLocked();
// Performs binary search on entities_ to find the index with that uuid.
- int FindByUuid(intptr_t uuid);
+ int FindByUuidLocked(intptr_t uuid);
// protects members
gpr_mu mu_;