Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
8252522: nsk/share/test/StressOptions should multiple stressTime by j…
…treg's timeout-factor

Reviewed-by: dholmes
  • Loading branch information
iignatev committed Sep 6, 2020
1 parent 1262ae3 commit 5f76deb
Showing 1 changed file with 19 additions and 29 deletions.
48 changes: 19 additions & 29 deletions test/hotspot/jtreg/vmTestbase/nsk/share/test/StressOptions.java
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand All @@ -22,28 +22,30 @@
*/
package nsk.share.test;

import java.io.PrintStream;
import jdk.test.lib.Utils;
import vm.share.options.Option;

import java.io.PrintStream;

/**
* Options for stress tests.
*
* <p>
* The following options may be configured:
*
* -stressTime [time] execution time in seconds
* -stressIterationsFactor [factor] iterations factor.
* The actual number of iterations is obtained by multiplying standard
* number of iterations (which is defined by the test itself) and this factor.
* -stressThreadsFactor [factor] number of threads factor
* The actual number of threads is determined by multiplying standard
* number of threads (which is determined by test itself and may also depend
* on machine configuration) and this factor.
* <p>
* -stressTime [time] execution time in seconds
* -stressIterationsFactor [factor] iterations factor.
* The actual number of iterations is obtained by multiplying standard
* number of iterations (which is defined by the test itself) and this factor.
* -stressThreadsFactor [factor] number of threads factor
* The actual number of threads is determined by multiplying standard
* number of threads (which is determined by test itself and may also depend
* on machine configuration) and this factor.
*/
public class StressOptions {
/**
* This enum contains names of stress options
*/
public static enum StressOptionsParam {
public enum StressOptionsParam {
stressTime,
stressIterationsFactor,
stressThreadsFactor,
Expand Down Expand Up @@ -88,25 +90,13 @@ public StressOptions() {
/**
* Create StressOptions configured from command line arguments.
*
* @param arg arguments
* @param args arguments
*/
public StressOptions(String[] args) {
this();
parseCommandLine(args);
}

/**
* Create stresser with same parameters as another.
*
* @param other another instance of StressOptions
*/
public StressOptions(StressOptions other) {
this.time = other.time;
this.iterationsFactor = other.iterationsFactor;
this.threadsFactor = other.threadsFactor;
this.runsFactor = other.runsFactor;
}

public static boolean isValidStressOption(String option) {
for (int i = 0; i < StressOptions.StressOptionsParam.values().length; i++) {
if (option.equals(StressOptions.StressOptionsParam.values()[i].name()))
Expand All @@ -118,7 +108,7 @@ public static boolean isValidStressOption(String option) {

/**
* Parse command line options related to stress.
*
* <p>
* Other options are ignored.
*
* @param args arguments
Expand Down Expand Up @@ -221,12 +211,12 @@ private void error(String msg) {
}

/**
* Obtain execution time in seconds.
* Obtain execution time in seconds adjusted for TIMEOUT_FACTOR.
*
* @return time
*/
public long getTime() {
return time;
return Utils.adjustTimeout(time);
}

/**
Expand Down

1 comment on commit 5f76deb

@bridgekeeper
Copy link

@bridgekeeper bridgekeeper bot commented on 5f76deb Sep 6, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review

Issues

Please sign in to comment.