import java.applet.Applet; import java.awt.*; import java.net.*; import java.io.*; import java.util.*; class StatsGraph extends Canvas { double max_mflops = 0.0; Vector data_list = new Vector(10); boolean couldnt_load = false; double mflops_result = 0.0; double residn_result = 0.0; double time_result = 0.0; double eps_result = 0.0; void load_graph() { String temp = "\"scale\" 0 \"scale\" 1.3\n \"1\" 3 \"JIT Intel P6/200\" 13.733\n \"2\" 1 \"JIT Intel P6/200\" 11.444\n \"3\" 4 \"JIT Intel P6/200\" 8.583\n \"4\" 2 \"JIT Intel P6/200\" 7.63\n \"5\" 6 \"JIT Intel P5/120\" 6.242\n \"6\" 5 \"JIT Intel P5/133\" 5.242\n \"7\" 3 \"JIT Intel P5/90\" 4.292\n \"8\" 7 \"JIT Intel P5/133\" 3.815\n \"9\" 3 \"JIT Intel P5/90\" 3.121\n \"10\" 3 \"JIT Intel 486/100\" 2.543\n \"11\" 4 \"JIT AMD 486/133\" 1.561\n \"12\" 2 \"DEC Alpha AS8400/350\" 1.075\n \"13\" 1 \"PowerMac 8500/120\" 0.551\n \"14\" 5 \"HP 712/80\" 0.26\n 0.551 Mflop/s in 1.25 secs ; Mac Mac OS PowerMac 8500/120 ; 29 Jun 96, Robert Schmidt (rschmidt@panix.com)\n 0.26 Mflop/s in 2.64 secs ; HP 712/80 ; 14 May 96, Hugh Vidos (vidos@research.cs.orst.edu)\n"; StringBufferInputStream is = new StringBufferInputStream(temp); StreamTokenizer st = new StreamTokenizer(is); /* allow various commenting methods */ st.commentChar('#'); st.slashStarComments(true); st.slashSlashComments(true); st.quoteChar('"'); st.parseNumbers(); // TT_NUMBER , nval try { while (st.TT_EOF != st.nextToken()) { double mflops = 0.0; String label = ""; String info = ""; int itemtype = 0; DataItem item; // first item label while ('"'!=st.ttype && st.TT_EOF != st.nextToken()) /*spin*/; if ('"'==st.ttype) { label = st.sval; } // second item itemtype while (st.TT_NUMBER!=st.ttype && st.TT_EOF != st.nextToken()) /*spin*/; if (st.TT_NUMBER==st.ttype) { itemtype = (int)st.nval; } // third item info while ('"'!=st.ttype && st.TT_EOF != st.nextToken()) /*spin*/; if ('"'==st.ttype) { info = st.sval; } // second fourth mflops while (st.TT_NUMBER!=st.ttype && st.TT_EOF != st.nextToken()) /*spin*/; if (st.TT_NUMBER==st.ttype) { mflops = st.nval; if (mflops > max_mflops) max_mflops = mflops; item = new DataItem(mflops, itemtype, info, label); data_list.addElement(item); } } } catch (Exception e) { couldnt_load = true; return; } try { is.close(); } catch (Exception e) { couldnt_load = true; return; } } public void paint(Graphics g) { Font font = g.getFont(); // save the default font Font minifont = new Font(font.getName(), font.getStyle(), 8); // smaller int pad=20; if (mflops_result > max_mflops) max_mflops = mflops_result; // clear background g.setColor(getBackground()); g.fillRect(1, 1, size().width - 2, size().height - 2); g.setColor(getForeground()); if (couldnt_load) { g.drawString("Error: couldn't load Linpack data file", 10,50); return; } DataItem item; int i; // pad is size of border around bars area, same on all 3 sides // 0 element is not displayed, it is the scale (max value) int x, y2; int w,h; // width and height excluding pad w = size().width - pad*2; h = size().height- pad*2; for (i=1; i100) { g.setColor(Color.yellow); g.drawString("Warning: there appears to be a problem with", 30, 30); g.drawString("the floating point arithmetic on this machine!!", 30, 50); } } } void drawStringRising(Graphics g, int rise, String s, int x, int y) { // for each char : draw, rise char chars[] = s.toCharArray(); String _s; FontMetrics fm = g.getFontMetrics(); int l=s.length(); for (int i=0; i