3 # --- T2-COPYRIGHT-NOTE-BEGIN ---
4 # T2 SDE: scripts/Create-ParaSim
5 # Copyright (C) 2004 - 2023 The T2 SDE Project
6 # Copyright (C) 1998 - 2003 ROCK Linux Project
8 # This Copyright note is generated by scripts/Create-CopyPatch,
9 # more information can be found in the files COPYING and README.
11 # This program is free software; you can redistribute it and/or modify
12 # it under the terms of the GNU General Public License version 2.
13 # --- T2-COPYRIGHT-NOTE-END ---
20 -cfg) config
=$2; shift; shift ;;
21 -jobs) jobs=$2 ; shift; shift ;;
22 -x11) x11
=1 ; shift ;;
23 *) echo "Usage: $0 [ -cfg config ] [ -x11 ]" \
29 .
scripts
/parse-config
31 dir
=src.parasim.$
(cksum config
/$config/packages | cut
-f1 -d' ')
32 echo "Building parasim in $dir"
36 for x
in $
(echo $jobs |
tr , ' '); do
37 [ $maxjobs -lt $x ] && maxjobs
=$x
38 if [ ! -f "$dir/parasim_$x.dat" ]; then
40 perl
scripts
/parasim2.pl
$dir $config $x
42 echo "Using cached data in $dir/parasim_$x.dat"
46 jobstotal
=$
(echo `wc -l < $dir/parasim_$maxjobs.dat`)
47 echo 'set data style lines'
48 echo 'set title "T2 Parallel Build' \
49 'Simulation ('$jobstotal' Jobs Total)"'
50 echo 'set xlabel "Hours (on reference hardware)"'
51 echo 'set ylabel "Parallel Jobs"'
52 echo "plot [0:*] [0:$(($maxjobs + 1))] \\"
54 for x
in $
(echo $jobs |
tr , ' '); do
55 tm
=$
(tail -n 1 $dir/parasim_
$x.dat | cut
-f1 |
56 awk -F.
'{ printf("%02d:%02d\n",
57 $1, 60*("0." $2)); }')
58 echo -en "$next"; next
=', \\\n'
59 echo -n " \"parasim_$x.dat\" title \"Build with" \
60 "$x parallel jobs ($tm)\" with steps lw 3"
62 } > $dir/parasim_
$jobs.gnuplot
64 cmd
="perl scripts/parasim3.pl"
65 for x
in $
(echo $jobs |
tr , ' ')
66 do cmd
="$cmd $dir/parasim_$x.dat"; done
67 eval "$cmd" > $dir/parasim_
$jobs.txt
69 if [ "$x11" = 1 ]; then
70 cd $dir; gnuplot
-persist parasim_
$jobs.gnuplot
72 cat $dir/parasim_
$jobs.txt
79 if [ ! -f $dir/parasim.dat
]; then
80 echo -n "Simulation running"
81 rm -rf $dir/logs
$dir/parasim.new
84 scripts
/Create-PkgQueue
-cfg $config \
85 -logdir $dir/logs |
sort -r -n -k2 > $dir/queue.txt
88 next
="`head -n 1 $dir/queue.txt`"; set $next
89 qid
="$1-$6"; touch $dir/logs
/$qid.log
91 printf "%5d %5d %-30s %s\n" $
(wc -l < $dir/queue.txt
) \
92 $2 $qid "$(cut -f1,7 -d' ' $dir/queue.txt |
93 tail -n +2 | tr '\n ' ' -')" >> $dir/parasim.new
97 mv $dir/parasim.new
$dir/parasim.dat
100 echo "Using cached data in $dir/parasim.dat"
103 jobstotal
=$
(echo `wc -l < $dir/parasim.dat`)
104 cat > $dir/parasim.gnuplot
<<- EOT
105 set title "T2 Parallel Build Simulation ($jobstotal Jobs Total)"
106 set xlabel "Number of Jobs build so far"
107 set ylabel "Possible Parallel Jobs"
108 plot 'parasim.dat' using 1 title "Parallel Jobs" with steps lw 3
111 perl
scripts
/parasim1.pl
$dir/parasim.dat
0 > $dir/parasim.txt
113 if [ "$x11" = 1 ]; then
114 cd $dir; gnuplot
-persist parasim.gnuplot