public class MetricsFile<BEAN extends MetricBase,HKEY extends java.lang.Comparable>
extends java.lang.Object
implements java.io.Serializable
MetricBase
(all instances must be of the same type)
and may optionally include one or more histograms that share the same key set.Modifier and Type | Field and Description |
---|---|
static java.lang.String |
HISTO_HEADER |
static java.lang.String |
MAJOR_HEADER_PREFIX |
static java.lang.String |
METRIC_HEADER |
static java.lang.String |
MINOR_HEADER_PREFIX |
static java.lang.String |
SEPARATOR |
Constructor and Description |
---|
MetricsFile() |
Modifier and Type | Method and Description |
---|---|
void |
addAllMetrics(java.lang.Iterable<BEAN> beanz)
Add multiple metric beans at once.
|
void |
addHeader(Header h)
Adds a header to the collection of metrics.
|
void |
addHistogram(Histogram<HKEY> histogram)
Adds a histogram to the list of histograms in the metrics file.
|
void |
addMetric(BEAN bean)
Adds a bean to the collection of metrics.
|
boolean |
areHeadersEqual(MetricsFile that) |
boolean |
areHistogramsEqual(MetricsFile that) |
static boolean |
areMetricsAndHistogramsEqual(java.io.File file1,
java.io.File file2)
Compare the metrics and histograms in two files, ignoring headers.
|
static boolean |
areMetricsEqual(java.io.File file1,
java.io.File file2)
Compare the metrics in two files, ignoring headers and histograms.
|
boolean |
areMetricsEqual(MetricsFile that) |
boolean |
equals(java.lang.Object o)
Checks that the headers, metrics and histogram are all equal.
|
java.util.List<Histogram<HKEY>> |
getAllHistograms() |
java.util.List<Header> |
getHeaders()
Returns the list of headers.
|
java.util.List<Header> |
getHeaders(java.lang.Class<? extends Header> type)
Returns the list of headers with the specified type.
|
Histogram<HKEY> |
getHistogram()
Returns the histogram contained in the metrics file if any.
|
java.util.List<BEAN> |
getMetrics()
Returns the list of headers.
|
java.util.Set<java.lang.String> |
getMetricsColumnLabels() |
int |
getNumHistograms()
Returns the number of histograms added to the metrics file.
|
int |
hashCode() |
void |
read(java.io.Reader r)
Reads the Metrics in from the given reader.
|
static <T extends MetricBase> |
readBeans(java.io.File file)
Convenience method to read all the Metric beans from a metrics file.
|
static java.util.List<Header> |
readHeaders(java.io.File file)
Method to read the header from a metrics file.
|
void |
setHistogram(Histogram<HKEY> histogram)
Sets the histogram contained in the metrics file.
|
void |
write(java.io.File f)
Writes out the metrics file to the supplied file.
|
void |
write(java.io.Writer w)
Writes out the metrics file to the supplied writer.
|
public static final java.lang.String MAJOR_HEADER_PREFIX
public static final java.lang.String MINOR_HEADER_PREFIX
public static final java.lang.String SEPARATOR
public static final java.lang.String HISTO_HEADER
public static final java.lang.String METRIC_HEADER
public void addHeader(Header h)
public java.util.List<Header> getHeaders()
public void addMetric(BEAN bean)
public void addAllMetrics(java.lang.Iterable<BEAN> beanz)
public java.util.List<BEAN> getMetrics()
public java.util.Set<java.lang.String> getMetricsColumnLabels()
public Histogram<HKEY> getHistogram()
public void setHistogram(Histogram<HKEY> histogram)
public void addHistogram(Histogram<HKEY> histogram)
public int getNumHistograms()
public java.util.List<Header> getHeaders(java.lang.Class<? extends Header> type)
public void write(java.io.File f)
f
- a File into which to write the metricspublic void write(java.io.Writer w)
w
- a Writer into which to write the metricspublic void read(java.io.Reader r)
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public boolean areHeadersEqual(MetricsFile that)
public boolean areMetricsEqual(MetricsFile that)
public boolean areHistogramsEqual(MetricsFile that)
public int hashCode()
hashCode
in class java.lang.Object
public static <T extends MetricBase> java.util.List<T> readBeans(java.io.File file)
file
- to be read.public static java.util.List<Header> readHeaders(java.io.File file)
public static boolean areMetricsEqual(java.io.File file1, java.io.File file2)
public static boolean areMetricsAndHistogramsEqual(java.io.File file1, java.io.File file2)