From: Xiaobing Li <xiaobing.li@samsung.com>
To: axboe@kernel.dk, asml.silence@gmail.com
Cc: linux-kernel@vger.kernel.org, io-uring@vger.kernel.org,
kun.dou@samsung.com, peiwei.li@samsung.com, joshi.k@samsung.com,
kundan.kumar@samsung.com, wenwen.chen@samsung.com,
ruyi.zhang@samsung.com, cliang01.li@samsung.com,
xue01.he@samsung.com, Xiaobing Li <xiaobing.li@samsung.com>
Subject: [PATCH] liburing: add script for statistics sqpoll running time
Date: Tue, 6 Feb 2024 10:40:14 +0800 [thread overview]
Message-ID: <20240206024014.11412-1-xiaobing.li@samsung.com> (raw)
In-Reply-To: <CGME20240206024828epcas5p2119e961d13e6c9fb6ea114c7aca4bf3d@epcas5p2.samsung.com>
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
Signed-off-by: Xiaobing Li <xiaobing.li@samsung.com>
---
test/sqtimeshow.sh | 61 ++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 61 insertions(+)
create mode 100644 test/sqtimeshow.sh
diff --git a/test/sqtimeshow.sh b/test/sqtimeshow.sh
new file mode 100644
index 0000000..e85fd2f
--- /dev/null
+++ b/test/sqtimeshow.sh
@@ -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
--
2.34.1
next parent reply other threads:[~2024-02-06 5:23 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20240206024828epcas5p2119e961d13e6c9fb6ea114c7aca4bf3d@epcas5p2.samsung.com>
2024-02-06 2:40 ` Xiaobing Li [this message]
[not found] ` <CGME20240218055959epcas5p2ac436be88fecd625f072c78ff77610ef@epcas5p2.samsung.com>
2024-02-18 5:59 ` Xiaobing Li
2024-02-18 13:00 ` Jens Axboe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240206024014.11412-1-xiaobing.li@samsung.com \
--to=xiaobing.li@samsung.com \
--cc=asml.silence@gmail.com \
--cc=axboe@kernel.dk \
--cc=cliang01.li@samsung.com \
--cc=io-uring@vger.kernel.org \
--cc=joshi.k@samsung.com \
--cc=kun.dou@samsung.com \
--cc=kundan.kumar@samsung.com \
--cc=linux-kernel@vger.kernel.org \
--cc=peiwei.li@samsung.com \
--cc=ruyi.zhang@samsung.com \
--cc=wenwen.chen@samsung.com \
--cc=xue01.he@samsung.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®