lmp icon indicating copy to clipboard operation
lmp copied to clipboard

cpu_watcher 项目:目标是分析cpu 的运行状态

Open helight opened this issue 2 years ago • 4 comments

cpu_watcher 项目:目标是分析cpu 的运行状态,将BCC_sar(lmp/eBPF_Supermarket/CPU_Subsystem/BCC_sar/src /sar)改写成libbpf版本,目前libbpf版本的框架已经写好,放在了lmp/eBPF_Supermarket/CPU_Subsystem/libbpf_sar文件夹中。该工具应实现以下数据的采集:

  • proc/s: 每秒创建的进程数。此数值是通过fork数来统计的。
  • cswch/s: 每秒上下文切换数。
  • runqlen:各cpu的运行队列总长度。
  • irqtime:CPU响应irq中断所占用的时间。注意这是所有CPU时间的叠加,平均到每个CPU应该除以CPU个数。
  • softirq: CPU执行softirq所占用的时间,是所有CPU的叠加。softirq:irq中断的下半部,优先级比irq低,可被irq抢占。
  • idle: CPU处于空闲状态的时间,所有CPU的叠加。
  • kthread: CPU执行内核线程所占用的时间,所有CPU的叠加。不包括IDLE-0进程,因为此进程只执行空闲指令使CPU闲置。
  • sysc: CPU执行用户程序系统调用(syscall)所占用的时间,所有CPU的叠加。
  • utime:CPU执行普通用户进程时,花在用户态的时间,是所有CPU的叠加。

项目技术要求:

  • 熟悉Linux内核CPU子系统的技术原理
  • 熟悉Linux eBPF技术,能够通过eBPF实现内核事件的解析

运行要求:

  • 运行系统:ubuntu22.4 以上

  • 场景验证:能在主机场景下完成课题实现目标,并有测试分析报告。

  • 文档丰富:具有Readme,设计文档等。

  • [ ] libbpf_sar动态CPU指标监测的各个功能单独开发:

    • https://github.com/linuxkerneltravel/lmp/pull/568
    • https://github.com/linuxkerneltravel/lmp/pull/586
    • https://github.com/linuxkerneltravel/lmp/pull/754
    • #593
    • https://github.com/linuxkerneltravel/lmp/pull/606
    • https://github.com/linuxkerneltravel/lmp/pull/623
    • https://github.com/linuxkerneltravel/lmp/pull/649 更新了cpuwatcher.h文件
    • https://github.com/linuxkerneltravel/lmp/pull/659 实现按需加载
    • https://github.com/linuxkerneltravel/lmp/pull/672
    • https://github.com/linuxkerneltravel/lmp/pull/671
    • https://github.com/linuxkerneltravel/lmp/pull/758
  • [x] libbpf_cs_delay工具:

    • https://github.com/linuxkerneltravel/lmp/pull/575

TODO

  • [ ] libbpf_sarcs_delay 合并为 cpu_watcher 项目,整合所有功能:
    • https://github.com/linuxkerneltravel/lmp/pull/597
    • https://github.com/linuxkerneltravel/lmp/pull/606
  • [ ] 将bpftrace_application下的各个功能整合到 cpu_watcher:
  • [ ] go_switch_info 下的各个功能整合到 cpu_watcher:
  • [ ] go_sar下的各个功能整合到 cpu_watcher:
    • #596
  • [x] 调度延迟最大值、调度延迟最小值、调度延迟平均值等 - https://github.com/linuxkerneltravel/lmp/pull/727
  • [x] 最大系统调用运行延迟、系统调用运行延迟等
    • https://github.com/linuxkerneltravel/lmp/pull/672
    • https://github.com/linuxkerneltravel/lmp/pull/695
  • [ ] schedule函数执行时间
  • [x] 抢占时间、最大关抢占时间等
    • https://github.com/linuxkerneltravel/lmp/pull/727
  • [x] 消息队列延迟时间
    • https://github.com/linuxkerneltravel/lmp/pull/735
    • https://github.com/linuxkerneltravel/lmp/pull/740
  • [ ] 低优先级线程提升
  • [ ] 最大中断延迟、最大中断响应时间、最大中断运行时间、最大关中断时间

helight avatar Oct 20 '23 11:10 helight

1.熟悉ebpf流程概念 2.运行了libbpf-bootstrap中的示例代码bootstrap,做了代码注释。

vvzxy avatar Oct 20 '23 12:10 vvzxy

运行libbpf-strapt中的示例程序对bootstrap中的三个文件进行逐行注释,并在此基础上改编打印task_struct字段中更多信息。

albertxu216 avatar Oct 20 '23 12:10 albertxu216

  1. 提交整合后的进程画像工具,并整理工具
  2. 更新进程画像中的子仓库,解决uprobe中模糊匹配的问题

zhangzihengya avatar Oct 20 '23 12:10 zhangzihengya

pr在这里:https://github.com/linuxkerneltravel/lmp/pull/575

albertxu216 avatar Nov 10 '23 10:11 albertxu216