|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--ostore.tapestry.patchwork.PatchworkModel
The PatchworkModel
is built by the PatchworkStage
code, and is used for collecting network statistics. It implements
the ostore.oil.Model
interface, although not all methods
are currently implemented. It remembers observations sent to it
(only up to MAX_OBSERVATIONS
of them, which is currently
set at 1000), and when recalculate
is called it produces a
PatchworkModel.Delta
that contains the difference between
the current model and the last one produced from a call to
recalculate
.
The values contained in the model represent averages of the statistics
over the number of observations that existed for that node when
recalculate
was called. It only considers a change worthy
of noting if it is greater than VALID_DELTA_CHANGE
percent, currently set at 5%.
Currently, the integer values and their corresponding types are as follows:
latency: PatchworkModel.LATENCY
bandwidth: PatchworkModel.BANDWIDTH
loss: PatchworkModel.LOSS
For a more complete description of these statistics, see
PatchworkStage
.
Model
Inner Class Summary | |
static class |
PatchworkModel.Delta
A PatchworkModel.Delta object contains a diff
of the sufficient statistics for a PatchworkModel . |
static class |
PatchworkModel.InvalidTypeException
A Patchwork.InvalidTypeException notes that
an invalid type has been given to the PatchworkModel system |
static class |
PatchworkModel.Observation
A Patchwork.Observation object contains an
observation recorded by the patchwork stage. |
Inner classes inherited from class ostore.oil.Model |
Model.Delta, Model.Prediction |
Field Summary | |
static int |
BANDWIDTH
|
static int |
LATENCY
|
static int |
LOSS
|
Constructor Summary | |
PatchworkModel()
Create a new PatchworkModel . |
|
PatchworkModel(InputBuffer buffer)
|
Method Summary | |
void |
add_delta(Model.Delta d)
Specified by ostore.oil.Model interface |
void |
clear()
Specified by ostore.oil.Model interface |
void |
clear(int num)
Specified by ostore.oil.Model interface |
double |
loglikelihood()
Not yet implemented. |
double |
lookupDouble(SecureHash peer,
int type)
Returns the most recently calculated double value of type type for the specified node id peer . |
QuickSerializable[] |
outliers()
Not yet implemented. |
Model.Prediction |
predict(int horizon)
Not yet implemented. |
Model.Delta |
recalculate()
Specified by ostore.oil.Model interface |
void |
record(QuickSerializable observation)
Specified by ostore.oil.Model interface |
void |
record(QuickSerializable[] observations)
Specified by ostore.oil.Model interface |
void |
remove(SecureHash peer)
Tells the model to remove all statistics for this peer at the time of the next recalculation. |
void |
serialize(OutputBuffer buffer)
Specified by ostore.util.QuickSerializable |
String |
toString()
Returns a string representation of the object |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final int LATENCY
public static final int BANDWIDTH
public static final int LOSS
Constructor Detail |
public PatchworkModel()
PatchworkModel
.public PatchworkModel(InputBuffer buffer) throws QSException
Method Detail |
public void record(QuickSerializable[] observations)
record
in interface Model
ostore.oil.Model
observations
- An array of events, values, etc., not
necessarily all the same type, that this
Model
understands.IllegalArgumentException
- if the particular subclass of
Model
cannot process the observation
.public void record(QuickSerializable observation)
record
in interface Model
ostore.oil.Model
observation
- Any event, value, etc. that this
Model
understands.IllegalArgumentException
- if the particular subclass of
Model
cannot process the observation
.public void clear(int num)
clear
in interface Model
public void clear()
clear
in interface Model
public double lookupDouble(SecureHash peer, int type)
type
for the specified node id peer
.
Returns Double.NaN if a value is not recorded.peer
- the node for which to lookup the statistictype
- the type of statistic to collect (i.e.
LATENCY, BANDWIDTH, etc)PatchworkModel.InvalidTypeException
- if an invalid type is passed inpublic void remove(SecureHash peer)
peer
- the node for which to remove the statisticspublic QuickSerializable[] outliers()
outliers
in interface Model
ostore.oil.Model
public void add_delta(Model.Delta d)
add_delta
in interface Model
ostore.oil.Model
IllegalArgumentException
- if the Delta
object
is not of the correct subclass.public double loglikelihood()
loglikelihood
in interface Model
ostore.oil.Model
D
) given the current
model (M
); log(p(D|M))
. If no
observations exist, it returns Double.NaN
.public Model.Delta recalculate()
recalculate
in interface Model
ostore.oil.Model
Delta
storing the difference between the new
model parameters and the old.public Model.Prediction predict(int horizon)
predict
in interface Model
ostore.oil.Model
Prediction
, whose semantics depends on the
particular subclass of Model
.public void serialize(OutputBuffer buffer)
serialize
in interface QuickSerializable
ostore.util.QuickSerializable
buffer
- the output buffer to add the object topublic String toString()
toString
in class Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |