Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| bf87653e77 | |||
| 8e6ea348cc | |||
| 3dbbedaec6 | |||
| 3f85cd6dd8 | |||
| 939da6f3dc | |||
| 3d68686a96 | |||
| dcd6806e72 |
6
.pistressrc
Normal file
6
.pistressrc
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
export PISTRESS_HOME=/home/pi/git/pistress
|
||||||
|
export THERMAL_ZONE=/sys/class/thermal/thermal_zone0/temp
|
||||||
|
|
||||||
|
export FIO_NUMJOBS=$(nproc)
|
||||||
|
export FIO_RUNNING_TIME=3600
|
||||||
|
|
||||||
@@ -7,10 +7,30 @@ usage() {
|
|||||||
cat <<-EOF
|
cat <<-EOF
|
||||||
Usage: ${name} [-h || --help]
|
Usage: ${name} [-h || --help]
|
||||||
|
|
||||||
measures the pu core temperature an echoes with a squenence number to stdout.
|
measures the cpu's core temperature and writes it with a timestamp to stdout.
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#format the temperature to float value
|
||||||
|
format_temp() {
|
||||||
|
ftemp=${1:0:2}
|
||||||
|
|
||||||
|
ftemp+="."
|
||||||
|
ftemp+=${1:2:1}
|
||||||
|
|
||||||
|
echo "${ftemp}"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#retrieve the cpu's temperature from /sys/class/thermal/thermal_zone0/temp
|
||||||
|
measure_temp() {
|
||||||
|
cpu_temp=$(cat ${THERMAL_ZONE})
|
||||||
|
|
||||||
|
formatted_temp=$(format_temp "${cpu_temp}")
|
||||||
|
|
||||||
|
echo "${formatted_temp}"
|
||||||
|
}
|
||||||
|
|
||||||
if [[ "$1" == "-h" || "$1" == "--help" ]]; then
|
if [[ "$1" == "-h" || "$1" == "--help" ]]; then
|
||||||
usage
|
usage
|
||||||
exit 0
|
exit 0
|
||||||
@@ -19,8 +39,8 @@ fi
|
|||||||
while true; do
|
while true; do
|
||||||
NOW=$(date +%s)
|
NOW=$(date +%s)
|
||||||
TS=$((NOW - START))
|
TS=$((NOW - START))
|
||||||
TEMP=$(vcgencmd measure_temp | sed 's/[^0-9.]//g')
|
TEMP=$(measure_temp)
|
||||||
echo "$TS $TEMP"
|
echo "${TS} ${TEMP}"
|
||||||
sleep 1
|
sleep 1
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|||||||
@@ -1,28 +1,47 @@
|
|||||||
#!/bin/bash
|
#! /usr/bin/env bash
|
||||||
|
VERSION="1.04"
|
||||||
usage() {
|
usage() {
|
||||||
local name=${0##*/}
|
local name=${0##*/}
|
||||||
|
|
||||||
cat <<-EOF
|
cat <<-EOF
|
||||||
Usage: ${name} [-h || --help] <logfile> <outfile> <title>
|
Version: ${VERSION}
|
||||||
|
Usage: ${name}
|
||||||
|
-h, --help display this help
|
||||||
|
-l, --logfile <logfile> logfile with temperature data to be plotted
|
||||||
|
-o, --output <output.png> output file the plotted chart should be written to
|
||||||
|
-c, --color <colorname> color in which the ghraph should be plotted ('red','blue'dtc.) defaults to 'red'
|
||||||
|
-t, --title <title> title of the graph
|
||||||
|
-v, --verbose verbose mode (not implemented yet)
|
||||||
|
|
||||||
Generates graph of the <logfile> and writes it to <outfile>
|
Plots the graph of the <logfile> and writes it to <outfile>
|
||||||
|
<logfile> must contain
|
||||||
|
timestamp temperature
|
||||||
|
in seperate lines
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
|
check() {
|
||||||
|
if ! command -v gnuplot >/dev/null 2>&1; then
|
||||||
|
echo "gnuplot is not installed."
|
||||||
|
echo "Please use"
|
||||||
|
echo " sudo apt install -y gnuplot"
|
||||||
|
echo "and try again"
|
||||||
|
exit 5
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
verbose=false
|
verbose=false
|
||||||
COLOR='red'
|
COLOR='red'
|
||||||
PADDING=5
|
PADDING=0
|
||||||
|
|
||||||
VALID_ARGS=$(getopt -o vho:c:t:l: --long verbose,help,output,color:,title:,logfile: -- "$@")
|
VALID_ARGS=$(getopt -o vho:c:t:l: --long verbose,help,output,color:,title:,logfile: -- "$@")
|
||||||
if [[ $? -ne 0 ]]; then
|
if [[ $? -ne 0 ]]; then
|
||||||
exit 1;
|
exit 1;
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "VALID_ARGS=${VALID_ARGS}"
|
|
||||||
eval set -- "$VALID_ARGS"
|
eval set -- "$VALID_ARGS"
|
||||||
while [ : ]; do
|
while [ : ]; do
|
||||||
# echo "aktueller Parameter: ${1}"
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
-h | --help)
|
-h | --help)
|
||||||
usage
|
usage
|
||||||
@@ -35,19 +54,15 @@ while [ : ]; do
|
|||||||
shift 2
|
shift 2
|
||||||
;;
|
;;
|
||||||
-o | --output)
|
-o | --output)
|
||||||
echo "1: ${1}, 2:${2},3:${3}"
|
|
||||||
OUTFILE="${2}"
|
OUTFILE="${2}"
|
||||||
echo "OUTFILE=${OUTFILE}"
|
|
||||||
shift 2
|
shift 2
|
||||||
;;
|
;;
|
||||||
-c | --color)
|
-c | --color)
|
||||||
COLOR="${2}"
|
COLOR="${2}"
|
||||||
echo "COLOR=${COLOR}"
|
|
||||||
shift 2
|
shift 2
|
||||||
;;
|
;;
|
||||||
-t | --title)
|
-t | --title)
|
||||||
TITLE="${2}"
|
TITLE="${2}"
|
||||||
echo "TITLE=${TITLE}"
|
|
||||||
shift 2
|
shift 2
|
||||||
;;
|
;;
|
||||||
-v | --verbose)
|
-v | --verbose)
|
||||||
@@ -59,7 +74,7 @@ while [ : ]; do
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
check
|
||||||
#determine max and min values
|
#determine max and min values
|
||||||
read YMIN YMAX < <(
|
read YMIN YMAX < <(
|
||||||
awk '
|
awk '
|
||||||
@@ -106,6 +121,6 @@ plot LOGFILE using 1:2 with lines lc rgb COLOR lw 2 title 'CPU-Temperatur';
|
|||||||
"
|
"
|
||||||
|
|
||||||
|
|
||||||
echo "Plot erzeugt: $OUTFILE"
|
echo "Plot generated: ${OUTFILE}"
|
||||||
exit 0
|
exit 0
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,18 @@
|
|||||||
|
#! /usr/bin/env bash
|
||||||
|
|
||||||
|
if [ -f ~/.pistressrc ]; then
|
||||||
|
. ~/.pistressrc
|
||||||
|
else
|
||||||
|
export PISTRESS_HOME=/home/pi/git/pistress
|
||||||
|
|
||||||
|
export FIO_NUMJOBS=$(nproc)
|
||||||
|
export FIO_RUNNING_TIME=3600
|
||||||
|
export THERMAL_ZONE=/sys/class/thermal/thermal_zone0/temp
|
||||||
|
fi
|
||||||
|
|
||||||
measure_temp.sh > ${1} &
|
measure_temp.sh > ${1} &
|
||||||
TPID=$!
|
TPID=$!
|
||||||
fio ~/git/pistress/fio/fio_cpu
|
fio ${PISTRESS_HOME}/fio/fio_cpu
|
||||||
kill $TPID > /dev/null
|
kill $TPID > /dev/null
|
||||||
|
unset FIO_NUMJOBS
|
||||||
|
|
||||||
|
|||||||
@@ -2,10 +2,10 @@
|
|||||||
ioengine=cpuio
|
ioengine=cpuio
|
||||||
cpuload=100
|
cpuload=100
|
||||||
cpuchunks=100000
|
cpuchunks=100000
|
||||||
runtime=3600
|
runtime=${FIO_RUNNING_TIME}
|
||||||
time_based
|
time_based
|
||||||
group_reporting
|
group_reporting
|
||||||
numjobs=4
|
numjobs=${FIO_NUMJOBS}
|
||||||
|
|
||||||
[cpu-stress]
|
[cpu-stress]
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user