Last active
September 29, 2016 10:29
-
-
Save soyo42/181a4cb885932ada84cfe6973d6c9281 to your computer and use it in GitHub Desktop.
collect times from multiple cluster nodes, evaluate diffs and show results in gnuplot chart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
this is project name keeper |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
*date | |
*data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import sys | |
import datetime | |
if len(sys.argv) < 3: | |
sys.stderr.write('usage:: {0} <date log1> <date log2> [<dateLog3> ...]\n'.format(sys.argv[0])) | |
sys.exit(1) | |
DATE_FORMAT = '%H:%M:%S.%f' | |
allStamps = [] | |
for dateLog in sys.argv[1:]: | |
with open(dateLog, 'r') as dl: | |
logs = [] | |
for line in dl: | |
#print(line.strip()) | |
stamp = datetime.datetime.strptime(line[:12], DATE_FORMAT) | |
logs.append(stamp) | |
allStamps.append((dateLog, logs)) | |
header = False | |
for idx in range(len(allStamps[0][1])): | |
stamps = [] | |
for host in allStamps: | |
stamps.append(host[1][idx]) | |
if not header: | |
print('n/a ' + ' '.join(sys.argv[1:])) | |
header = True | |
#reduce | |
for s in reversed(range(len(stamps))): | |
stamps[s] = (stamps[s] - stamps[0]).total_seconds() | |
sys.stdout.write('{0:d} '.format(idx)) | |
for s in stamps: | |
sys.stdout.write('{0:6.3f} '.format(s)) | |
print('') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# measure | |
rm *date; for i in {1..20}; do ./measureTimes.sh hilda tilda matilda; sleep 1.3; done | |
# process | |
./evaluateDates.py *date > all.data | |
# show in gnuplot | |
./showChart.sh all.data | |
# ALL IN ONE | |
#./quickStart.sh 20 hilda tilda matilda | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ -z "$1" ]; then | |
echo "usage:: $0 <host1> [<host2> [<host3> ..]]" | |
exit 1 | |
fi | |
while read i; do | |
echo "START[$i]" | |
(ssh $i "date +'%H:%M:%S.%N'" >> $i.date; echo "DONE[$i]") & | |
done < <(shuf -e $@); | |
wait | |
echo "# measurement done" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ -z "$1" ]; then | |
echo "usage:: $0 <amount of measure loops> <node1> <node2> [<node3> ..]" | |
exit 1 | |
fi | |
loops=$1 | |
shift | |
# measure | |
rm *date; | |
for (( i=1; i<=${loops}; i++ )); do | |
echo -e "\e[32m#ROUND $i#\e[0m" | |
./measureTimes.sh $@ | |
sleep 2.3 | |
done | |
# process | |
dataName="timeMeasure-$(date +'%Y%m%d-%H%M%S').data" | |
./evaluateDates.py *date > ${dataName} | |
cat ${dataName} | |
# show chart | |
./showChart.sh ${dataName} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ -z "$1" ]; then | |
echo "usage:: $0 <data file name>" | |
exit 1 | |
fi | |
gnuplot -p <<EOF | |
set grid; | |
set lmargin 10; | |
set rmargin 2.5; | |
set xlabel "step"; | |
set ylabel "time diff [s]"; | |
set title "time stamps comparison"; | |
set key autotitle columnhead; | |
name0="$1"; | |
$( | |
while read i; do | |
if (( ${i} > 2 )); then | |
echo -n 're' | |
fi | |
echo "plot name0 using 1:${i} with lines;" | |
done < <(seq 2 $(head -n 1 $1 | wc -w)) | |
) | |
pause -1 | |
EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment