forked from linuxkerneltravel/lmp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
合并CPU、内存、文件系统子系统监测程序; 整理目录结构;wakeup程序添加新的指标 (linuxkerneltravel#364)
* 合并CPU、内存、文件系统子系统监测程序; 整理目录结构;wakeup程序添加新的指标 * 更新CI和go程序,以通过CI * 小修改,测试CI * 修改CI * 补充Supermarket文档 Co-authored-by: zrp <[email protected]> Co-authored-by: helight <[email protected]>
- Loading branch information
1 parent
4152c8c
commit c10e2d5
Showing
141 changed files
with
7,471 additions
and
16,558 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,4 +9,5 @@ temp_data/ | |
*/test/process | ||
*/test/pthread | ||
|
||
*/temp | ||
*/temp | ||
**/event.txt |
108 changes: 108 additions & 0 deletions
108
eBPF_Supermarket/CPU_Subsystem/BCC_sar/src/area-time-axis.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
<!-- | ||
此示例下载自 https://echarts.apache.org/examples/zh/editor.html?c=area-time-axis | ||
--> | ||
<!DOCTYPE html> | ||
<html lang="zh-CN" style="height: 100%"> | ||
<head> | ||
<meta charset="utf-8"> | ||
</head> | ||
<body style="height: 100%; margin: 0"> | ||
<div id="container" style="height: 100%"></div> | ||
|
||
|
||
<script type="text/javascript" src="https://fastly.jsdelivr.net/npm/[email protected]/dist/echarts.min.js"></script> | ||
<!-- Uncomment this line if you want to dataTool extension | ||
<script type="text/javascript" src="https://fastly.jsdelivr.net/npm/[email protected]/dist/extension/dataTool.min.js"></script> | ||
--> | ||
<!-- Uncomment this line if you want to use gl extension | ||
<script type="text/javascript" src="https://fastly.jsdelivr.net/npm/echarts-gl@2/dist/echarts-gl.min.js"></script> | ||
--> | ||
<!-- Uncomment this line if you want to echarts-stat extension | ||
<script type="text/javascript" src="https://fastly.jsdelivr.net/npm/echarts-stat@latest/dist/ecStat.min.js"></script> | ||
--> | ||
<!-- Uncomment this line if you want to use map | ||
<script type="text/javascript" src="https://fastly.jsdelivr.net/npm/[email protected]/map/js/china.js"></script> | ||
<script type="text/javascript" src="https://fastly.jsdelivr.net/npm/[email protected]/map/js/world.js"></script> | ||
--> | ||
<!-- Uncomment these two lines if you want to use bmap extension | ||
<script type="text/javascript" src="https://api.map.baidu.com/api?v=3.0&ak=YOUR_API_KEY"></script> | ||
<script type="text/javascript" src="https://fastly.jsdelivr.net/npm/[email protected]/dist/extension/bmap.min.js"></script> | ||
--> | ||
|
||
<script type="text/javascript"> | ||
var dom = document.getElementById('container'); | ||
var myChart = echarts.init(dom, null, { | ||
renderer: 'canvas', | ||
useDirtyRect: false | ||
}); | ||
var app = {}; | ||
|
||
var option; | ||
|
||
let base = +new Date(1988, 9, 3); | ||
let oneDay = 24 * 3600 * 1000; | ||
let data = [[base, Math.random() * 300]]; | ||
for (let i = 1; i < 20000; i++) { | ||
let now = new Date((base += oneDay)); | ||
data.push([+now, Math.round((Math.random() - 0.5) * 20 + data[i - 1][1])]); | ||
} | ||
|
||
option = { | ||
tooltip: { | ||
trigger: 'axis', | ||
position: function (pt) { | ||
return [pt[0], '10%']; | ||
} | ||
}, | ||
title: { | ||
left: 'center', | ||
text: 'Large Ara Chart' | ||
}, | ||
toolbox: { | ||
feature: { | ||
dataZoom: { | ||
yAxisIndex: 'none' | ||
}, | ||
restore: {}, | ||
saveAsImage: {} | ||
} | ||
}, | ||
xAxis: { | ||
type: 'value', | ||
boundaryGap: false | ||
}, | ||
yAxis: { | ||
type: 'value', | ||
boundaryGap: [0, '100%'] | ||
}, | ||
dataZoom: [ | ||
{ | ||
type: 'inside', | ||
start: 0, | ||
end: 20 | ||
}, | ||
{ | ||
start: 0, | ||
end: 20 | ||
} | ||
], | ||
series: [ | ||
{ | ||
name: 'Fake Data', | ||
type: 'line', | ||
smooth: true, | ||
symbol: 'none', | ||
areaStyle: {}, | ||
data: data | ||
} | ||
] | ||
}; | ||
|
||
if (option && typeof option === 'object') { | ||
myChart.setOption(option); | ||
} | ||
|
||
window.addEventListener('resize', myChart.resize); | ||
</script> | ||
</body> | ||
</html> |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...PU_Subsystem/BCC_sar/src/sar_perpro.bpf.c → ...ubsystem/BCC_sar/src/sar/sar_perpro.bpf.c
100755 → 100644
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
75 changes: 75 additions & 0 deletions
75
eBPF_Supermarket/CPU_Subsystem/BCC_sar/src/wakeup/bpfutil.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
import re, os | ||
|
||
# print a cint_list(list of ctypes variable) | ||
def printList(cint_list): | ||
for i in cint_list: | ||
print(i.value, end=",") | ||
print() | ||
|
||
# get the number of the count of cpus | ||
# @return int | ||
def get_num_cpus() -> int: | ||
num_cpus = 1 | ||
with open("/proc/cpuinfo", "r") as f: | ||
while True: | ||
s = f.readline() | ||
if not s: break | ||
if re.match("^processor\t: [0-9]+\n$", s): | ||
num_cpus = int(s[:-1].split(" ")[-1]) + 1 | ||
return num_cpus | ||
|
||
# find ksymbol in /proc/kallsyms | ||
# if find, return a positive number, else negative. | ||
# @return int | ||
def find_ksym(ksym: str) -> int: | ||
addr = -1 | ||
with open("/proc/kallsyms", 'r') as f: | ||
line = f.readline() | ||
while line: | ||
if line[:-1].endswith(" " + ksym): | ||
addr = line.split(" ")[0] | ||
break | ||
line = f.readline() | ||
return addr | ||
|
||
class SecondRecord: | ||
def __init__(self, initval=0) -> None: | ||
self.val = initval | ||
|
||
# update and read delta | ||
def UpRd(self, val): | ||
dta = val - self.val | ||
self.val = val | ||
return dta | ||
|
||
def get_pid_by_name(name: str) -> int: | ||
f = os.popen("ps -A | grep ' " + name + "$" + "'") | ||
lines = f.readlines() | ||
if len(lines) != 1: | ||
return -1 | ||
else: | ||
f_str = lines[0] | ||
|
||
pid = re.match(" *([0-9]+) ", f_str).group(0) | ||
pid = int(pid) | ||
return pid | ||
|
||
# GRAY=30 | ||
# RED=31 | ||
# GREEN=32 | ||
# YELLOW=33 | ||
# BLUE=34 | ||
# MAGENTA=35 | ||
# CYAN=36 | ||
# WHITE=37 | ||
# CRIMSON=38 | ||
def colorize(num, string, bold=False, highlight = False): | ||
assert isinstance(num, int) | ||
attr = [] | ||
if highlight: | ||
num += 10 | ||
attr.append(str(num)) | ||
if bold: attr.append('1') | ||
return '\x1b[%sm%s\x1b[0m' % (';'.join(attr), string) | ||
|
||
# 原文链接:https://blog.csdn.net/hxxjxw/article/details/122432886 |
3 changes: 3 additions & 0 deletions
3
eBPF_Supermarket/CPU_Subsystem/BCC_sar/src/wakeup/getBiggestRunTimePid.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/bash | ||
# 按照时间从大到小排序打印进程pid和comm,只打印前10条 | ||
ps -eo pid,comm,time --sort=-time | head -n 10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import time | ||
import os | ||
|
||
if __name__ == "__main__": | ||
print(os.getpid()) | ||
while True: | ||
time.sleep(0.3) | ||
for i in range(1000000): | ||
pass |
Oops, something went wrong.