summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDebian Live user <user@debian-BULLSEYE-live-builder-AMD64>2023-04-27 23:03:13 -0400
committerDebian Live user <user@debian-BULLSEYE-live-builder-AMD64>2023-04-27 23:20:56 -0400
commit0ddc8c4eb89404383faad62c6dd56467bb144667 (patch)
tree031ba89f5bb40c2df22bb140ac05305305da96c0
parent07d4f9c7df8d226ce77b9cf8e81432530f8a1cb4 (diff)
remove dependency on bc
-rwxr-xr-xfirestart7
-rwxr-xr-xsrc/sliceweasel.lib.sh32
2 files changed, 4 insertions, 35 deletions
diff --git a/firestart b/firestart
index f9f3bf0..4de26b0 100755
--- a/firestart
+++ b/firestart
@@ -9,12 +9,13 @@ test_write_ops()
9 then 9 then
10 mkdir -p "$(dirname "$1")" 10 mkdir -p "$(dirname "$1")"
11 sync 11 sync
12 begin=$(date +%s.%N) 12 begin=$(date +%s%N)
13 dd if=/dev/urandom of="$DIR"/urandom.out bs=1M count=300 13 dd if=/dev/urandom of="$DIR"/urandom.out bs=1M count=300
14 sync 14 sync
15 end=$(date +%s.%N) 15 end=$(date +%s%N)
16 ops=$(( (end - begin) / 1000000000 ))
16 rm "$DIR"/urandom.out 17 rm "$DIR"/urandom.out
17 bc -q > "$1" <<< "scale=5; seconds=$end - $begin; 300*1000*1000/seconds" 18 echo "$ops" > "$1"
18 fi 19 fi
19 cat "$1" 20 cat "$1"
20} 21}
diff --git a/src/sliceweasel.lib.sh b/src/sliceweasel.lib.sh
index 549e1e8..3b42a61 100755
--- a/src/sliceweasel.lib.sh
+++ b/src/sliceweasel.lib.sh
@@ -27,38 +27,6 @@ get_total_memory()
27 } 27 }
28} 28}
29 29
30math()
31{
32 printf '%s\n' "$*" | bc -lq
33}
34
35get_total_io()
36{
37 results=$IO_ROOT_DIR/io.test.result
38 zeroes=$IO_ROOT_DIR/io.test
39 if [ -e "$results" ]
40 then
41 age=$(get_age "$results") || return
42 if [ "$age" -gt $((60 * 60 * 24 * 7)) ]
43 then
44 rm "$results"
45 fi
46 fi
47
48 if ! [ -e "$results" ]
49 then
50 MEGS=128
51 then=$(date +%s.%N) || return
52 dd if=/dev/zero of="$zeroes" bs=${MEGS}M count=1 || return
53 now=$(date +%s.%N) || return
54 rm "$zeroes"
55 speed=$(math $now - $then / $((MEGS * 1024 * 1024))) || return
56 echo $speed > "$results"
57 fi
58 read total < "$results" || return
59 echo ${total%.*}
60}
61
62root_write() 30root_write()
63{ 31{
64 $AS_ROOT sh -c 'cat > "$1"' sh "$1" || true 32 $AS_ROOT sh -c 'cat > "$1"' sh "$1" || true