mirror of
https://github.com/weaveworks/scope.git
synced 2026-03-04 02:30:45 +00:00
Symptoms: ``` extras/dialer/time-scope-probe-cgroup:31:18: arithmetic expressions must consist of names and numbers extras/dialer/time-scope-probe-cgroup: run shfmt -i 4 -w extras/dialer/time-scope-probe-cgroup extras/dialer/time-scope-probe-proc:28:18: arithmetic expressions must consist of names and numbers extras/dialer/time-scope-probe-proc: run shfmt -i 4 -w extras/dialer/time-scope-probe-proc extras/in_parallel.sh:29:16: arithmetic expressions must consist of names and numbers extras/in_parallel.sh: run shfmt -i 4 -w extras/in_parallel.sh ``` Visible on https://circleci.com/gh/kinvolk/scope/980
39 lines
956 B
Bash
Executable File
39 lines
956 B
Bash
Executable File
#!/bin/bash
|
|
set -eu
|
|
if [ $EUID -ne 0 ]; then
|
|
echo "You must be root!" >&2
|
|
exit 1
|
|
fi
|
|
|
|
readonly interval_num=${1:-60}
|
|
readonly interval_sleep=${2:-10}
|
|
|
|
TIME_U1=0
|
|
TIME_K1=0
|
|
TIME_T1=0
|
|
TIME_U2=0
|
|
TIME_K2=0
|
|
TIME_T2=0
|
|
|
|
if [ "$(pidof scope-probe)" == "" ]; then
|
|
echo "No scope-probe process running - aborting" >&2
|
|
exit 1
|
|
fi
|
|
|
|
TIME_U2=$(gawk '{print $14"*10"}' <"/proc/$(pidof scope-probe)/stat" | bc)
|
|
TIME_K2=$(gawk '{print $15"*10"}' <"/proc/$(pidof scope-probe)/stat" | bc)
|
|
TIME_T2=$((TIME_U2 + TIME_K2))
|
|
|
|
echo "utime;stime;total_time"
|
|
for ((i = 0; i < interval_num; i++)); do
|
|
sleep "$interval_sleep"
|
|
TIME_U1=$TIME_U2
|
|
TIME_K1=$TIME_K2
|
|
TIME_T1=$TIME_T2
|
|
|
|
TIME_U2=$(gawk '{print $14"*10"}' <"/proc/$(pidof scope-probe)/stat" | bc)
|
|
TIME_K2=$(gawk '{print $15"*10"}' <"/proc/$(pidof scope-probe)/stat" | bc)
|
|
TIME_T2=$((TIME_U2 + TIME_K2))
|
|
echo "$((TIME_U2 - TIME_U1));$((TIME_K2 - TIME_K1));$((TIME_T2 - TIME_T1))"
|
|
done
|