Skip to content

Commit

Permalink
new scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
UmakantKulkarni committed Sep 15, 2021
1 parent c3c7ccc commit 2c3ee8f
Show file tree
Hide file tree
Showing 3 changed files with 89 additions and 63 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.DS_Store
18 changes: 18 additions & 0 deletions delUnwantedDataTop.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env bash

for exp in Blocking-Api-Disabled/* ;
do
echo $exp
f1=`basename $exp`
for subexp in `seq 100 100 1000`
do
for p in `seq 0 1 10`
do
filename=$exp/$subexp/top_data_node${p}.txt
echo "Working on $filename"
awk '/open5gs|docker|kube|calico|container|bash|python|systemd-journal|2021-|top -|Tasks:|Cpu\(s\)|MiB Mem|MiB Swap:/' $filename > $filename-tmp
sed '/2021-/s/^/\n/' $filename-tmp > $filename
rm -f $filename-tmp
done
done
done
133 changes: 70 additions & 63 deletions getCpuVsQueue.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,71 +2,78 @@

for exp in Run4/* ;
do
if [[ $exp =~ "Blocking-Api-Disabled" || $exp =~ "Fully-Procedural-Stateless" ]]; then
echo "Working on $exp"
echo " "
f1=`basename $exp`
for subexp in `seq 100 100 1000`
echo "Working on $exp"
echo " "
f1=`basename $exp`
for subexp in `seq 100 100 1000`
do
for j in `seq 0 1 10`
do
for j in `seq 0 1 10`
do
amfTopFile=$exp/$f1-$j/$subexp/top_data_node1.txt
topCpuOpFile=$exp/$f1-$j/$subexp/topCpuOp.csv
queueLenFile=$exp/$f1-$j/$subexp/queueLen.csv
rm -f $topCpuOpFile
rm -f $queueLenFile

echo "Working on $topCpuOpFile"
echo "UTC-Time, Time-Diff, CPU-Usage" >> $topCpuOpFile
timestamps=( $(cat $amfTopFile | grep 2021- | grep -o '\-\-.*' | cut -c 3-) )
amfTopFile=$exp/$f1-$j/$subexp/top_data_node1.txt
topCpuOpFile=$exp/$f1-$j/$subexp/topCpuOp.csv
queueLenFile=$exp/$f1-$j/$subexp/queueLen.csv
rm -f $topCpuOpFile
rm -f $queueLenFile

echo "Working on $topCpuOpFile"
sjCount=$(cat $amfTopFile | grep systemd-journal | wc -l)
echo "UTC-Time, Time-Diff, CPU-Usage" >> $topCpuOpFile
timestamps=( $(cat $amfTopFile | grep 2021- | grep -o '\-\-.*' | cut -c 3-) )
if (( $sjCount < 5 )); then
timestamps=("${timestamps[@]:1}")
cpusage=( $(cat $amfTopFile | grep open5gs-amfd | awk '{print $9}') )
basecpu="0.0"
k=0
for i in "${!cpusage[@]}";
do
if (( $(echo "${cpusage[$i]} > $basecpu" |bc -l) )); then
mdtTs=${timestamps[$i]}
if [[ $k == 0 ]]; then
firstTs=$(TZ=UTC date -d "$mdtTs MDT - 0.2 second" +'%T.%3N')
firstEpochTs=$(date -d "$firstTs" +"%s.%3N")
echo "$firstTs, 0, $basecpu" >> $topCpuOpFile
fi
utcTs=$(TZ=UTC date -d "$mdtTs MDT" +'%T.%3N')
epochTs=$(date -d "$utcTs" +"%s.%3N")
timediff=$(echo -e "$epochTs-$firstEpochTs" | bc)
timediff=$(echo -e "$timediff*1000" | bc | rev | cut -c 5- | rev)
echo "$utcTs, $timediff, ${cpusage[$i]}" >> $topCpuOpFile
k=$k+1
fi
cpusage=( $(cat $amfTopFile | grep open5gs-amfd | awk '{print $9}') )
basecpu="0.0"
k=0
for i in "${!cpusage[@]}";
do
if (( $(echo "${cpusage[$i]} > $basecpu" |bc -l) )); then
mdtTs=${timestamps[$i]}
if [[ $k == 0 ]]; then
firstTs=$(TZ=UTC date -d "$mdtTs MDT - 0.2 second" +'%T.%3N')
firstEpochTs=$(date -d "$firstTs" +"%s.%3N")
echo "$firstTs, 0, $basecpu" >> $topCpuOpFile
fi
done
utcTs=$(TZ=UTC date -d "$mdtTs MDT + 0.2 second" +'%T.%3N')
epochTs=$(date -d "$utcTs" +"%s.%3N")
timediff=$(echo -e "$epochTs-$firstEpochTs" | bc)
timediff=$(echo -e "$timediff*1000" | bc | rev | cut -c 5- | rev)
echo "$utcTs, $timediff, $basecpu" >> $topCpuOpFile

echo "Working on $queueLenFile"
echo "UTC-Time, Time-Diff, Queue-Length" >> $queueLenFile
mints=$(date -d "$(cat $topCpuOpFile | sed -n 2p | awk '{print $1}' | rev | cut -c 2- | rev)" +"%s.%3N")
maxts=$(date -d "$(cat $topCpuOpFile | tail -n1 | awk '{print $1}' | rev | cut -c 2- | rev)" +"%s.%3N")
utcTs=( $(cat $exp/$f1-$j/$subexp/open5gs-amf-deployment-*_logs.txt | grep " ogs_queue_size is" | grep "PCS " | awk '{print $2}' | sed -r "s/\x1B\[([0-9]{1,3}(;[0-9]{1,2})?)?[mGK]//g" | rev | cut -c 2- | rev) )
queuelens=( $(cat $exp/$f1-$j/$subexp/open5gs-amf-deployment-*_logs.txt | grep " ogs_queue_size is" | grep "PCS " | awk '{print $9}') )
for i in "${!utcTs[@]}";
do
epochTs=$(date -d "${utcTs[$i]}" +"%s.%3N")
if (( $(echo "$epochTs > $mints" |bc -l) )); then
if (( $(echo "$epochTs < $maxts" |bc -l) )); then
timediff=$(echo -e "$epochTs-$mints" | bc)
timediff=$(echo -e "$timediff*1000" | bc | rev | cut -c 5- | rev)
echo "${utcTs[$i]}, $timediff, ${queuelens[$i]}" >> $queueLenFile
k=$k+1
fi
utcTs=$(TZ=UTC date -d "$mdtTs MDT" +'%T.%3N')
epochTs=$(date -d "$utcTs" +"%s.%3N")
timediff=$(echo -e "$epochTs-$firstEpochTs" | bc)
timediff=$(echo -e "$timediff*1000" | bc | rev | cut -c 5- | rev)
echo "$utcTs, $timediff, ${cpusage[$i]}" >> $topCpuOpFile
k=$k+1
fi
done
utcTs=$(TZ=UTC date -d "$mdtTs MDT + 0.2 second" +'%T.%3N')
epochTs=$(date -d "$utcTs" +"%s.%3N")
timediff=$(echo -e "$epochTs-$firstEpochTs" | bc)
timediff=$(echo -e "$timediff*1000" | bc | rev | cut -c 5- | rev)
echo "$utcTs, $timediff, $basecpu" >> $topCpuOpFile

echo "Working on $queueLenFile"
echo "UTC-Time, Time-Diff, Queue-Length" >> $queueLenFile
mints=$(date -d "$(cat $topCpuOpFile | sed -n 2p | awk '{print $1}' | rev | cut -c 2- | rev)" +"%s.%3N")
maxts=$(date -d "$(cat $topCpuOpFile | tail -n1 | awk '{print $1}' | rev | cut -c 2- | rev)" +"%s.%3N")
#utcTs=( $(cat $exp/$f1-$j/$subexp/open5gs-amf-deployment-*_logs.txt | grep " ogs_queue_size is" | grep "PCS " | awk '{print $2}' | sed -r "s/\x1B\[([0-9]{1,3}(;[0-9]{1,2})?)?[mGK]//g" | rev | cut -c 2- | rev) )
#queuelens=( $(cat $exp/$f1-$j/$subexp/open5gs-amf-deployment-*_logs.txt | grep " ogs_queue_size is" | grep "PCS " | awk '{print $9}') )
cat $exp/$f1-$j/$subexp/open5gs-amf-deployment-*_logs.txt | grep " ogs_queue_size is" | grep "PCS " | awk '{print $2}' | sed -r "s/\x1B\[([0-9]{1,3}(;[0-9]{1,2})?)?[mGK]//g" | rev | cut -c 2- | rev > /tmp/utcTs.txt
cat $exp/$f1-$j/$subexp/open5gs-amf-deployment-*_logs.txt | grep " ogs_queue_size is" | grep "PCS " | awk '{print $9}' > /tmp/queuelens.txt
i=0
while IFS="" read -r line || [ -n "$line" ]
do
lineNum=$(( ++i ))
epochTs=$(date -d "$line" +"%s.%3N")
if (( $(echo "$epochTs > $mints" |bc -l) )); then
if (( $(echo "$epochTs < $maxts" |bc -l) )); then
timediff=$(echo -e "$epochTs-$mints" | bc)
timediff=$(echo -e "$timediff*1000" | bc | rev | cut -c 5- | rev)
qln=$(cat /tmp/queuelens.txt | sed -n ${lineNum}p)
echo "$line, $timediff, $qln" >> $queueLenFile
fi
done
echo "Completed processing files from $exp/$f1-$j/$subexp/"
echo " "
done
done
fi
fi
done < /tmp/utcTs.txt
rm -f /tmp/utcTs.txt
rm -f /tmp/queuelens.txt
echo "Completed processing files from $exp/$f1-$j/$subexp/"
echo " "
done
done
done

0 comments on commit 2c3ee8f

Please sign in to comment.