Skip to content

Commit

Permalink
add threads number parameter
Browse files Browse the repository at this point in the history
Signed-off-by: olivier lamy <[email protected]>
  • Loading branch information
olamy committed Apr 1, 2017
1 parent 061f8ba commit b3f13e6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,14 @@
import org.mortbay.jetty.load.generator.HTTPClientTransportBuilder;
import org.mortbay.jetty.load.generator.LoadGenerator;
import org.mortbay.jetty.load.generator.Resource;
import org.mortbay.jetty.load.generator.listeners.responsetime.TimePerPathListener;

import java.io.InputStream;
import java.io.Reader;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;

/**
*
Expand Down Expand Up @@ -85,11 +81,6 @@ public void run()
.warmupIterationsPerThread( starterArgs.getWarmupNumber() ) //
.scheme( starterArgs.getScheme() ); //

if (starterArgs.getThreads() > 0)
{
loadGeneratorBuilder.threads( starterArgs.getThreads() );
}

if ( starterArgs.getMaxRequestsQueued() > 0 )
{
loadGeneratorBuilder.maxRequestsQueued( starterArgs.getMaxRequestsQueued() );
Expand All @@ -100,7 +91,10 @@ public void run()
loadGeneratorBuilder.executor( getExecutorService() );
}

boolean runFor = false;
if ( starterArgs.getThreads() > 0 )
{
loadGeneratorBuilder.threads( starterArgs.getThreads() );
}

if ( starterArgs.getRunningTime() > 0 )
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,6 @@ public class LoadGeneratorStarterArgs
@Parameter( names = { "--users", "-u" }, description = "Simulated users number" )
private int users = 1;

@Parameter( names = { "--threads" }, description = "Threads number" )
private int threads = 0;

@Parameter( names = { "--transaction-rate", "-tr" }, description = "Transaction rate / second" )
private int transactionRate = 1;

Expand All @@ -61,6 +58,9 @@ public class LoadGeneratorStarterArgs
@Parameter( names = { "--selectors", "-s" }, description = "HttpClientTransport selectors" )
private int selectors = 1;

@Parameter( names = { "--threads" }, description = "LoadGenerator threads" )
private int threads = 0;

@Parameter( names = { "--running-time", "-rt" }, description = "Running Time" )
private long runningTime = 1;

Expand Down Expand Up @@ -376,8 +376,8 @@ public String toString()
{
return "LoadGeneratorStarterArgs{" + "profileXmlPath='" + profileXmlPath + '\'' + ", profileJsonPath='"
+ profileJsonPath + '\'' + ", profileGroovyPath='" + profileGroovyPath + '\'' + ", host='" + host + '\''
+ ", port=" + port + ", users=" + users + ", threads=" + threads + ", transactionRate=" + transactionRate
+ ", transport='" + transport + '\'' + ", selectors=" + selectors + ", runningTime=" + runningTime
+ ", port=" + port + ", users=" + users + ", transactionRate=" + transactionRate + ", transport='"
+ transport + '\'' + ", selectors=" + selectors + ", threads=" + threads + ", runningTime=" + runningTime
+ ", runningTimeUnit='" + runningTimeUnit + '\'' + ", runIteration=" + runIteration + ", reportHost='"
+ reportHost + '\'' + ", scheme='" + scheme + '\'' + ", reportPort=" + reportPort + ", notInterrupt="
+ notInterrupt + ", statsFile='" + statsFile + '\'' + ", params=" + params + ", help=" + help
Expand Down

0 comments on commit b3f13e6

Please sign in to comment.