3 # --- T2-COPYRIGHT-NOTE-BEGIN ---
4 # This copyright note is auto-generated by scripts/Create-CopyPatch.
6 # T2 SDE: scripts/Create-ParaSim
7 # Copyright (C) 2004 - 2021 The T2 SDE Project
8 # Copyright (C) 1998 - 2003 ROCK Linux Project
10 # More information can be found in the files COPYING and README.
12 # This program is free software; you can redistribute it and/or modify
13 # it under the terms of the GNU General Public License as published by
14 # the Free Software Foundation; version 2 of the License. A copy of the
15 # GNU General Public License can be found in the file COPYING.
16 # --- T2-COPYRIGHT-NOTE-END ---
23 -cfg) config
=$2; shift; shift ;;
24 -jobs) jobs=$2 ; shift; shift ;;
25 -x11) x11
=1 ; shift ;;
26 *) echo "Usage: $0 [ -cfg config ] [ -x11 ]" \
32 .
scripts
/parse-config
34 dir
=src.parasim.$
(cksum config
/$config/packages | cut
-f1 -d' ')
35 echo "Building parasim in $dir"
39 for x
in $
( echo $jobs |
tr , ' ' ); do
40 [ $maxjobs -lt $x ] && maxjobs
=$x
41 if [ ! -f "$dir/parasim_$x.dat" ]; then
43 perl
scripts
/parasim2.pl
$dir $config $x
45 echo "Using cached data in $dir/parasim_$x.dat"
49 jobstotal
=$
( echo `wc -l < $dir/parasim_$maxjobs.dat` )
50 echo 'set data style lines'
51 echo 'set title "T2 Parallel Build' \
52 'Simulation ('$jobstotal' Jobs Total)"'
53 echo 'set xlabel "Hours (on reference hardware)"'
54 echo 'set ylabel "Parallel Jobs"'
55 echo "plot [0:*] [0:$(( $maxjobs + 1 ))] \\"
57 for x
in $
( echo $jobs |
tr , ' ' ); do
58 tm
=$
( tail -n 1 $dir/parasim_
$x.dat | cut
-f1 | \
59 awk -F.
'{ printf("%02d:%02d\n",
60 $1, 60*("0." $2)); }' )
61 echo -en "$next"; next
=', \\\n'
62 echo -n " \"parasim_$x.dat\" title \"Build with" \
63 "$x parallel jobs ($tm)\" with steps lw 3"
65 } > $dir/parasim_
$jobs.gnuplot
67 cmd
="perl scripts/parasim3.pl"
68 for x
in $
( echo $jobs |
tr , ' ' )
69 do cmd
="$cmd $dir/parasim_$x.dat"; done
70 eval "$cmd" > $dir/parasim_
$jobs.txt
72 if [ "$x11" = 1 ]; then
73 cd $dir; gnuplot
-persist parasim_
$jobs.gnuplot
75 cat $dir/parasim_
$jobs.txt
82 if [ ! -f $dir/parasim.dat
]; then
83 echo -n "Simulation running"
84 rm -rf $dir/logs
$dir/parasim.new
87 scripts
/Create-PkgQueue
-cfg $config \
88 -logdir $dir/logs |
sort -r -n -k2 > $dir/queue.txt
91 next
="`head -n 1 $dir/queue.txt`"; set $next
92 qid
="$1-$6"; touch $dir/logs
/$qid.log
94 printf "%5d %5d %-30s %s\n" $
(wc -l < $dir/queue.txt
) \
95 $2 $qid "$( cut -f1,7 -d' ' $dir/queue.txt | \
96 tail -n +2 | tr '\n ' ' -' )" >> $dir/parasim.new
100 mv $dir/parasim.new
$dir/parasim.dat
103 echo "Using cached data in $dir/parasim.dat"
106 jobstotal
=$
( echo `wc -l < $dir/parasim.dat` )
107 cat > $dir/parasim.gnuplot
<<- EOT
108 set title "T2 Parallel Build Simulation ($jobstotal Jobs Total)"
109 set xlabel "Number of Jobs build so far"
110 set ylabel "Possible Parallel Jobs"
111 plot 'parasim.dat' using 1 title "Parallel Jobs" with steps lw 3
114 perl
scripts
/parasim1.pl
$dir/parasim.dat
0 > $dir/parasim.txt
116 if [ "$x11" = 1 ]; then
117 cd $dir; gnuplot
-persist parasim.gnuplot