| /******************************************************************************* |
| * Copyright (c) 1998, 2012 Oracle and/or its affiliates. All rights reserved. |
| * This program and the accompanying materials are made available under the |
| * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 |
| * which accompanies this distribution. |
| * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html |
| * and the Eclipse Distribution License is available at |
| * http://www.eclipse.org/org/documents/edl-v10.php. |
| * |
| * Contributors: |
| * Oracle - initial impl |
| ******************************************************************************/ |
| package example; |
| |
| import java.io.StringWriter; |
| |
| /** |
| * Generic performance result. |
| */ |
| public class PerformanceResult { |
| String testName; |
| int runRepeats; |
| int threads; |
| long runTime; |
| double average; |
| long min; |
| long max; |
| double standardDeviation; |
| long averageOperationTime; |
| long maxOperationTime; |
| long minOperationTime; |
| |
| public String toString() { |
| StringWriter writer = new StringWriter(); |
| writer.write(this.testName + " Results"); |
| writer.write("\nThreads:" + this.threads); |
| writer.write("\nRun repeats:" + this.runRepeats); |
| writer.write("\nRun time:" + (this.runTime / 1000000) + "ms"); |
| writer.write("\nAverage result:" + this.average); |
| writer.write("\nMax result:" + this.max); |
| writer.write("\nMin result:" + this.min); |
| writer.write("\n% standard deviation:" + this.standardDeviation); |
| writer.write("\nMin operation time:" + this.minOperationTime + "ns"); |
| writer.write("\nMax operation time:" + this.maxOperationTime + "ns"); |
| writer.write("\nAverage operation time:" + this.averageOperationTime + "ns"); |
| return writer.toString(); |
| } |
| } |