1/* 2 * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 */ 23 24/* 25 * 26 */ 27 28package bench; 29 30/** 31 * Information about a benchmark: its name, how long it took to run, and the 32 * weight associated with it (for calculating the overall score). 33 */ 34public class BenchInfo { 35 36 Benchmark benchmark; 37 String name; 38 long time; 39 float weight; 40 String[] args; 41 42 /** 43 * Construct benchmark info. 44 */ 45 BenchInfo(Benchmark benchmark, String name, float weight, String[] args) { 46 this.benchmark = benchmark; 47 this.name = name; 48 this.weight = weight; 49 this.args = args; 50 this.time = -1; 51 } 52 53 /** 54 * Run benchmark with specified args. Called only by the harness. 55 */ 56 void runBenchmark() throws Exception { 57 time = benchmark.run(args); 58 } 59 60 /** 61 * Return the benchmark for this benchmark info. 62 */ 63 public Benchmark getBenchmark() { 64 return benchmark; 65 } 66 67 /** 68 * Return the name of this benchmark. 69 */ 70 public String getName() { 71 return name; 72 } 73 74 /** 75 * Return the execution time for benchmark, or -1 if benchmark hasn't been 76 * run to completion. 77 */ 78 public long getTime() { 79 return time; 80 } 81 82 /** 83 * Return weight associated with benchmark. 84 */ 85 public float getWeight() { 86 return weight; 87 } 88} 89