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

推荐订阅源

S
Secure Thoughts
Security Latest
Security Latest
Simon Willison's Weblog
Simon Willison's Weblog
O
OpenAI News
GbyAI
GbyAI
L
LINUX DO - 最新话题
A
Arctic Wolf
T
Tor Project blog
G
GRAHAM CLULEY
I
InfoQ
博客园_首页
IT之家
IT之家
The Register - Security
The Register - Security
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
P
Proofpoint News Feed
The GitHub Blog
The GitHub Blog
Blog — PlanetScale
Blog — PlanetScale
N
Netflix TechBlog - Medium
K
Kaspersky official blog
博客园 - 三生石上(FineUI控件)
S
SegmentFault 最新的问题
U
Unit 42
PCI Perspectives
PCI Perspectives
量子位
P
Palo Alto Networks Blog
S
Securelist
T
Troy Hunt's Blog
博客园 - 【当耐特】
Recorded Future
Recorded Future
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
S
Security Affairs
Engineering at Meta
Engineering at Meta
T
The Blog of Author Tim Ferriss
博客园 - 聂微东
罗磊的独立博客
N
News and Events Feed by Topic
人人都是产品经理
人人都是产品经理
B
Blog RSS Feed
NISL@THU
NISL@THU
C
Cisco Blogs
T
Threatpost
有赞技术团队
有赞技术团队
Forbes - Security
Forbes - Security
Hugging Face - Blog
Hugging Face - Blog
Last Week in AI
Last Week in AI
T
The Exploit Database - CXSecurity.com
Cloudbric
Cloudbric
Cyberwarzone
Cyberwarzone
Google DeepMind News
Google DeepMind News
C
Cyber Attacks, Cyber Crime and Cyber Security

博客园 - 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)  评论()    收藏  举报