generated from wangchucheng/hugo-eureka-starters
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
姚泰然
committed
May 18, 2024
1 parent
6b849f2
commit 8601c3f
Showing
139 changed files
with
1,467 additions
and
455 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,9 +3,9 @@ | |
"baseUrl": ".", | ||
"paths": { | ||
"*": [ | ||
"../../../../.cache/hugo_cache/modules/filecache/modules/pkg/mod/wangchucheng.com/[email protected]/_vendor/github.com/FortAwesome/Font-Awesome/js-packages/@fortawesome/fontawesome-svg-core/*", | ||
"../../../../.cache/hugo_cache/modules/filecache/modules/pkg/mod/wangchucheng.com/[email protected]/_vendor/github.com/FortAwesome/Font-Awesome/js-packages/@fortawesome/free-brands-svg-icons/*", | ||
"../../../../.cache/hugo_cache/modules/filecache/modules/pkg/mod/wangchucheng.com/[email protected]/_vendor/github.com/FortAwesome/Font-Awesome/js-packages/@fortawesome/free-solid-svg-icons/*" | ||
"../../../Library/Caches/hugo_cache/modules/filecache/modules/pkg/mod/wangchucheng.com/[email protected]/_vendor/github.com/FortAwesome/Font-Awesome/js-packages/@fortawesome/fontawesome-svg-core/*", | ||
"../../../Library/Caches/hugo_cache/modules/filecache/modules/pkg/mod/wangchucheng.com/[email protected]/_vendor/github.com/FortAwesome/Font-Awesome/js-packages/@fortawesome/free-brands-svg-icons/*", | ||
"../../../Library/Caches/hugo_cache/modules/filecache/modules/pkg/mod/wangchucheng.com/[email protected]/_vendor/github.com/FortAwesome/Font-Awesome/js-packages/@fortawesome/free-solid-svg-icons/*" | ||
] | ||
} | ||
} | ||
|
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,73 @@ | ||
--- | ||
title: eBPF学习笔记 | ||
description: | ||
toc: true | ||
authors: [] | ||
tags: [] | ||
categories: [] | ||
series: [] | ||
date: 2024-04-14T09:25:27+08:00 | ||
lastmod: 2024-04-14T09:25:27+08:00 | ||
featuredVideo: | ||
featuredImage: | ||
draft: false | ||
--- | ||
|
||
eBPF的理论看起来有点抽象,实际上就是注册到内核的回调函数,可以拦截系统调用,然后用来完成自己的事情。 | ||
|
||
只是这个回调函数在内核空间只能用C来写,门槛还是有点高的,除了C之外其他的语言可以写用户空间部分。 | ||
|
||
tcpdump和strace等常用程序就是基于eBPF来实现的。 | ||
|
||
## bcc程序集 | ||
|
||
eBPF常用的利用方式是直接使用其他人贡献的bcc程序集,就和你直接用tcpdump一样。 | ||
|
||
安装程序集的方法参考[这里](https://github.com/iovisor/bcc/blob/master/INSTALL.md),Ubuntu最新版需要使用非官方PPA: | ||
|
||
```bash | ||
sudo add-apt-repository ppa:hadret/libbpf | ||
sudo add-apt-repository ppa:hadret/bpftrace | ||
sudo add-apt-repository ppa:hadret/bpfcc | ||
sudo apt-get install bpfcc-tools linux-headers-$(uname -r) | ||
``` | ||
|
||
Ubuntu里这些二进制文件的名字会添加`-bpfbcc`的后缀,比如`exesnoop-bpfbcc`. | ||
|
||
bcc用户态的代码是用Python写的。 | ||
|
||
### execsnoop | ||
|
||
监控系统新进程的产生,那些会消耗系统资源,但很短暂的进程,它们甚至不会出现在 `top` 命令或其它工具中的显示之中,此时使用该命令可以有效监控。 | ||
|
||
这个名字的来源是它实际监控`exec`的系统调用。 | ||
|
||
### opensnoop | ||
|
||
类似地,用来监控文件打开。 | ||
|
||
### biosnoop | ||
|
||
根据块设备io,并打印延迟。 | ||
|
||
一般使用biolatency -D找到延迟大的磁盘,然后使用biosnoop找到延迟大的进程。 | ||
|
||
### biotop | ||
|
||
可以迅速定位占用大量io的进程。 | ||
|
||
### ext4slower | ||
|
||
检测ext4系统上,文件io较慢的进程和文件名。 | ||
|
||
其他文件系统也有对应的工具,修改前缀匹配即可。 | ||
|
||
### biolatency | ||
|
||
块设备io延迟跟踪,以直方图显示。 | ||
|
||
比iostat的输出更加直观。 | ||
|
||
### cachestat | ||
|
||
查看文件系统的缓存命中率。 |
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 |
---|---|---|
|
@@ -43,7 +43,7 @@ | |
<link rel="stylesheet" href="https://yiuterran.github.io/blog/css/highlightjs.min.2958991528e43eb6fc9b8c4f2b8e052f79c4010718e1d1e888a777620e9ee63021c2c57ec7417a3108019bb8c41943e6.css" media="print" onload="this.media='all';this.onload=null"> | ||
|
||
|
||
<script defer type="text/javascript" src="https://yiuterran.github.io/blog/js/fontawesome.min.949238bba008115a27fbffb62d803c5ebad5dd8516b4c6a5d9b1cc4252acf9e1a936d4e8cc1220d5a61aac817970d314.js"></script> | ||
<script defer type="text/javascript" src="https://yiuterran.github.io/blog/js/fontawesome.min.78e494ccd35d494929874dc88a1c7963e597460caafa2ea0b64b9f5cd2ed626a7348522a90f0b37886181ab1ed34301f.js"></script> | ||
|
||
|
||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.css" | ||
|
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 |
---|---|---|
|
@@ -43,7 +43,7 @@ | |
<link rel="stylesheet" href="https://yiuterran.github.io/blog/css/highlightjs.min.2958991528e43eb6fc9b8c4f2b8e052f79c4010718e1d1e888a777620e9ee63021c2c57ec7417a3108019bb8c41943e6.css" media="print" onload="this.media='all';this.onload=null"> | ||
|
||
|
||
<script defer type="text/javascript" src="https://yiuterran.github.io/blog/js/fontawesome.min.949238bba008115a27fbffb62d803c5ebad5dd8516b4c6a5d9b1cc4252acf9e1a936d4e8cc1220d5a61aac817970d314.js"></script> | ||
<script defer type="text/javascript" src="https://yiuterran.github.io/blog/js/fontawesome.min.78e494ccd35d494929874dc88a1c7963e597460caafa2ea0b64b9f5cd2ed626a7348522a90f0b37886181ab1ed34301f.js"></script> | ||
|
||
|
||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.css" | ||
|
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 |
---|---|---|
|
@@ -43,7 +43,7 @@ | |
<link rel="stylesheet" href="https://yiuterran.github.io/blog/css/highlightjs.min.2958991528e43eb6fc9b8c4f2b8e052f79c4010718e1d1e888a777620e9ee63021c2c57ec7417a3108019bb8c41943e6.css" media="print" onload="this.media='all';this.onload=null"> | ||
|
||
|
||
<script defer type="text/javascript" src="https://yiuterran.github.io/blog/js/fontawesome.min.949238bba008115a27fbffb62d803c5ebad5dd8516b4c6a5d9b1cc4252acf9e1a936d4e8cc1220d5a61aac817970d314.js"></script> | ||
<script defer type="text/javascript" src="https://yiuterran.github.io/blog/js/fontawesome.min.78e494ccd35d494929874dc88a1c7963e597460caafa2ea0b64b9f5cd2ed626a7348522a90f0b37886181ab1ed34301f.js"></script> | ||
|
||
|
||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.css" | ||
|
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 |
---|---|---|
|
@@ -43,7 +43,7 @@ | |
<link rel="stylesheet" href="https://yiuterran.github.io/blog/css/highlightjs.min.2958991528e43eb6fc9b8c4f2b8e052f79c4010718e1d1e888a777620e9ee63021c2c57ec7417a3108019bb8c41943e6.css" media="print" onload="this.media='all';this.onload=null"> | ||
|
||
|
||
<script defer type="text/javascript" src="https://yiuterran.github.io/blog/js/fontawesome.min.949238bba008115a27fbffb62d803c5ebad5dd8516b4c6a5d9b1cc4252acf9e1a936d4e8cc1220d5a61aac817970d314.js"></script> | ||
<script defer type="text/javascript" src="https://yiuterran.github.io/blog/js/fontawesome.min.78e494ccd35d494929874dc88a1c7963e597460caafa2ea0b64b9f5cd2ed626a7348522a90f0b37886181ab1ed34301f.js"></script> | ||
|
||
|
||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.css" | ||
|
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 |
---|---|---|
|
@@ -43,7 +43,7 @@ | |
<link rel="stylesheet" href="https://yiuterran.github.io/blog/css/highlightjs.min.2958991528e43eb6fc9b8c4f2b8e052f79c4010718e1d1e888a777620e9ee63021c2c57ec7417a3108019bb8c41943e6.css" media="print" onload="this.media='all';this.onload=null"> | ||
|
||
|
||
<script defer type="text/javascript" src="https://yiuterran.github.io/blog/js/fontawesome.min.949238bba008115a27fbffb62d803c5ebad5dd8516b4c6a5d9b1cc4252acf9e1a936d4e8cc1220d5a61aac817970d314.js"></script> | ||
<script defer type="text/javascript" src="https://yiuterran.github.io/blog/js/fontawesome.min.78e494ccd35d494929874dc88a1c7963e597460caafa2ea0b64b9f5cd2ed626a7348522a90f0b37886181ab1ed34301f.js"></script> | ||
|
||
|
||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.css" | ||
|
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 |
---|---|---|
|
@@ -43,7 +43,7 @@ | |
<link rel="stylesheet" href="https://yiuterran.github.io/blog/css/highlightjs.min.2958991528e43eb6fc9b8c4f2b8e052f79c4010718e1d1e888a777620e9ee63021c2c57ec7417a3108019bb8c41943e6.css" media="print" onload="this.media='all';this.onload=null"> | ||
|
||
|
||
<script defer type="text/javascript" src="https://yiuterran.github.io/blog/js/fontawesome.min.949238bba008115a27fbffb62d803c5ebad5dd8516b4c6a5d9b1cc4252acf9e1a936d4e8cc1220d5a61aac817970d314.js"></script> | ||
<script defer type="text/javascript" src="https://yiuterran.github.io/blog/js/fontawesome.min.78e494ccd35d494929874dc88a1c7963e597460caafa2ea0b64b9f5cd2ed626a7348522a90f0b37886181ab1ed34301f.js"></script> | ||
|
||
|
||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.css" | ||
|
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 |
---|---|---|
|
@@ -43,7 +43,7 @@ | |
<link rel="stylesheet" href="https://yiuterran.github.io/blog/css/highlightjs.min.2958991528e43eb6fc9b8c4f2b8e052f79c4010718e1d1e888a777620e9ee63021c2c57ec7417a3108019bb8c41943e6.css" media="print" onload="this.media='all';this.onload=null"> | ||
|
||
|
||
<script defer type="text/javascript" src="https://yiuterran.github.io/blog/js/fontawesome.min.949238bba008115a27fbffb62d803c5ebad5dd8516b4c6a5d9b1cc4252acf9e1a936d4e8cc1220d5a61aac817970d314.js"></script> | ||
<script defer type="text/javascript" src="https://yiuterran.github.io/blog/js/fontawesome.min.78e494ccd35d494929874dc88a1c7963e597460caafa2ea0b64b9f5cd2ed626a7348522a90f0b37886181ab1ed34301f.js"></script> | ||
|
||
|
||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.css" | ||
|
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 |
---|---|---|
|
@@ -43,7 +43,7 @@ | |
<link rel="stylesheet" href="https://yiuterran.github.io/blog/css/highlightjs.min.2958991528e43eb6fc9b8c4f2b8e052f79c4010718e1d1e888a777620e9ee63021c2c57ec7417a3108019bb8c41943e6.css" media="print" onload="this.media='all';this.onload=null"> | ||
|
||
|
||
<script defer type="text/javascript" src="https://yiuterran.github.io/blog/js/fontawesome.min.949238bba008115a27fbffb62d803c5ebad5dd8516b4c6a5d9b1cc4252acf9e1a936d4e8cc1220d5a61aac817970d314.js"></script> | ||
<script defer type="text/javascript" src="https://yiuterran.github.io/blog/js/fontawesome.min.78e494ccd35d494929874dc88a1c7963e597460caafa2ea0b64b9f5cd2ed626a7348522a90f0b37886181ab1ed34301f.js"></script> | ||
|
||
|
||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.css" | ||
|
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 |
---|---|---|
|
@@ -43,7 +43,7 @@ | |
<link rel="stylesheet" href="https://yiuterran.github.io/blog/css/highlightjs.min.2958991528e43eb6fc9b8c4f2b8e052f79c4010718e1d1e888a777620e9ee63021c2c57ec7417a3108019bb8c41943e6.css" media="print" onload="this.media='all';this.onload=null"> | ||
|
||
|
||
<script defer type="text/javascript" src="https://yiuterran.github.io/blog/js/fontawesome.min.949238bba008115a27fbffb62d803c5ebad5dd8516b4c6a5d9b1cc4252acf9e1a936d4e8cc1220d5a61aac817970d314.js"></script> | ||
<script defer type="text/javascript" src="https://yiuterran.github.io/blog/js/fontawesome.min.78e494ccd35d494929874dc88a1c7963e597460caafa2ea0b64b9f5cd2ed626a7348522a90f0b37886181ab1ed34301f.js"></script> | ||
|
||
|
||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.css" | ||
|
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 |
---|---|---|
|
@@ -43,7 +43,7 @@ | |
<link rel="stylesheet" href="https://yiuterran.github.io/blog/css/highlightjs.min.2958991528e43eb6fc9b8c4f2b8e052f79c4010718e1d1e888a777620e9ee63021c2c57ec7417a3108019bb8c41943e6.css" media="print" onload="this.media='all';this.onload=null"> | ||
|
||
|
||
<script defer type="text/javascript" src="https://yiuterran.github.io/blog/js/fontawesome.min.949238bba008115a27fbffb62d803c5ebad5dd8516b4c6a5d9b1cc4252acf9e1a936d4e8cc1220d5a61aac817970d314.js"></script> | ||
<script defer type="text/javascript" src="https://yiuterran.github.io/blog/js/fontawesome.min.78e494ccd35d494929874dc88a1c7963e597460caafa2ea0b64b9f5cd2ed626a7348522a90f0b37886181ab1ed34301f.js"></script> | ||
|
||
|
||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.css" | ||
|
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 |
---|---|---|
|
@@ -43,7 +43,7 @@ | |
<link rel="stylesheet" href="https://yiuterran.github.io/blog/css/highlightjs.min.2958991528e43eb6fc9b8c4f2b8e052f79c4010718e1d1e888a777620e9ee63021c2c57ec7417a3108019bb8c41943e6.css" media="print" onload="this.media='all';this.onload=null"> | ||
|
||
|
||
<script defer type="text/javascript" src="https://yiuterran.github.io/blog/js/fontawesome.min.949238bba008115a27fbffb62d803c5ebad5dd8516b4c6a5d9b1cc4252acf9e1a936d4e8cc1220d5a61aac817970d314.js"></script> | ||
<script defer type="text/javascript" src="https://yiuterran.github.io/blog/js/fontawesome.min.78e494ccd35d494929874dc88a1c7963e597460caafa2ea0b64b9f5cd2ed626a7348522a90f0b37886181ab1ed34301f.js"></script> | ||
|
||
|
||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.css" | ||
|
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
Oops, something went wrong.