liburing: add script for statistics sqpoll running time
A message that is not in the archive (sent off-list or not yet received): CGME20240206024828epcas5p2119e961d13e6c9fb6ea114c7aca4bf3d@epcas5p2.samsung.com
PATCH 1/1 liburing: add script for statistics sqpoll running time
Count the running time and actual IO processing time of the sqpoll thread, and output the statistical time to terminal.
---
The test results are as follows:
PID WorkTime(us) TotalTime(us) COMMAND 1188923 1528823 1817846 iou-sqp-1188916 1188920 1539703 1833793 iou-sqp-1188917 1188921 1544210 1847887 iou-sqp-1188918 1188922 1561503 1857846 iou-sqp-1188919
--- test/sqtimeshow.sh | 61 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 test/sqtimeshow.sh
test/sqtimeshow.sh new file +61 -0
@@ -0,0 +1,61 @@ +#!/usr/bin/env bash + +UPLINE=$(tput cuu1) + +function set_header() { + printf "\033[47;30m%-15s %-15s %-15s %-15s \033[0m\n" PID WorkTime\(us\) TotalTime\(us\) COMMAND +} + +function get_time() { + pid=$1 + item=$2 + proc_file="/proc/$pid/fdinfo/6" + if [ ! -e $proc_file ]; then + return + fi + content=$(cat ${proc_file} | grep ${item} | awk -F" " '{print $2}') + echo ${content%us} +} + +function show_util() { + index=0 + while true + do + data=$(top -H -b -n 1 | grep iou-sqp) + if [ -z "${data}" ]; then + echo "no sq thread is running." + exit + fi + index=0 + num=$(echo $data | tr -cd R |wc -c) + arr=($data) + len=$((${#arr[@]} / ${num})) + i=0 + while [ ${i} -lt ${num} ] + do + pid=${arr[${i} * ${len}]} + name=${arr[${i} * ${len} + len - 1]} + work_time=$(get_time $pid "SqWorkTime") + total_time=$(get_time $pid "SqTotalTime") + printf "%-15s %-15s %-15s %-15s\n" ${pid} ${work_time} ${total_time} ${name} + ((i++)) + done + sleep 2 + update=$UPLINE + for j in $(seq 1 ${num}); do + update=$update$UPLINE + done + if [ ! -z "$(top -H -b -n 1 | grep iou-sqp)" ]; then + echo "$update" + fi + done +} + +function main() { + # set header + set_header + # show util + show_util +} + +main
Signature · 1 line
2.34.1
Re: [PATCH] liburing: add script for statistics sqpoll running time.
Quoted 57 lines · Xiaobing Li
test/sqtimeshow.sh new file +51
-0@@ -0,0 +1,61 @@ +#!/usr/bin/env bash + +UPLINE=$(tput cuu1) + +function set_header() { + printf "\033[47;30m%-15s %-15s %-15s %-15s \033[0m\n" PID WorkTime\(us\) TotalTime\(us\) COMMAND +} + +function get_time() { + pid=$1 + item=$2 + proc_file="/proc/$pid/fdinfo/6" + if [ ! -e $proc_file ]; then + return + fi + content=$(cat ${proc_file} | grep ${item} | awk -F" " '{print $2}') + echo ${content%us} +} + +function show_util() { + index=0 + while true + do + data=$(top -H -b -n 1 | grep iou-sqp) + if [ -z "${data}" ]; then + echo "no sq thread is running." + exit + fi + index=0 + num=$(echo $data | tr -cd R |wc -c) + arr=($data) + len=$((${#arr[@]} / ${num})) + i=0 + while [ ${i} -lt ${num} ] + do + pid=${arr[${i} * ${len}]} + name=${arr[${i} * ${len} + len - 1]} + work_time=$(get_time $pid "SqWorkTime") + total_time=$(get_time $pid "SqTotalTime") + printf "%-15s %-15s %-15s %-15s\n" ${pid} ${work_time} ${total_time} ${name} + ((i++)) + done + sleep 2 + update=$UPLINE + for j in $(seq 1 ${num}); do + update=$update$UPLINE + done + if [ ! -z "$(top -H -b -n 1 | grep iou-sqp)" ]; then + echo "$update" + fi + done
test/sqtimeshow.sh line 61
Quoted 10 lines
test/sqtimeshow.sh new file +10
-0+} + +function main() { + # set header + set_header + # show util + show_util +} + +main
Hi, Jens and Pavel
This patch is to add a script that displays the statistics of the sqpoll thread to the terminal.
--
Xiaobing Li
Jens Axboe
maintainerRe: [PATCH] liburing: add script for statistics sqpoll running time.
Quoted 64 lines · Xiaobing Li
Quoted 63 lines · Xiaobing Li
test/sqtimeshow.sh new file +57
-0@@ -0,0 +1,61 @@ +#!/usr/bin/env bash + +UPLINE=$(tput cuu1) + +function set_header() { + printf "\033[47;30m%-15s %-15s %-15s %-15s \033[0m\n" PID WorkTime\(us\) TotalTime\(us\) COMMAND +} + +function get_time() { + pid=$1 + item=$2 + proc_file="/proc/$pid/fdinfo/6" + if [ ! -e $proc_file ]; then + return + fi + content=$(cat ${proc_file} | grep ${item} | awk -F" " '{print $2}') + echo ${content%us} +} + +function show_util() { + index=0 + while true + do + data=$(top -H -b -n 1 | grep iou-sqp) + if [ -z "${data}" ]; then + echo "no sq thread is running." + exit + fi + index=0 + num=$(echo $data | tr -cd R |wc -c) + arr=($data) + len=$((${#arr[@]} / ${num})) + i=0 + while [ ${i} -lt ${num} ] + do + pid=${arr[${i} * ${len}]} + name=${arr[${i} * ${len} + len - 1]} + work_time=$(get_time $pid "SqWorkTime") + total_time=$(get_time $pid "SqTotalTime") + printf "%-15s %-15s %-15s %-15s\n" ${pid} ${work_time} ${total_time} ${name} + ((i++)) + done + sleep 2 + update=$UPLINE + for j in $(seq 1 ${num}); do + update=$update$UPLINE + done + if [ ! -z "$(top -H -b -n 1 | grep iou-sqp)" ]; then + echo "$update" + fi + done +} + +function main() { + # set header + set_header + # show util
Quoted 8 lines
test/sqtimeshow.sh line 61
Quoted 4 lines
test/sqtimeshow.sh new file +4
-0+ show_util +} + +mainHi, Jens and Pavel
This patch is to add a script that displays the statistics of the sqpoll thread to the terminal.
No objections to this one, but it will not get applied until the kernel side is sorted out.
Signature · 1 line
Jens Axboe