1 /*
2 * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 *
8 * - Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 *
11 * - Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 *
15 * - Neither the name of Oracle nor the names of its
16 * contributors may be used to endorse or promote products derived
17 * from this software without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
20 * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
21 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
43 import java.io.PrintWriter;
44 import java.io.FileReader;
45 import java.io.FileWriter;
46 import java.io.LineNumberReader;
47 import java.io.FileNotFoundException;
48 import java.io.IOException;
49 import java.io.File;
50 import java.awt.Frame;
51 import java.awt.Dimension;
52 import java.awt.BorderLayout;
53 import java.awt.event.ActionListener;
54 import java.awt.event.ActionEvent;
55 import java.awt.event.WindowAdapter;
56 import java.awt.event.WindowEvent;
57 import javax.swing.JFrame;
58 import javax.swing.JButton;
59 import javax.swing.JPanel;
60 import javax.swing.BoxLayout;
61 import javax.swing.JFileChooser;
62 import javax.swing.JOptionPane;
63 import java.text.SimpleDateFormat;
64 import java.util.Date;
65
66 import j2dbench.tests.GraphicsTests;
67 import j2dbench.tests.ImageTests;
68 import j2dbench.tests.MiscTests;
69 import j2dbench.tests.RenderTests;
70 import j2dbench.tests.PixelTests;
71 import j2dbench.tests.iio.IIOTests;
72 import j2dbench.tests.cmm.CMMTests;
73 import j2dbench.tests.text.TextConstructionTests;
74 import j2dbench.tests.text.TextMeasureTests;
75 import j2dbench.tests.text.TextRenderTests;
76 import j2dbench.tests.text.TextTests;
77
78 public class J2DBench {
79 static Group progoptroot;
80
81 static Option.Enable verbose;
82 static Option.Enable printresults;
359 if (error != null) {
360 System.err.println("Invalid rate: "+error);
361 usage(1);
362 }
363 } else {
364 String reason = Group.root.setOption(arg);
365 if (reason != null) {
366 System.err.println("Option "+arg+" ignored: "+reason);
367 }
368 }
369 }
370 if (verbose.isEnabled()) {
371 Group.root.traverse(new Node.Visitor() {
372 public void visit(Node node) {
373 System.out.println(node);
374 }
375 });
376 }
377
378 if (gui) {
379 startGUI();
380 } else {
381
382 long start = System.currentTimeMillis();
383
384 int nLoopCount = 1;
385
386 if (saveresults) {
387 if (title == null) {
388 title = inputUserStr("title");
389 }
390 if (desc == null) {
391 desc = inputUserStr("description");
392 }
393 }
394
395 PrintWriter writer = null;
396
397 if (J2DBench.looping) {
398
399 System.out.println("\nAbout to run tests for : " +
755 if (saveResults()) {
756 lastResults = null;
757 }
758 }
759 });
760 p.add(b);
761
762 b = new JButton("Quit");
763 b.addActionListener(new ActionListener() {
764 public void actionPerformed(ActionEvent e) {
765 if (!saveOrDiscardLastResults()) {
766 return;
767 }
768 System.exit(0);
769 }
770 });
771 p.add(b);
772
773 f.getContentPane().add(p, BorderLayout.SOUTH);
774 f.pack();
775 f.show();
776 }
777
778 public static void runTests(boolean showresults) {
779 final TestEnvironment env = new TestEnvironment();
780 Frame f = null;
781 if (showresults) {
782 f = new Frame("J2DBench test run");
783 f.addWindowListener(new WindowAdapter() {
784 public void windowClosing(WindowEvent e) {
785 env.stop();
786 }
787 });
788 f.add(env.getCanvas());
789 f.pack();
790 f.show();
791 }
792 for (int i = 0; i < 5; i++) {
793 env.idle();
794 }
|
1 /*
2 * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 *
8 * - Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 *
11 * - Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 *
15 * - Neither the name of Oracle nor the names of its
16 * contributors may be used to endorse or promote products derived
17 * from this software without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
20 * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
21 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
43 import java.io.PrintWriter;
44 import java.io.FileReader;
45 import java.io.FileWriter;
46 import java.io.LineNumberReader;
47 import java.io.FileNotFoundException;
48 import java.io.IOException;
49 import java.io.File;
50 import java.awt.Frame;
51 import java.awt.Dimension;
52 import java.awt.BorderLayout;
53 import java.awt.event.ActionListener;
54 import java.awt.event.ActionEvent;
55 import java.awt.event.WindowAdapter;
56 import java.awt.event.WindowEvent;
57 import javax.swing.JFrame;
58 import javax.swing.JButton;
59 import javax.swing.JPanel;
60 import javax.swing.BoxLayout;
61 import javax.swing.JFileChooser;
62 import javax.swing.JOptionPane;
63 import javax.swing.SwingUtilities;
64
65 import java.text.SimpleDateFormat;
66 import java.util.Date;
67
68 import j2dbench.tests.GraphicsTests;
69 import j2dbench.tests.ImageTests;
70 import j2dbench.tests.MiscTests;
71 import j2dbench.tests.RenderTests;
72 import j2dbench.tests.PixelTests;
73 import j2dbench.tests.iio.IIOTests;
74 import j2dbench.tests.cmm.CMMTests;
75 import j2dbench.tests.text.TextConstructionTests;
76 import j2dbench.tests.text.TextMeasureTests;
77 import j2dbench.tests.text.TextRenderTests;
78 import j2dbench.tests.text.TextTests;
79
80 public class J2DBench {
81 static Group progoptroot;
82
83 static Option.Enable verbose;
84 static Option.Enable printresults;
361 if (error != null) {
362 System.err.println("Invalid rate: "+error);
363 usage(1);
364 }
365 } else {
366 String reason = Group.root.setOption(arg);
367 if (reason != null) {
368 System.err.println("Option "+arg+" ignored: "+reason);
369 }
370 }
371 }
372 if (verbose.isEnabled()) {
373 Group.root.traverse(new Node.Visitor() {
374 public void visit(Node node) {
375 System.out.println(node);
376 }
377 });
378 }
379
380 if (gui) {
381 SwingUtilities.invokeLater(new Runnable() {
382 public void run() {
383 startGUI();
384 }
385 });
386 } else {
387
388 long start = System.currentTimeMillis();
389
390 int nLoopCount = 1;
391
392 if (saveresults) {
393 if (title == null) {
394 title = inputUserStr("title");
395 }
396 if (desc == null) {
397 desc = inputUserStr("description");
398 }
399 }
400
401 PrintWriter writer = null;
402
403 if (J2DBench.looping) {
404
405 System.out.println("\nAbout to run tests for : " +
761 if (saveResults()) {
762 lastResults = null;
763 }
764 }
765 });
766 p.add(b);
767
768 b = new JButton("Quit");
769 b.addActionListener(new ActionListener() {
770 public void actionPerformed(ActionEvent e) {
771 if (!saveOrDiscardLastResults()) {
772 return;
773 }
774 System.exit(0);
775 }
776 });
777 p.add(b);
778
779 f.getContentPane().add(p, BorderLayout.SOUTH);
780 f.pack();
781 f.setLocationRelativeTo(null);
782 f.show();
783 }
784
785 public static void runTests(boolean showresults) {
786 final TestEnvironment env = new TestEnvironment();
787 Frame f = null;
788 if (showresults) {
789 f = new Frame("J2DBench test run");
790 f.addWindowListener(new WindowAdapter() {
791 public void windowClosing(WindowEvent e) {
792 env.stop();
793 }
794 });
795 f.add(env.getCanvas());
796 f.pack();
797 f.show();
798 }
799 for (int i = 0; i < 5; i++) {
800 env.idle();
801 }
|