|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object pt.tumba.ngram.compression.TestStatistics
class TestStatistics
Package local helper class to compute statistics for a single compression experiment. Stores original and coded bytes, average and cumulative compression and speeds. Pretty printing is through toString.
TestSet
Field Summary | |
---|---|
private java.lang.String |
_name
Name of test. |
private int |
_numTests
Number of tests that have been run. |
private int |
_totalCodedBytes
Cumulative number of coded bytes. |
private double |
_totalCompressionRate
Running total of sum of compression rates per file (for average). |
private double |
_totalDecodeSpeed
Total of KB/s rate for all decodings (for average). |
private long |
_totalDecodeTime
Total amount of time in milliseconds spent decoding. |
private double |
_totalEncodeSpeed
Total of KB/s rate for all encodings (for average). |
private long |
_totalEncodeTime
Total amount of time in milliseconds spent encoding. |
private int |
_totalOriginalBytes
Cumulative number of original bytes. |
Constructor Summary | |
---|---|
TestStatistics(java.lang.String name)
|
Method Summary | |
---|---|
int |
compareTo(java.lang.Object that)
Compare using average compression rates, breaking ties by name. |
private int |
compareTo(TestStatistics that)
Compare using average compression rates, breaking ties by name. |
(package private) java.lang.String |
lineReport()
Used for a line of reporting by TestSet. |
private static double |
rate(long a,
long b)
Rate of first argument divided by second argument as doubles. |
(package private) void |
record(int originalBytes,
int codedBytes,
long encodeTime,
long decodeTime)
Record the result of an experiment with specified number of original and encoded bytes with specified encode and decode time. |
private static java.lang.String |
roundOff(double x)
Round off a double to 2 decimal places, taking up 8 total characters. |
private static java.lang.String |
roundOff(double x,
double factor,
int width)
Round off a double with a multiplicative factor, padding to specified width. |
private static java.lang.String |
roundOff(double x,
int width,
int numDecimalPlaces)
Round off a double to specified number of decimal places, taking up specified total width |
java.lang.String |
toString()
Returns a String version of the Test report. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private java.lang.String _name
private int _totalOriginalBytes
private int _totalCodedBytes
private int _numTests
private double _totalEncodeSpeed
private double _totalDecodeSpeed
private double _totalCompressionRate
private long _totalEncodeTime
private long _totalDecodeTime
Constructor Detail |
---|
TestStatistics(java.lang.String name)
Method Detail |
---|
public int compareTo(java.lang.Object that)
compareTo
in interface java.lang.Comparable
public java.lang.String toString()
toString
in class java.lang.Object
void record(int originalBytes, int codedBytes, long encodeTime, long decodeTime)
originalBytes
- Number of bytes in original source.codedBytes
- Number of bytes in decoded result.encodeTime
- Time taken to do encoding in milliseconds.decodeTime
- Time taken to do decoding in milliseconds.java.lang.String lineReport()
private int compareTo(TestStatistics that)
compareTo
in interface java.lang.Comparable
private static double rate(long a, long b)
a
- Numerator.b
- Denominator.
private static java.lang.String roundOff(double x)
x
- Double to round off and convert to string.
private static java.lang.String roundOff(double x, int width, int numDecimalPlaces)
x
- Double to round off and convert to string.width
- Width of final string representation.numDecimalPlaces
- Number of decimal places in representation.
private static java.lang.String roundOff(double x, double factor, int width)
x
- Double to round off and convert to string.width
- Width of final string representation.factor
- 10 to the number of decimal places to keep.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |