1 Star 0 Fork 40

dengkx/third_party_grpc

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
src_core_lib_debug.patch 3.16 KB
一键复制 编辑 原始数据 按行查看 历史
wenlong_12 提交于 2023-04-23 17:21 . grpc版本升级到1.41.1
diff -Naur grpc-1.41.1/src/core/lib/debug/stats_data.cc third_party_grpc_sxy/src/core/lib/debug/stats_data.cc
--- grpc-1.41.1/src/core/lib/debug/stats_data.cc 2021-10-20 04:14:40.000000000 +0800
+++ third_party_grpc_sxy/src/core/lib/debug/stats_data.cc 2023-04-20 14:24:54.000000000 +0800
@@ -282,8 +282,8 @@
"Number of streams terminated per TCP write",
"Number of flow control updates written per TCP write",
// NOLINTNEXTLINE(bugprone-suspicious-missing-comma)
- "How many completion queues were checked looking for a CQ that had "
- "requested the incoming call",
+ ("How many completion queues were checked looking for a CQ that had "
+ "requested the incoming call"),
};
const int grpc_stats_table_0[65] = {
0, 1, 2, 3, 4, 5, 7, 9, 11, 14,
diff -Naur grpc-1.41.1/src/core/lib/debug/trace.cc third_party_grpc_sxy/src/core/lib/debug/trace.cc
--- grpc-1.41.1/src/core/lib/debug/trace.cc 2021-10-20 04:14:40.000000000 +0800
+++ third_party_grpc_sxy/src/core/lib/debug/trace.cc 2023-04-20 14:24:54.000000000 +0800
@@ -40,45 +40,51 @@
TraceFlag* TraceFlagList::root_tracer_ = nullptr;
bool TraceFlagList::Set(const char* name, bool enabled) {
- TraceFlag* t;
- if (0 == strcmp(name, "all")) {
- for (t = root_tracer_; t; t = t->next_tracer_) {
+ if (0 == strlen(name)) {
+ gpr_log(GPR_DEBUG, "No trace flags are changed");
+ } else if (0 == strcmp(name, "all")) {
+ for (auto t = root_tracer_; t != nullptr; t = t->next_tracer_) {
t->set_enabled(enabled);
}
} else if (0 == strcmp(name, "list_tracers")) {
LogAllTracers();
} else if (0 == strcmp(name, "refcount")) {
- for (t = root_tracer_; t; t = t->next_tracer_) {
+ for (auto t = root_tracer_; t != nullptr; t = t->next_tracer_) {
if (strstr(t->name_, "refcount") != nullptr) {
t->set_enabled(enabled);
+ break;
}
}
} else {
- bool found = false;
- for (t = root_tracer_; t; t = t->next_tracer_) {
+ for (auto t = root_tracer_; t != nullptr; t = t->next_tracer_) {
if (0 == strcmp(name, t->name_)) {
t->set_enabled(enabled);
- found = true;
+ return true;
}
}
// check for unknowns, but ignore "", to allow to GRPC_TRACE=
- if (!found && 0 != strcmp(name, "")) {
- gpr_log(GPR_ERROR, "Unknown trace var: '%s'", name);
- return false; /* early return */
- }
+ gpr_log(GPR_ERROR, "Unknown trace var: '%s'", name);
+ return false; /* early return */
}
return true;
}
void TraceFlagList::Add(TraceFlag* flag) {
+ gpr_log(GPR_DEBUG, "Add tracer:\t%s", flag->name_);
+ // prevent cycles at 'Add' flag to 'root_tracer_'
+ for (auto t = root_tracer_; t != nullptr; t = t->next_tracer_) {
+ // check if flag is already part of 'root_tracer_'
+ if (t == flag) {
+ return;
+ }
+ }
flag->next_tracer_ = root_tracer_;
root_tracer_ = flag;
}
void TraceFlagList::LogAllTracers() {
gpr_log(GPR_DEBUG, "available tracers:");
- TraceFlag* t;
- for (t = root_tracer_; t != nullptr; t = t->next_tracer_) {
+ for (auto t = root_tracer_; t != nullptr; t = t->next_tracer_) {
gpr_log(GPR_DEBUG, "\t%s", t->name_);
}
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/ksllh/third_party_grpc.git
git@gitee.com:ksllh/third_party_grpc.git
ksllh
third_party_grpc
third_party_grpc
master

搜索帮助