您好,登錄后才能下訂單哦!
小編給大家分享一下ext4如何實現時延stap腳本,相信大部分人都還不怎么了解,因此分享這篇文章給大家參考一下,希望大家閱讀完這篇文章后大有收獲,下面讓我們一起去了解一下吧!
#!/bin/sh STAP_FILE_PATH="/tmp/moderate-ext4.stp" MODERATE_EXT4_FUNCTIONS=( #ext4 direct io function "ext4_direct_IO" #ext4 page related functions #"ext4_readpages" #"ext4_writepage" #ext4 aio related functions "generic_file_aio_read" "ext4_file_write" #ext4 sync function "ext4_sync_file" ) function error() { echo $@ exit 1 } function probe_functions() { local delay=${1:-"1"} rm $STAP_FILE_PATH &>/dev/null # header cat <> $STAP_FILE_PATH #!/usr/bin/stap -DSTP_NO_OVERLOAD # Delay reads by 250 ms # stap -v -g nfsd_delay_op.stp nfsd_read 250 %{ #undef STP_OVERLOAD #include %} function udelay(ms:long) %{ /* guru */ udelay(THIS->ms); %} EOF for func_name in ${MODERATE_EXT4_FUNCTIONS[@]}; do if [[ $func_name =~ "ext4" ]]; then # ext4 module probe body cat <> $STAP_FILE_PATH probe module("ext4").function("$func_name").return { udelay($delay); } EOF else # kernel probe body cat <> $STAP_FILE_PATH probe kernel.function("$func_name").return { udelay($delay); } EOF fi done } function usage() { local program=`basename $0` echo "Usage: $program is a tool to moderate ext4's io based on systemtap" echo "the only option is time, and the unit is milliseconds" exit 1 } function main() { if [ "$1" = "-h" ] || [ "$1" = "--help" ]; then usage fi which stap &>/dev/null || yum -b current intall -y systemtap probe_functions $1 stap -v -g $STAP_FILE_PATH } main $1 |
以上是“ext4如何實現時延stap腳本”這篇文章的所有內容,感謝各位的閱讀!相信大家都有了一定的了解,希望分享的內容對大家有所幫助,如果還想學習更多知識,歡迎關注億速云行業資訊頻道!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。