11/*
2- * Copyright (c) 2007, 2019 , Oracle and/or its affiliates. All rights reserved.
2+ * Copyright (c) 2007, 2020 , Oracle and/or its affiliates. All rights reserved.
33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44 *
55 * This code is free software; you can redistribute it and/or modify it
2222 */
2323package nsk .share .test ;
2424
25- import java . io . PrintStream ;
25+ import jdk . test . lib . Utils ;
2626import vm .share .options .Option ;
2727
28+ import java .io .PrintStream ;
29+
2830/**
2931 * Options for stress tests.
30- *
32+ * <p>
3133 * The following options may be configured:
32- *
33- * -stressTime [time] execution time in seconds
34- * -stressIterationsFactor [factor] iterations factor.
35- * The actual number of iterations is obtained by multiplying standard
36- * number of iterations (which is defined by the test itself) and this factor.
37- * -stressThreadsFactor [factor] number of threads factor
38- * The actual number of threads is determined by multiplying standard
39- * number of threads (which is determined by test itself and may also depend
40- * on machine configuration) and this factor.
34+ * <p>
35+ * -stressTime [time] execution time in seconds
36+ * -stressIterationsFactor [factor] iterations factor.
37+ * The actual number of iterations is obtained by multiplying standard
38+ * number of iterations (which is defined by the test itself) and this factor.
39+ * -stressThreadsFactor [factor] number of threads factor
40+ * The actual number of threads is determined by multiplying standard
41+ * number of threads (which is determined by test itself and may also depend
42+ * on machine configuration) and this factor.
4143 */
4244public class StressOptions {
4345 /**
4446 * This enum contains names of stress options
4547 */
46- public static enum StressOptionsParam {
48+ public enum StressOptionsParam {
4749 stressTime ,
4850 stressIterationsFactor ,
4951 stressThreadsFactor ,
@@ -88,25 +90,13 @@ public StressOptions() {
8890 /**
8991 * Create StressOptions configured from command line arguments.
9092 *
91- * @param arg arguments
93+ * @param args arguments
9294 */
9395 public StressOptions (String [] args ) {
9496 this ();
9597 parseCommandLine (args );
9698 }
9799
98- /**
99- * Create stresser with same parameters as another.
100- *
101- * @param other another instance of StressOptions
102- */
103- public StressOptions (StressOptions other ) {
104- this .time = other .time ;
105- this .iterationsFactor = other .iterationsFactor ;
106- this .threadsFactor = other .threadsFactor ;
107- this .runsFactor = other .runsFactor ;
108- }
109-
110100 public static boolean isValidStressOption (String option ) {
111101 for (int i = 0 ; i < StressOptions .StressOptionsParam .values ().length ; i ++) {
112102 if (option .equals (StressOptions .StressOptionsParam .values ()[i ].name ()))
@@ -118,7 +108,7 @@ public static boolean isValidStressOption(String option) {
118108
119109 /**
120110 * Parse command line options related to stress.
121- *
111+ * <p>
122112 * Other options are ignored.
123113 *
124114 * @param args arguments
@@ -221,12 +211,12 @@ private void error(String msg) {
221211 }
222212
223213 /**
224- * Obtain execution time in seconds.
214+ * Obtain execution time in seconds adjusted for TIMEOUT_FACTOR .
225215 *
226216 * @return time
227217 */
228218 public long getTime () {
229- return time ;
219+ return Utils . adjustTimeout ( time ) ;
230220 }
231221
232222 /**
0 commit comments