Skip to content

Commit

Permalink
MagicEes: cpuwatcher 可在magiceyes下面可视化 (#938)
Browse files Browse the repository at this point in the history
* add cpuwatcherjson

* 修改controller策略,和其他工具对齐
  • Loading branch information
albertxu216 authored Nov 17, 2024
1 parent 4944326 commit 4156a52
Show file tree
Hide file tree
Showing 4 changed files with 1,148 additions and 12 deletions.
8 changes: 4 additions & 4 deletions MagicEyes/src/backend/process/cpu_watcher/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,14 @@ foreach (app ${apps})
${CMAKE_SOURCE_DIR}/blazesym/target/release/libblazesym.a -lpthread -lrt -ldl)
endif()
endforeach ()
# 8.controller链接到libbpf库
# 8.controller链接到
target_link_libraries(${CONTROLLER_NAME} PRIVATE ${LIBBPF_LIBRARIES} pthread rt dl)
target_link_libraries(${CONTROLLER_NAME} PRIVATE elf z)

# 9.将可执行文件,配置文件等安装在对应的位置
# 9.1设置安装目录
# 将可执行文件,配置文件等安装在对应的位置
# 设置安装目录
set(CPU_WATCHER_INSTALL_DIR backend/${TOOL_BELONG_TO_MODULE}/${TOOL_NAME})
# 9.2安装可执行文件到 ${CPU_WATCHER_INSTALL_DIR}/bin
# 安装可执行文件到 ${CPU_WATCHER_INSTALL_DIR}/bin
install(TARGETS ${TOOL_NAME}
RUNTIME DESTINATION ${CPU_WATCHER_INSTALL_DIR}/bin)
install(TARGETS ${CONTROLLER_NAME}
Expand Down
2 changes: 1 addition & 1 deletion MagicEyes/src/backend/process/cpu_watcher/src/controller.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ static struct env {
bool mutex_detail;
bool umutex;
} env = {
.usemode = 0,
.usemode = 1,
.SAR = false,
.percent = false,
.CS_DELAY = false,
Expand Down
14 changes: 7 additions & 7 deletions MagicEyes/src/backend/process/cpu_watcher/src/cpu_watcher.c
Original file line number Diff line number Diff line change
Expand Up @@ -822,7 +822,7 @@ int main(int argc, char **argv)
goto cs_delay_cleanup;
}
csmap_fd = bpf_map__fd(cs_ctrl_map);
struct cs_ctrl init_value = {false,CS_WACTHER};
struct cs_ctrl init_value = {true,CS_WACTHER};
err = bpf_map_update_elem(csmap_fd, &key, &init_value, 0);
if(err < 0){
fprintf(stderr, "Failed to update elem\n");
Expand Down Expand Up @@ -860,7 +860,7 @@ int main(int argc, char **argv)
goto preempt_cleanup;
}
preemptmap_fd = bpf_map__fd(preempt_ctrl_map);
struct preempt_ctrl init_value = {false,PREEMPT_WACTHER};
struct preempt_ctrl init_value = {true,PREEMPT_WACTHER};
err = bpf_map_update_elem(preemptmap_fd, &key, &init_value, 0);
if(err < 0){
fprintf(stderr, "Failed to update elem\n");
Expand Down Expand Up @@ -898,7 +898,7 @@ int main(int argc, char **argv)
goto sc_delay_cleanup;
}
scmap_fd = bpf_map__fd(sc_ctrl_map);
struct sc_ctrl init_value = {false,SC_WACTHER};
struct sc_ctrl init_value = {true,SC_WACTHER};
err = bpf_map_update_elem(scmap_fd, &key, &init_value, 0);
if(err < 0){
fprintf(stderr, "Failed to update elem\n");
Expand Down Expand Up @@ -938,7 +938,7 @@ int main(int argc, char **argv)
goto schedule_cleanup;
}
schedulemap_fd = bpf_map__fd(schedule_ctrl_map);
struct schedule_ctrl init_value = {false,false,10000,SCHEDULE_WACTHER};
struct schedule_ctrl init_value = {true,false,10000,SCHEDULE_WACTHER};

err = bpf_map_update_elem(schedulemap_fd, &key, &init_value, 0);
if(err < 0){
Expand Down Expand Up @@ -977,7 +977,7 @@ int main(int argc, char **argv)
goto sar_cleanup;
}
sarmap_fd = bpf_map__fd(sar_ctrl_map);
struct sar_ctrl init_value = {false,false,SAR_WACTHER};
struct sar_ctrl init_value = {true,false,SAR_WACTHER};
err = bpf_map_update_elem(sarmap_fd, &key, &init_value, 0);
if(err < 0){
fprintf(stderr, "Failed to update elem\n");
Expand Down Expand Up @@ -1011,7 +1011,7 @@ int main(int argc, char **argv)
goto mq_delay_cleanup;
}
mqmap_fd = bpf_map__fd(mq_ctrl_map);
struct mq_ctrl init_value = {false,MQ_WACTHER};
struct mq_ctrl init_value = {true,MQ_WACTHER};
err = bpf_map_update_elem(mqmap_fd, &key, &init_value, 0);
if(err < 0){
fprintf(stderr, "Failed to update elem\n");
Expand Down Expand Up @@ -1049,7 +1049,7 @@ int main(int argc, char **argv)
goto mutrace_cleanup;
}
mumap_fd = bpf_map__fd(mu_ctrl_map);
struct mu_ctrl init_value = {false,false,false,MUTEX_WATCHER};
struct mu_ctrl init_value = {true,false,false,MUTEX_WATCHER};

err = bpf_map_update_elem(mumap_fd, &key, &init_value, 0);
if(err < 0){
Expand Down
Loading

0 comments on commit 4156a52

Please sign in to comment.