net.eduvax.grant.simul
Class TestNode

java.lang.Object
  extended by net.eduvax.grant.core.Node
      extended by net.eduvax.grant.core.LocalNode
          extended by net.eduvax.grant.simul.TestNode
Direct Known Subclasses:
TestRandomNode, TestRoundRobinNode

 class TestNode
extends LocalNode

Evaluation node. This node's goal is to help to evaluate Ant Engine selection. It is intended to use pausing test tasklet and simulates itself cpu load by another pause. This pause delay depends on node virtual capacity and can envolve to simulate real cpu load variations.


Field Summary
(package private)  NodeClient client
           
private  int loadCost
          delay to add for each running task.
private  int perfIndice
          current perf indice.
 
Fields inherited from class net.eduvax.grant.core.LocalNode
ANT_DEF_DELAY, candidate, STATE_FULL, STATE_HALTED, STATE_RUNNING, STATE_SHUTDOWN, STATE_STARTING, STATES_NAME
 
Constructor Summary
TestNode(java.lang.String n, int p)
          Creates new test node.
 
Method Summary
protected  boolean checkLoad()
          Fake load check loading.
 int execReportToClient(ExecReport er)
           
protected  float getFeedback(ExecRequest er)
          Do not feedback on schedule.
 float getLoadValue()
          Compute "real" load for test node.
 float load()
          computes CPU Load.
protected  void loadNodes(java.util.Hashtable nodeSet, java.io.File nodesFile)
          Fake rc file loading.
 void setClient(NodeClient nc)
           
 void setLoadCost(int c)
          Changes load cost.
 void setPerf(int p)
          Changes performance indice value.
 
Methods inherited from class net.eduvax.grant.core.LocalNode
addNode, dissipate, execReport, feedback, fitness, getFeedback, getKnownNodes, getTaskCount, handleEvent, removeNode, sendEvent, setMaxLoad, setSelector, shutdown, status, submitRequest
 
Methods inherited from class net.eduvax.grant.core.Node
createNode, getFitness, getName, getRCDir, registerNodeFactory, setFitness
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

perfIndice

private int perfIndice
current perf indice.


loadCost

private int loadCost
delay to add for each running task.


client

NodeClient client
Constructor Detail

TestNode

public TestNode(java.lang.String n,
                int p)
Creates new test node.

Parameters:
n - new node's name
p - virtual cpu load. The node will pause p seconds when computing cpu load (@see #load()) i.e. after each tasklet completion.
Method Detail

setPerf

public void setPerf(int p)
Changes performance indice value. This affects pause length in load() method.

Parameters:
p - new perf indice value.

setLoadCost

public void setLoadCost(int c)
Changes load cost. Delay value added for each running tasklet.

Parameters:
c - delay value in milliseconds.

load

public float load()
computes CPU Load. return virtual cpu load and pause according current simulated load.

Overrides:
load in class LocalNode
Returns:
current load value.

execReportToClient

public int execReportToClient(ExecReport er)
Overrides:
execReportToClient in class LocalNode

setClient

public void setClient(NodeClient nc)

getLoadValue

public float getLoadValue()
Compute "real" load for test node. Used to computed fake delay and te let simulation know at any time, which node is best to compare with tested algorithmes choices.


getFeedback

protected float getFeedback(ExecRequest er)
Do not feedback on schedule.

Overrides:
getFeedback in class LocalNode
Parameters:
er - execute request
Returns:
computed load indice.

loadNodes

protected void loadNodes(java.util.Hashtable nodeSet,
                         java.io.File nodesFile)
Fake rc file loading. Nothing to load with this test node.

Overrides:
loadNodes in class LocalNode
Parameters:
nodeSet - not used here
nodesFile - not used here

checkLoad

protected boolean checkLoad()
Fake load check loading.

Overrides:
checkLoad in class LocalNode
Returns:
true