找出内存最大的几个进程(按名字统计,同名算一个,但是这么算出来的有可能加上了共享内存,不保证完全准确,要是想刨去共享内存一个办法就是统计时加上uniq): ps -G | sed 's/^>//' | awk '{ m[$9] =$8/1024 } END { for (item in m) { printf " s s MiBn", item, m[item] } }' | sort -k 2 -r -n | head
加上PID(按第一个出现的名字算): ps -G | sed 's/^>//' | awk '{ m[$9] =$8/1024; p[$9]=$1 } END { for (item in m) { printf "%s s s MiBn", p[item], item, m[item] } }' | sort -k 3 -r -n | head
同名进程个数: ps | sed 's/^>//' | awk '{ m[$9] =1 } END { for (item in m) { printf "%s %s n", item, m[item] } }' | sort -k 2 -r -n | head
统计UN进程的栈都hung在哪里:
foreach UN bt | awk '/#2 /{print $3,$5}' | sort | uniq -c | sort -nr
输出rwsem链表上的所有task:
list rwsem_waiter.list -s rwsem_waiter.task 0xffff8807f1167d80 | awk '{print $3}' | grep -v '^$' | sed 's/0x//g' | sort
sem:
list semaphore_waiter.list -s semaphore_waiter.task 0xffff92d1333077a0 | awk '{print $3}' | grep -v '^$' | sed 's/0x//g' | sort
从进程栈上找包含某一地址的所有task:
search -t ffff88080d098070 | grep '^PID' | awk '{print $4}' | sort
统计一个盘下最常出现的文件名: list dentry.d_lru -s dentry.d_name -H 0xffff90a833731640 | grep name | grep -v d_ | sed 's/"//g' | awk '{c[$4] } END{for(w in c) {printf"%s: %dn",w,c[w]}}' | sort -k 2 -r -n | head
统计在做io的进程(vfs_read|vfs_write):
foreach bt -a | grep -E "vfs_read|vfs_write" -B 20 | grep PID | awk -F ':' '{c[$5] } END{for(i in c){printf "%s %dn",i,c[i]}}' | sort -k 2 -r | head
从dmesg里统计每秒打印了多少log:
cat vmcore-dmesg.txt | awk -F ' ' '{print $1}' | awk -F '.' '{print $1}' | sed 's/[//g' | awk '{ count[$1]} END{for (num in count) {printf("%d %dn", num, count[num]);}}' | sort -rn -k 1
查看所有cpu待处理的ipi链表:
crash> p call_single_queue | awk '/ffff/ {print "list " $NF}' > csd_queues.txt
crash> < csd_queues.txt