#!/map/sys/bin/perl
#!/usr/local/bin/perl

@machines = (
	     "Cray T94;1;1995;1800;1740",
	     "Cray C90;1;1993;952;1187",
	     "Cray Y-MP;1;1989;333;424",
#	     "circa 1989\\\nworkstations;;;5;5",
	     "CM-5;32;1992;4000;1547;-Bold",
	     "DEC 8400;4;1995;2400;82;-Bold"
	     );

$header = "newgraph
xaxis size 9 min 0 max 4500
xaxis hash_labels font Helvetica fontsize 11 hash_format G
xaxis label font Helvetica fontsize 14 : Theoretical Peak Floating Point Performance (64-bit MFlop/s)
yaxis size 4 min 0 max 2000
yaxis hash_labels font Helvetica fontsize 11 hash_format G
yaxis label font Helvetica fontsize 14 : Main Memory Bandwidth (64-bit MWord/s)
";

$legend = "legend defaults
 font Helvetica fontsize 12 x 2000 y 888 hjl vjc
 linebreak 30
";

open(TMP,">tmp.jg");
print TMP $header;
print TMP $legend;

sub print_entry {
    local($entry) = @_;
    local($name,$nprocs,$year,$mflops,$mwords,$bold) = split(";",$entry);
    local($font) = "Helvetica$bold";
    local($label);
    local($labelx) = $mflops + 70;
    local($labely) = $mwords + 30;

    if ($nprocs) {
	$label = "$name\\\n$nprocs proc/$year\n";
    }
    else {
	$label = $name;
    }
    
    print TMP "newstring x $labelx y $labely font $font fontsize 14 linesep 8 vjb hjl : $label\n";
    print TMP "newcurve marktype box fill .5 marksize 50 50 pts $mflops $mwords\n\n";
}

foreach $entry (@machines) {
    &print_entry($entry);
}

# Pre 1991 Workstations
print TMP "newstring x 400 y 160 font Helvetica fontsize 14 linesep 6 vjc hjl : circa 1989\\\n";
print TMP "workstations\n";
print TMP "\n";
print TMP "newcurve marktype none rarrow linetype solid linethickness 2 asize 70 50 pts 350 150 175 100 10 10\n";
print TMP "\n";


close(TMP);

`jgraph tmp.jg > tmp.ps; ghostview tmp.ps`;
