From 0ddc8c4eb89404383faad62c6dd56467bb144667 Mon Sep 17 00:00:00 2001 From: Debian Live user Date: Thu, 27 Apr 2023 23:03:13 -0400 Subject: remove dependency on bc --- firestart | 7 ++++--- src/sliceweasel.lib.sh | 32 -------------------------------- 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() then mkdir -p "$(dirname "$1")" sync - begin=$(date +%s.%N) + begin=$(date +%s%N) dd if=/dev/urandom of="$DIR"/urandom.out bs=1M count=300 sync - end=$(date +%s.%N) + end=$(date +%s%N) + ops=$(( (end - begin) / 1000000000 )) rm "$DIR"/urandom.out - bc -q > "$1" <<< "scale=5; seconds=$end - $begin; 300*1000*1000/seconds" + echo "$ops" > "$1" fi cat "$1" } 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() } } -math() -{ - printf '%s\n' "$*" | bc -lq -} - -get_total_io() -{ - results=$IO_ROOT_DIR/io.test.result - zeroes=$IO_ROOT_DIR/io.test - if [ -e "$results" ] - then - age=$(get_age "$results") || return - if [ "$age" -gt $((60 * 60 * 24 * 7)) ] - then - rm "$results" - fi - fi - - if ! [ -e "$results" ] - then - MEGS=128 - then=$(date +%s.%N) || return - dd if=/dev/zero of="$zeroes" bs=${MEGS}M count=1 || return - now=$(date +%s.%N) || return - rm "$zeroes" - speed=$(math $now - $then / $((MEGS * 1024 * 1024))) || return - echo $speed > "$results" - fi - read total < "$results" || return - echo ${total%.*} -} - root_write() { $AS_ROOT sh -c 'cat > "$1"' sh "$1" || true -- cgit v1.2.3