Ai
1 Star 0 Fork 18

阿翔与山海经/gala-gopher

forked from src-openEuler/gala-gopher
关闭
 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
some-bugfix.patch 2.98 KB
一键复制 编辑 原始数据 按行查看 历史
陈臻 提交于 2023-01-14 06:21 +08:00 . sync bugfix patches from openeuler/gala-gopher
From 0b1750325993ec3af54aee27a63cb0ecbf625c6f Mon Sep 17 00:00:00 2001
From: dowzyx <zhaoyuxing2@huawei.com>
Date: Wed, 28 Dec 2022 09:49:32 +0800
Subject: [PATCH] some bugfix
---
src/probes/extends/ebpf.probe/build.sh | 2 +-
.../ebpf.probe/src/taskprobe/taskprobe.c | 4 +--
.../cadvisor.probe/cadvisor_probe.py | 5 +++-
5 files changed, 27 insertions(+), 7 deletions(-)
diff --git a/src/probes/extends/ebpf.probe/build.sh b/src/probes/extends/ebpf.probe/build.sh
index 4094ed5..eb15fb4 100755
--- a/src/probes/extends/ebpf.probe/build.sh
+++ b/src/probes/extends/ebpf.probe/build.sh
@@ -81,7 +81,7 @@ function compile_probe()
echo "please create vmlinux.h manually."
echo "methods:"
echo " 1. generate linux_xxx.h by compile the kernel, refer to gen_vmlinux_h.sh;"
- echo " 2. ln -s vmlinux.h linux_xxx.h, (there are some include files in directory src/include)"
+ echo " 2. ln -s linux_xxx.h vmlinux.h, (there are some include files in directory src/include)"
echo " if your kernel version is similar to the include files provided, you can use method 2"
echo "=========================================================================================="
exit
diff --git a/src/probes/extends/ebpf.probe/src/taskprobe/taskprobe.c b/src/probes/extends/ebpf.probe/src/taskprobe/taskprobe.c
index dfa24d3..ec67d10 100644
--- a/src/probes/extends/ebpf.probe/src/taskprobe/taskprobe.c
+++ b/src/probes/extends/ebpf.probe/src/taskprobe/taskprobe.c
@@ -105,8 +105,8 @@ static void get_wl_proc(struct task_probe_s* probep)
char comm[TASK_COMM_LEN];
char cmdline[PROC_CMDLINE_LEN];
char command[COMMAND_LEN];
- const char *get_comm_fmt = "/usr/bin/cat /proc/%u/comm";
- const char *get_cmdline_fmt = "/usr/bin/cat /proc/%u/cmdline";
+ const char *get_comm_fmt = "/usr/bin/cat /proc/%u/comm 2>/dev/null";
+ const char *get_cmdline_fmt = "/usr/bin/cat /proc/%u/cmdline 2>/dev/null";
dir = opendir("/proc");
if (dir == NULL) {
diff --git a/src/probes/extends/python.probe/cadvisor.probe/cadvisor_probe.py b/src/probes/extends/python.probe/cadvisor.probe/cadvisor_probe.py
index 8b12aac..bbca1b7 100644
--- a/src/probes/extends/python.probe/cadvisor.probe/cadvisor_probe.py
+++ b/src/probes/extends/python.probe/cadvisor.probe/cadvisor_probe.py
@@ -360,7 +360,10 @@ def print_metrics():
value = ""
else:
if field_type == COUNTER:
- value = str(record[field_name][1] - record[field_name][0])
+ if record[field_name][1] > record[field_name][0]:
+ value = str(record[field_name][1] - record[field_name][0])
+ else:
+ value = "0"
record[field_name][0] = record[field_name][1]
else:
value = record[field_name]
--
2.33.0
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/a-xiang-and-shanhaijing/gala-gopher.git
git@gitee.com:a-xiang-and-shanhaijing/gala-gopher.git
a-xiang-and-shanhaijing
gala-gopher
gala-gopher
master

搜索帮助