summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorSakib Sajal <sakib.sajal@windriver.com>2021-07-09 16:53:44 -0400
committerRichard Purdie <richard.purdie@linuxfoundation.org>2021-07-10 22:42:22 +0100
commit7c5fd8006ff77f07052d9e44695a373a34b94e9a (patch)
tree95060853c3d0726d7d9bc5e30f89e08094a5301a /scripts
parent8ce9e8b268c3d6a8c5f22de9352656efd3e93cfb (diff)
downloadpoky-7c5fd8006ff77f07052d9e44695a373a34b94e9a.tar.gz
oe-time-dd-test.sh: add options and refactor
Options: -c | --count <amount> dd (transfer) <amount> KiB of data within specified timeout to detect latency. Must enable -t option. -t | --timeout <time> timeout in seconds for the <count> amount of data to be transferred. -l | --log-only run the commands without performing the data transfer. -h | --help show help (From OE-Core rev: 302bc6c99226a4d050e4e454afc461a25e127632) Signed-off-by: Sakib Sajal <sakib.sajal@windriver.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/oe-time-dd-test.sh95
1 files changed, 80 insertions, 15 deletions
diff --git a/scripts/oe-time-dd-test.sh b/scripts/oe-time-dd-test.sh
index ccdd55e66e..df36c0b297 100755
--- a/scripts/oe-time-dd-test.sh
+++ b/scripts/oe-time-dd-test.sh
@@ -1,4 +1,4 @@
1#!/bin/sh 1#!/bin/bash
2# 2#
3# oe-time-dd-test records how much time it takes to 3# oe-time-dd-test records how much time it takes to
4# write <count> number of kilobytes to the filesystem. 4# write <count> number of kilobytes to the filesystem.
@@ -8,23 +8,25 @@
8# The purporse of this script is to find which part of 8# The purporse of this script is to find which part of
9# the build system puts stress on the filesystem io and 9# the build system puts stress on the filesystem io and
10# log all the processes. 10# log all the processes.
11
12usage() { 11usage() {
13 echo "Usage: $0 <count>" 12 echo "$0 is used to detect i/o latency and runs commands to display host information."
14} 13 echo "The following commands are run in order:"
15 14 echo "1) top -c -b -n1 -w 512"
16TIMEOUT=15 15 echo "2) iostat -y -z -x 5 1"
16 echo "3) tail -30 tmp*/log/cooker/*/console-latest.log to gather cooker log."
17 echo " "
18 echo "Options:"
19 echo "-c | --count <amount> dd (transfer) <amount> KiB of data within specified timeout to detect latency."
20 echo " Must enable -t option."
21 echo "-t | --timeout <time> timeout in seconds for the <count> amount of data to be transferred."
22 echo "-l | --log-only run the commands without performing the data transfer."
23 echo "-h | --help show help"
17 24
18if [ $# -ne 1 ]; then 25}
19 usage
20 exit 1
21fi
22 26
23uptime 27run_cmds() {
24timeout ${TIMEOUT} dd if=/dev/zero of=oe-time-dd-test.dat bs=1024 count=$1 conv=fsync 28 uptime
25if [ $? -ne 0 ]; then 29 echo "start: top output"
26 echo "Timeout used: ${TIMEOUT}"
27 echo "start: top output"
28 top -c -b -n1 -w 512 30 top -c -b -n1 -w 512
29 echo "end: top output" 31 echo "end: top output"
30 echo "start: iostat" 32 echo "start: iostat"
@@ -33,4 +35,67 @@ if [ $? -ne 0 ]; then
33 echo "start: cooker log" 35 echo "start: cooker log"
34 tail -30 tmp*/log/cooker/*/console-latest.log 36 tail -30 tmp*/log/cooker/*/console-latest.log
35 echo "end: cooker log" 37 echo "end: cooker log"
38}
39
40if [ $# -lt 1 ]; then
41 usage
42 exit 1
43fi
44
45re_c='^[0-9]+$'
46#re_t='^[0-9]+([.][0-9]+)?$'
47
48while [[ $# -gt 0 ]]; do
49 key="$1"
50
51 case $key in
52 -c|--count)
53 COUNT=$2
54 shift
55 shift
56 if ! [[ $COUNT =~ $re_c ]] || [[ $COUNT -le 0 ]] ; then
57 usage
58 exit 1
59 fi
60 ;;
61 -t|--timeout)
62 TIMEOUT=$2
63 shift
64 shift
65 if ! [[ $TIMEOUT =~ $re_c ]] || [[ $TIMEOUT -le 0 ]] ; then
66 usage
67 exit 1
68 fi
69 ;;
70 -l|--log-only)
71 LOG_ONLY="true"
72 shift
73 shift
74 ;;
75 -h|--help)
76 usage
77 exit 0
78 ;;
79 *)
80 usage
81 exit 1
82 ;;
83 esac
84done
85
86
87if [ "$LOG_ONLY" = "true" ] ; then
88 run_cmds
89 exit
90fi
91
92if [ -z ${TIMEOUT+x} ] || [ -z ${COUNT+x} ] ; then
93 usage
94 exit 1
95fi
96
97echo "Timeout used: ${TIMEOUT}"
98timeout ${TIMEOUT} dd if=/dev/zero of=oe-time-dd-test.dat bs=1024 count=${COUNT} conv=fsync
99if [ $? -ne 0 ]; then
100 run_cmds
36fi 101fi