< prev index next >

src/demo/share/java2d/J2DBench/src/j2dbench/Result.java

Print this page


   1 /*
   2  * Copyright (c) 2002, 2011, 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


  53     public static final int WORK_UNITS      = 2;
  54     public static final int WORK_THOUSANDS  = 4;
  55     public static final int WORK_MILLIONS   = 6;
  56     public static final int WORK_AUTO       = 8;
  57 
  58     public static final int TIME_SECONDS    = 10;
  59     public static final int TIME_MILLIS     = 11;
  60     public static final int TIME_MICROS     = 12;
  61     public static final int TIME_NANOS      = 13;
  62     public static final int TIME_AUTO       = 14;
  63 
  64     static Group resultoptroot;
  65     static Option.ObjectChoice timeOpt;
  66     static Option.ObjectChoice workOpt;
  67     static Option.ObjectChoice rateOpt;
  68 
  69     public static void init() {
  70         resultoptroot = new Group(TestEnvironment.globaloptroot,
  71                                   "results", "Result Options");
  72 
  73         String workStrings[] = {
  74             "units",
  75             "kilounits",
  76             "megaunits",
  77             "autounits",
  78             "ops",
  79             "kiloops",
  80             "megaops",
  81             "autoops",
  82         };
  83         String workDescriptions[] = {
  84             "Test Units",
  85             "Thousands of Test Units",
  86             "Millions of Test Units",
  87             "Auto-scaled Test Units",
  88             "Operations",
  89             "Thousands of Operations",
  90             "Millions of Operations",
  91             "Auto-scaled Operations",
  92         };
  93         Integer workObjects[] = {
  94             new Integer(WORK_UNITS),
  95             new Integer(WORK_THOUSANDS),
  96             new Integer(WORK_MILLIONS),
  97             new Integer(WORK_AUTO),
  98             new Integer(WORK_OPS | WORK_UNITS),
  99             new Integer(WORK_OPS | WORK_THOUSANDS),
 100             new Integer(WORK_OPS | WORK_MILLIONS),
 101             new Integer(WORK_OPS | WORK_AUTO),
 102         };
 103         workOpt = new Option.ObjectChoice(resultoptroot,
 104                                           "workunits", "Work Units",
 105                                           workStrings, workObjects,
 106                                           workStrings, workDescriptions,
 107                                           0);
 108         String timeStrings[] = {
 109             "sec",
 110             "msec",
 111             "usec",
 112             "nsec",
 113             "autosec",
 114         };
 115         String timeDescriptions[] = {
 116             "Seconds",
 117             "Milliseconds",
 118             "Microseconds",
 119             "Nanoseconds",
 120             "Auto-scaled seconds",
 121         };
 122         Integer timeObjects[] = {
 123             new Integer(TIME_SECONDS),
 124             new Integer(TIME_MILLIS),
 125             new Integer(TIME_MICROS),
 126             new Integer(TIME_NANOS),
 127             new Integer(TIME_AUTO),
 128         };
 129         timeOpt = new Option.ObjectChoice(resultoptroot,
 130                                           "timeunits", "Time Units",
 131                                           timeStrings, timeObjects,
 132                                           timeStrings, timeDescriptions,
 133                                           0);
 134         String rateStrings[] = {
 135             "unitspersec",
 136             "secsperunit",
 137         };
 138         String rateDescriptions[] = {
 139             "Work units per Time",
 140             "Time units per Work",
 141         };
 142         Boolean rateObjects[] = {
 143             Boolean.FALSE,
 144             Boolean.TRUE,
 145         };
 146         rateOpt = new Option.ObjectChoice(resultoptroot,
 147                                           "ratio", "Rate Ratio",
 148                                           rateStrings, rateObjects,
 149                                           rateStrings, rateDescriptions,
 150                                           0);
 151     }
 152 
 153     public static boolean isTimeUnit(int unit) {
 154         return (unit >= TIME_SECONDS && unit <= TIME_AUTO);
 155     }
 156 
 157     public static boolean isWorkUnit(int unit) {
 158         return (unit >= WORK_OPS && unit <= (WORK_AUTO | WORK_OPS));
 159     }
 160 
 161     public static String parseRateOpt(String opt) {
 162         int timeScale = timeOpt.getIntValue();


   1 /*
   2  * Copyright (c) 2002, 2018, 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


  53     public static final int WORK_UNITS      = 2;
  54     public static final int WORK_THOUSANDS  = 4;
  55     public static final int WORK_MILLIONS   = 6;
  56     public static final int WORK_AUTO       = 8;
  57 
  58     public static final int TIME_SECONDS    = 10;
  59     public static final int TIME_MILLIS     = 11;
  60     public static final int TIME_MICROS     = 12;
  61     public static final int TIME_NANOS      = 13;
  62     public static final int TIME_AUTO       = 14;
  63 
  64     static Group resultoptroot;
  65     static Option.ObjectChoice timeOpt;
  66     static Option.ObjectChoice workOpt;
  67     static Option.ObjectChoice rateOpt;
  68 
  69     public static void init() {
  70         resultoptroot = new Group(TestEnvironment.globaloptroot,
  71                                   "results", "Result Options");
  72 
  73         String[] workStrings = {
  74             "units",
  75             "kilounits",
  76             "megaunits",
  77             "autounits",
  78             "ops",
  79             "kiloops",
  80             "megaops",
  81             "autoops",
  82         };
  83         String[] workDescriptions = {
  84             "Test Units",
  85             "Thousands of Test Units",
  86             "Millions of Test Units",
  87             "Auto-scaled Test Units",
  88             "Operations",
  89             "Thousands of Operations",
  90             "Millions of Operations",
  91             "Auto-scaled Operations",
  92         };
  93         Integer[] workObjects = {
  94             new Integer(WORK_UNITS),
  95             new Integer(WORK_THOUSANDS),
  96             new Integer(WORK_MILLIONS),
  97             new Integer(WORK_AUTO),
  98             new Integer(WORK_OPS | WORK_UNITS),
  99             new Integer(WORK_OPS | WORK_THOUSANDS),
 100             new Integer(WORK_OPS | WORK_MILLIONS),
 101             new Integer(WORK_OPS | WORK_AUTO),
 102         };
 103         workOpt = new Option.ObjectChoice(resultoptroot,
 104                                           "workunits", "Work Units",
 105                                           workStrings, workObjects,
 106                                           workStrings, workDescriptions,
 107                                           0);
 108         String[] timeStrings = {
 109             "sec",
 110             "msec",
 111             "usec",
 112             "nsec",
 113             "autosec",
 114         };
 115         String[] timeDescriptions = {
 116             "Seconds",
 117             "Milliseconds",
 118             "Microseconds",
 119             "Nanoseconds",
 120             "Auto-scaled seconds",
 121         };
 122         Integer[] timeObjects = {
 123             new Integer(TIME_SECONDS),
 124             new Integer(TIME_MILLIS),
 125             new Integer(TIME_MICROS),
 126             new Integer(TIME_NANOS),
 127             new Integer(TIME_AUTO),
 128         };
 129         timeOpt = new Option.ObjectChoice(resultoptroot,
 130                                           "timeunits", "Time Units",
 131                                           timeStrings, timeObjects,
 132                                           timeStrings, timeDescriptions,
 133                                           0);
 134         String[] rateStrings = {
 135             "unitspersec",
 136             "secsperunit",
 137         };
 138         String[] rateDescriptions = {
 139             "Work units per Time",
 140             "Time units per Work",
 141         };
 142         Boolean[] rateObjects = {
 143             Boolean.FALSE,
 144             Boolean.TRUE,
 145         };
 146         rateOpt = new Option.ObjectChoice(resultoptroot,
 147                                           "ratio", "Rate Ratio",
 148                                           rateStrings, rateObjects,
 149                                           rateStrings, rateDescriptions,
 150                                           0);
 151     }
 152 
 153     public static boolean isTimeUnit(int unit) {
 154         return (unit >= TIME_SECONDS && unit <= TIME_AUTO);
 155     }
 156 
 157     public static boolean isWorkUnit(int unit) {
 158         return (unit >= WORK_OPS && unit <= (WORK_AUTO | WORK_OPS));
 159     }
 160 
 161     public static String parseRateOpt(String opt) {
 162         int timeScale = timeOpt.getIntValue();


< prev index next >