惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Engineering at Meta
Engineering at Meta
博客园_首页
H
Help Net Security
WordPress大学
WordPress大学
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
罗磊的独立博客
博客园 - 三生石上(FineUI控件)
B
Blog
I
InfoQ
SecWiki News
SecWiki News
T
Tailwind CSS Blog
Spread Privacy
Spread Privacy
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
V
Vulnerabilities – Threatpost
N
Netflix TechBlog - Medium
P
Palo Alto Networks Blog
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Vercel News
Vercel News
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
K
Kaspersky official blog
M
MIT News - Artificial intelligence
S
Schneier on Security
T
Threat Research - Cisco Blogs
F
Fortinet All Blogs
Cyberwarzone
Cyberwarzone
Scott Helme
Scott Helme
aimingoo的专栏
aimingoo的专栏
Martin Fowler
Martin Fowler
MyScale Blog
MyScale Blog
The Cloudflare Blog
Recent Announcements
Recent Announcements
Security Latest
Security Latest
G
GRAHAM CLULEY
IT之家
IT之家
Y
Y Combinator Blog
The Last Watchdog
The Last Watchdog
腾讯CDC
Google DeepMind News
Google DeepMind News
V
V2EX
S
Securelist
TaoSecurity Blog
TaoSecurity Blog
B
Blog RSS Feed
S
SegmentFault 最新的问题
博客园 - 叶小钗
P
Proofpoint News Feed
云风的 BLOG
云风的 BLOG
Project Zero
Project Zero
G
Google Developers Blog
Google DeepMind News
Google DeepMind News
F
Full Disclosure

博客园 - toong

envoy DDOS HTTP/2 Bomb CVE-2026-47774 安全漏洞分析 P2P与FRP与websocket python运行虚拟化环境 大模型从0到1 绑定网卡中断后是否需要设置RFS linux socket reuse port 小测试 现代C++ envoy timeout 说明 openssl查看编译时选项设置的方法 内核ipsec转发优化方法 提高ipsec多核并行能力的优化方法之一 tc qdisc 的burst如何设置 bash模拟netstat取值的脚本 linux内核对MSI网卡队列的smp_affinity亲和CPU选择 bash多并发--进程池数量控制 bash单例模式 linux 分析中断 linux 查看 ipsec 丢包 linux内核rps与rfs机制分析 linux获取CPU利用率的快捷命令 开启openssl legacy的方法
观察中断的脚本 /proc/interrupts
toong · 2025-08-15 · via 博客园 - toong

CPU太多,中断太大,屏幕太小。

mpstat,也不是很方便。弄了个脚本。

丑陋。但有效

#! /bin/bash

function dump()
{
cat /proc/interrupts |sed 's/^ //g' | awk '
NR==1 {
    # 第一行获取CPU核心数量(从标题行计算)
    cpu_count = NF - 1
    next
}
{
    # 保存原始行的中断名称等信息(从第(1 + cpu_count + 1)列开始)
    info = ""
    for (i = 1 + cpu_count + 1; i <= NF; i++) {
        info = info " " $i
    }
    
    # 对所有CPU核心的中断计数求和
    total = 0
    for (i = 2; i <= 1 + cpu_count; i++) {
        gsub(/,/, "", $i)  # 去除数字中的逗号(如1,000 -> 1000)
        total += $i
    }
    
    # 输出:中断号 + 总中断数 + 原始信息
    printf "%-8s %'"'"'d %s\n", $1, total, info
}'

}


function dodo()
{
        sleep 2
        dump |grep -E '^[0-9]+' > /tmp/dump_123456789_2

        printf '\033c'
        diff  --suppress-common-lines /tmp/dump_123456789_1 /tmp/dump_123456789_2
        cp /tmp/dump_123456789_2 /tmp/dump_123456789_1
}


while :
do
        dodo
done

posted on 2025-08-15 15:56  toong  阅读(42)  评论()    收藏  举报