public class ThreadSpeedTest
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
ThreadSpeedTest.EvaluationThread
A thread which evaluates an expression multiple times.
|
| Modifier and Type | Field and Description |
|---|---|
protected Node |
base
Parsed expression
|
protected Jep |
baseJep
Base Jep instance
|
static int |
MAX_LOOPS
Number of loops to run
|
static int |
MAX_THREADS
Maximum number of threads to test.
|
static int |
N_TERMS
Number of terms in the expressions
|
static int |
TOTAL_ITTS
Total number of iterations for each step
|
protected java.lang.String |
varName
Name of variable
|
| Modifier | Constructor and Description |
|---|---|
protected |
ThreadSpeedTest()
Do nothing constructor for use by subclasses
|
|
ThreadSpeedTest(java.lang.String expression,
java.lang.String varName) |
| Modifier and Type | Method and Description |
|---|---|
void |
analyize()
Prints some basic info about the expression
|
static java.lang.String |
getExpression(int nTerms)
Gets a expression to evaluate using an approximation to log "x^1/1-x^2/2+x^3/3-..."
|
int |
go(int nThreads,
int nItts,
double minValue,
double maxValue)
Create and run threads.
|
void |
loop(int maxThreads,
int totalItts,
int nLoops)
Repeatedly execute threads.
|
static void |
main(java.lang.String[] args)
Run the thread test program.
|
java.lang.Thread |
makeThread(int index,
double min,
double max,
int nItts)
Make a thread to evaluate an expression multiple times.
|
public static final int N_TERMS
public static final int MAX_LOOPS
public static final int TOTAL_ITTS
public static final int MAX_THREADS
protected Jep baseJep
protected Node base
protected java.lang.String varName
protected ThreadSpeedTest()
public ThreadSpeedTest(java.lang.String expression,
java.lang.String varName)
throws ParseException
expression - the expressionvarName - name of the variableParseExceptionpublic int go(int nThreads,
int nItts,
double minValue,
double maxValue)
throws JepException
makeThread to construct threads,
then runs the threads simultaneously and calculated total time of execution.nThreads - number of threads to runnItts - number of iterations per threadminValue - minimum variable valuemaxValue - maximum variable valueJepExceptionpublic java.lang.Thread makeThread(int index,
double min,
double max,
int nItts)
throws JepException
ThreadSpeedTest.EvaluationThreadindex - the number of this threadmin - minimum value for variablemax - maximum value for variablenItts - number of iterationsJepExceptionpublic void loop(int maxThreads,
int totalItts,
int nLoops)
maxThreads - totalItts - nLoops - number of timespublic void analyize()
public static java.lang.String getExpression(int nTerms)
nTerms - number of termspublic static void main(java.lang.String[] args)
args - If specified args[0] is maximum number of threads, args[1] is total number of iterationsCopyright © 2018 Singular Systems http://www.singularsys.com/jep