dodb.cr/paper/legend.grap

135 lines
2.5 KiB
Plaintext

define boite {
xleft = $1
xright = $2
yup = $3
ydown = $4
line from xleft,ydown to xright,ydown
line from xleft,yup to xright,yup
line from xleft,yup to xleft,ydown
line from xright,yup to xright,ydown
}
define legend_line {
cy = $1
lstartx = $2
lendx = $3
tstartx = $4
.gcolor $5
line from lstartx,cy to lendx,cy
.gcolor
$6 ljust at tstartx,cy
}
define legend {
xleft = $1
xright = $2
yup = $3
ydown = $4
diffx = xright - xleft
diffy = yup - ydown
hdiff = diffy/5.7
cy = yup - (diffy/6)
cx = (diffx/20) + xleft
lstartx = cx
lendx = cx + diffx/8
tstartx = lendx + diffx/20
.ps -2
legend_line(cy,lstartx,lendx,tstartx,red,"RAM only")
cy = cy - hdiff
legend_line(cy,lstartx,lendx,tstartx,black,"Cached db and index")
cy = cy - hdiff
legend_line(cy,lstartx,lendx,tstartx,pink,"FIFO db and cached index")
cy = cy - hdiff
legend_line(cy,lstartx,lendx,tstartx,blue,"Uncached db, cached index")
cy = cy - hdiff
legend_line(cy,lstartx,lendx,tstartx,green,"Uncached db and index")
.ps +2
}
define legend_common {
xleft = $1
xright = $2
yup = $3
ydown = $4
diffx = xright - xleft
diffy = yup - ydown
hdiff = diffy/4.5
cy = yup - (diffy/6)
cx = (diffx/20) + xleft
lstartx = cx
lendx = cx + diffx/8
tstartx = lendx + diffx/20
.ps -2
legend_line(cy,lstartx,lendx,tstartx,red,"1k")
cy = cy - hdiff
legend_line(cy,lstartx,lendx,tstartx,green,"5k")
cy = cy - hdiff
legend_line(cy,lstartx,lendx,tstartx,black,"10k")
cy = cy - hdiff
legend_line(cy,lstartx,lendx,tstartx,pink,"20k")
.ps +2
}
define legend_fifo_addition {
xleft = $1
xright = $2
yup = $3
ydown = $4
diffx = xright - xleft
diffy = yup - ydown
hdiff = diffy/3.5
cy = yup - (diffy/10)
cx = (diffx/20) + xleft
lstartx = cx
lendx = cx + diffx/8
tstartx = lendx + diffx/20
.ps -2
cy = cy - hdiff
legend_line(cy,lstartx,lendx,tstartx,orange,"Basic FIFO")
cy = cy - hdiff
legend_line(cy,lstartx,lendx,tstartx,green,"Efficient FIFO")
.ps +2
}
# WARNING: this macro uses "cx" (current x), y_scale and "ox" (old x).
define line_no_mustache {
# $1 = cbram
# $2 = obram
# $3 = column
# $4 = color
$1 = $3/y_scale
.gcolor $4
if ($2 > 0) then {line from cx,$1 to ox,$2}
bullet at cx,$1
.gcolor
$2 = $1
}
# WARNING: this macro uses "cx" (current x), y_scale and "ox" (old x).
define line_with_mustache {
# $1 = cbram
# $2 = obram
# $3 = column
# $4 = color
# $5 = column mustache 1
# $6 = column mustache 2
line_no_mustache($1,$2,$3,$4)
line from cx,$5/y_scale to cx,$6/y_scale
}