RHEL中基於OS來統計某程式使用的IO;
semantic error: no match while resolving probe point vfs.read.return semantic error: no match while resolving probe point kernel.function("vfs_write").return semantic error: no match while resolving probe point vfs.write.return Pass 2: analysis failed. Try again with another '--vp 01' option 出現這個錯誤是因為沒有安裝kernel_debuginfo包; 找到KERNEL相關的包: kernel-debuginfo-`uname -r`.x86_64.rpm kernel-debuginfo-common-`uname -r`.x86_64.rpm
附上 stap檔案
=====================
######disk io
#!/usr/bin/env stap
#
# Copyright (C) 2007 Oracle Corp.
#
# Get the status of reading/writing disk every 5 seconds,
# output top ten entries
#
# This is free software,GNU General Public License (GPL);
# either version 2, or (at your option) any later version.
#
# Usage:
# ./disktop.stp
#
global io_stat,device,io_stat1,device1
global read_bytes,write_bytes,read_bytes1,write_bytes1
probe vfs.read.return {
if ($return>0) {
if (devname!="N/A") {/*skip read from cache*/
io_stat[pid(),execname(),uid(),ppid(),"R"] += $return
device[pid(),execname(),uid(),ppid(),"R"] = devname
read_bytes += $return
if (devname == "N/A"){
io_stat1[pid(),execname(),uid(),ppid(),"R"] += $return
device1[pid(),execname(),uid(),ppid(),"R"] = devname
read_bytes1 += $return
}
}
}
}
probe vfs.write.return {
if ($return>0) {
if (devname!="N/A") { /*skip update cache*/
io_stat[pid(),execname(),uid(),ppid(),"W"] += $return
device[pid(),execname(),uid(),ppid(),"W"] = devname
write_bytes += $return
}
if (devname=="N/A") {
io_stat1[pid(),execname(),uid(),ppid(),"w"] += $return
device1[pid(),execname(),uid(),ppid(),"w"] = devname
write_bytes1 += $return
}
}
}
probe timer.ms(5000) {
/* skip non-read/write disk */
if (read_bytes+write_bytes) {
printf("n%-25s, %-8s%4dKb/sec, %-7s%6dKb, %-7s%6dKbnn",ctime(gettimeofday_s()),"Raw Average:", ((read_bytes+write_bytes)/1024)/5,"Raw Read:",read_bytes/1024,"Raw Write:",write_bytes/1024)
printf("%8s %8s %8s %25s %8s %4s %12sn","UID","PID","PPID","CMD","DEVICE","T","BYTES")
foreach ([process,cmd,userid,parent,action] in io_stat- limit 10)
printf("%8d %8d %8d %25s %8s %4s %12dn",userid,process,parent,cmd,device[process,cmd,userid,parent,action],action,io_stat[process,cmd,userid,parent,action])
delete io_stat
delete device
read_bytes = 0
write_bytes = 0
}
if (read_bytes1+write_bytes1){
printf("n%-25s, %-8s%4dKb/sec, %-7s%6dKb, %-7s%6dKbnn",ctime(gettimeofday_s()),"Cach Average:", ((read_bytes+write_bytes)/1024)/5,"Cach Read:",read_bytes1/1024,"Cach Write:",write_bytes1/1024)
printf("%8s %8s %8s %25s %8s %4s %12sn","UID","PID","PPID","CMD","DEVICE","T","BYTES")
foreach ([process,cmd,userid,parent,action] in io_stat1- limit 10)
printf("%8d %8d %8d %25s %8s %4s %12dn",userid,process,parent,cmd,device1[process,cmd,userid,parent,action],action,io_stat1[process,cmd,userid,parent,action])
delete io_stat1
delete device1
read_bytes1 = 0
write_bytes1 = 0
}
printf("n-------------------------------------------------------------------------------------------------n")
}
probe end{
delete io_stat
delete device
delete read_bytes
delete write_bytes
delete io_stat1
delete device1
delete read_bytes1
delete write_bytes1
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/703656/viewspace-1056508/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Redox OS:基於Rust的作業系統Rust作業系統
- Java 基於字元的IO Char Based IOJava字元
- python基礎之使用os.system來執行系統命令Python
- 《Linux shell程式設計中 diff與vimdif的使用》RHEL6Linux程式設計
- OS學習筆記七:IO系統筆記
- 基於外部OS驗證的資料庫使用者資料庫
- 程式日誌中出現out of OS kernel IO resources
- 基於中臺思想的物流系統設計(一)
- HTML5:未來OS的基礎?HTML
- 基於java jsp的某企業員工管理系統JavaJS
- 基於linux原生非同步io建立的簡易聊天程式Linux非同步
- 統計字串中某個字元出現的次數字串字元
- 【python基礎】os模組的使用Python
- 某資深程式設計師寫給後來者的忠告程式設計師
- Java程式設計基礎23——IO(其他流)&PropertiesJava程式設計
- Linux系統程式設計-檔案IOLinux程式設計
- Linux中檔案/檔案系統的壓縮、打包和備份總結(基於rhel7)Linux
- 談談基於機器學習的程式設計到底比傳統程式設計強在哪裡?機器學習程式設計
- 基於 nodejs 的 webSockt (socket.io)NodeJSWeb
- 基於UDP程式設計UDP程式設計
- Java程式設計基礎20——異常&IO(File類)Java程式設計
- 【OS】5種網路IO模型模型
- Linux系統程式設計之檔案IOLinux程式設計
- 【轉】基於RHEL5的websphere + IHS 6.1調優Web
- 基於使用者的協同過濾來構建推薦系統
- Go 中 io 包的使用方法Go
- JavaScript 中的 CSS:基於元件的樣式的未來JavaScriptCSS元件
- MySQL查詢某個列中相同值的數量統計MySql
- 基於XMPP的即時通訊系統的建立(三)— 程式設計概覽程式設計
- 基於電商中臺架構-商品系統設計(一)架構
- 【網路程式設計】阻塞IO程式設計的坑程式設計
- Python遊戲程式設計之旅(2):pygame中的IO、資料Python遊戲程式設計GAM
- 使用cgroup 限制程式的磁碟io
- Python基礎之:Python中的IOPython
- 關於JAVA中順序IO的基本操作Java
- Python程式設計中使用Pillow來處理影象的基礎教程Python程式設計
- 關於PHP程式設計中的變數使用技巧小結PHP程式設計變數
- iOS中基於協議的路由設計iOS協議路由