summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Cady <d@cryptonomic.net>2022-11-29 12:31:17 -0500
committerAndrew Cady <d@cryptonomic.net>2022-11-29 12:31:17 -0500
commit07d4f9c7df8d226ce77b9cf8e81432530f8a1cb4 (patch)
tree5d53b283632b201eeceef7904b0bdab2aad8fbec
parent60c4d3c09fd1a03661306104b37ac73e88489080 (diff)
rename ioslay-mgr.sh; test write ops
-rw-r--r--Makefile2
-rw-r--r--README.txt2
-rwxr-xr-xfirestart31
-rwxr-xr-xsrc/firefox-io-slayer (renamed from src/ioslay-mgr.sh)0
4 files changed, 28 insertions, 7 deletions
diff --git a/Makefile b/Makefile
index d259fd1..bcc1005 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,5 @@
1BINDIR = /usr/local/bin 1BINDIR = /usr/local/bin
2BINARIES = firestart firestartx $(addprefix src/,sliceweasel.lib.sh ioslay-mgr.sh ioslay-firefox) 2BINARIES = firestart firestartx $(addprefix src/,sliceweasel.lib.sh firefox-io-slayer ioslay-firefox)
3SUDO != [ "$$(id -u)" = 0 ] || echo sudo 3SUDO != [ "$$(id -u)" = 0 ] || echo sudo
4 4
5.PHONY: install install-bin 5.PHONY: install install-bin
diff --git a/README.txt b/README.txt
index 492e278..c217f7a 100644
--- a/README.txt
+++ b/README.txt
@@ -14,7 +14,7 @@ Then you can use the two commands:
14 firestartx - start Firefox in a CGroup and X server sandbox (recommended) 14 firestartx - start Firefox in a CGroup and X server sandbox (recommended)
15 15
16Within the `firefox` systemd service, a background service called `ioslay` will 16Within the `firefox` systemd service, a background service called `ioslay` will
17be started by `ioslay-mgr.sh`. 17be started by `firefox-io-slayer`.
18 18
19The launching of Firefox through either of these commands launches a watchdog 19The launching of Firefox through either of these commands launches a watchdog
20process that kills Firefox processes when they are spinning the disk. 20process that kills Firefox processes when they are spinning the disk.
diff --git a/firestart b/firestart
index 5f388b5..f9f3bf0 100755
--- a/firestart
+++ b/firestart
@@ -1,20 +1,41 @@
1#!/bin/sh 1#!/bin/bash
2 2
3die() { printf "%s: Error: %s\n" "$0" "$*" >&2; exit 1; } 3die() { printf "%s: Error: %s\n" "$0" "$*" >&2; exit 1; }
4 4
5# Test DEVICE WRITE OPS BY WRITEOPS
6test_write_ops()
7{
8 if ! [ -e "$1" ]
9 then
10 mkdir -p "$(dirname "$1")"
11 sync
12 begin=$(date +%s.%N)
13 dd if=/dev/urandom of="$DIR"/urandom.out bs=1M count=300
14 sync
15 end=$(date +%s.%N)
16 rm "$DIR"/urandom.out
17 bc -q > "$1" <<< "scale=5; seconds=$end - $begin; 300*1000*1000/seconds"
18 fi
19 cat "$1"
20}
21
5CMD=firefox 22CMD=firefox
6UNIT=$CMD 23UNIT=$CMD
7DIR=~/.mozilla 24DIR=~/.mozilla
8MEMORY_MAX=50% 25MEMORY_MAX=50%
9READ_OPS=1G 26READ_OPS=1G
10WRITE_OPS=$READ_OPS 27WRITE_OPS=$READ_OPS
11CONFDIR=$HOME/.config/firestart/conf 28CONFDIR=$HOME/.config/firestart
12 29
13if [ -e "$CONFDIR" ] 30if [ -e "$CONFDIR"/conf ]
14then 31then
15 . "$CONFDIR" 32 . "$CONFDIR"/conf
16fi 33fi
17 34
35WRITE_OPS=$(test_write_ops "$CONFDIR"/diskspeed.dat)
36WRITE_OPS=${WRITE_OPS%.*}
37READ_OPS=$WRITE_OPS
38
18if systemctl --user is-active "$UNIT" >/dev/null 39if systemctl --user is-active "$UNIT" >/dev/null
19then 40then
20 exec "$CMD" "$@" # Asks existing firefox to open a new window. 41 exec "$CMD" "$@" # Asks existing firefox to open a new window.
@@ -27,7 +48,7 @@ fi
27DEV=$(echo $(findmnt --target "$DIR" -o MAJ:MIN -n)) 48DEV=$(echo $(findmnt --target "$DIR" -o MAJ:MIN -n))
28[ "$DEV" ] || die "could not determine backing device for $DIR" 49[ "$DEV" ] || die "could not determine backing device for $DIR"
29 50
30ioslay-mgr.sh launch-unit 51firefox-io-slayer launch-unit
31 52
32systemctl --user reset-failed "$UNIT" 2>/dev/null 53systemctl --user reset-failed "$UNIT" 2>/dev/null
33systemd-run --user \ 54systemd-run --user \
diff --git a/src/ioslay-mgr.sh b/src/firefox-io-slayer
index 56ab849..56ab849 100755
--- a/src/ioslay-mgr.sh
+++ b/src/firefox-io-slayer