|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--ostore.oil.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(byte[] data,
int[] offset)
Create a PatchworkModel from its
QuickSerializable form. |
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(NodeId 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 |
to_bytes(byte[] data,
int[] offset)
Specified by ostore.util.QuickSerializable |
String |
toString()
Returns a string representation of the object |
int |
type_code()
Specified by ostore.util.QuickSerializable |
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(byte[] data, int[] offset) throws QSException
PatchworkModel
from its
QuickSerializable
form.public PatchworkModel()
PatchworkModel
.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(NodeId 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 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 to_bytes(byte[] data, int[] offset)
to_bytes
in interface QuickSerializable
ostore.util.QuickSerializable
data
- The byte array to store into, or null
.offset
- A single element array whose first
element is the index in data to begin writing at on
function entry, and which on function exit has been
incremented by the number of bytes written.public int type_code()
type_code
in interface QuickSerializable
ostore.util.QuickSerializable
public String toString()
toString
in class Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |