forked from linuxkerneltravel/lmp
-
Notifications
You must be signed in to change notification settings - Fork 0
122 lines (105 loc) · 3.86 KB
/
system_cpu.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
name: CPU Subsystem
on:
push:
branches:
- "*"
paths:
- 'eBPF_Supermarket/CPU_Subsystem/**'
- '.github/workflows/system_cpu.yml'
pull_request:
branches:
- "*"
paths:
- 'eBPF_Supermarket/CPU_Subsystem/**'
- '.github/workflows/system_cpu.yml'
jobs:
bcc-project-build-and-test:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
sudo pip install psutil==5.9.1
pip install flake8 pytest
cd eBPF_Supermarket/CPU_Subsystem/BCC_sar
sudo apt-get install bpfcc-tools linux-headers-$(uname -r) # install BCC
# - name: Build BCC
# run: |
# set -x
# sudo apt-get update
# # Use release 9 of llvm etc. - later versions have an unfixed
# # bug on Ubuntu:
# # https://github.com/iovisor/bcc/issues/2915
# sudo apt-get -y install bison build-essential cmake flex git libelf-dev libfl-dev libedit-dev libllvm9 llvm-9-dev libclang-9-dev python zlib1g-dev
# pushd /tmp
# git clone --depth 1 --branch v0.20.0 https://github.com/iovisor/bcc.git
# mkdir -p bcc/build; cd bcc/build
# # Symlink /usr/lib/llvm to avoid "Unable to find clang libraries"
# # The directory appears only to be created when installing the
# # virtual llvm-dev package.
# # https://github.com/iovisor/bcc/issues/492
# sudo ln -s /usr/lib/llvm-9 /usr/local/llvm
# cmake ..
# make
# sudo make install
- name: Run BCC_sar
run: |
cd eBPF_Supermarket/CPU_Subsystem/BCC_sar/src/sar
sudo python3 sar.py -h
sudo python3 sar.py -t time -c 3
sudo python3 sar.py -t percent -c 5
sudo python3 sar.py -t percent -c 3 -i 2
- name: Run BCC_sar(Per Process)
run: |
cd eBPF_Supermarket/CPU_Subsystem/BCC_sar/src/sar
# find the process which runs for the longest time
TARGET=$(ps -eo pid --sort -time | sed -n "2p" | awk '{print $1}')
echo target=$TARGET
sudo python3 sar.py -t time -c 3 -p $TARGET
sudo python3 sar.py -t percent -c 3 -p $TARGET
go-build-and-test:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.18
- name: Build Cilium And Run Go Program
run: |
sudo apt install clang llvm
export BPF_CLANG=clang # configure llvm
# # 为当前平台单独生成一个vmlinux.h
# 可能会覆盖原有仓库的文件,有问题
# sudo apt install linux-tools-$(uname -r)
# sudo apt install linux-tools-generic
# sudo bpftool btf dump file /sys/kernel/btf/vmlinux format c > cd eBPF_Supermarket/CPU_Subsystem/vmlinux.h
# echo 'Already produce own vmlinux.h'
# 查看目标平台CPU信息
cat /proc/cpuinfo
cd eBPF_Supermarket/CPU_Subsystem/go_sar
# download cilium-eBPF package
go mod tidy
cd program
chmod +x run.sh
uname -r
./run.sh
cpu_watcher-project-build-and-test:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Install dependencies and Init Env
run: |
sudo apt update
sudo apt install libbpf-dev clang llvm libelf-dev libpcap-dev gcc-multilib build-essential
git submodule update --init --recursive
- name: Run cpu_watcher
run: |
cd eBPF_Supermarket/CPU_Subsystem/cpu_watcher
make cpu_watcher
sudo ./cpu_watcher