public class MetricsFile<BEAN extends MetricBase,HKEY extends Comparable> extends Object implements 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 String |
HISTO_HEADER |
static String |
MAJOR_HEADER_PREFIX |
static String |
METRIC_HEADER |
static String |
MINOR_HEADER_PREFIX |
static String |
SEPARATOR |
Constructor and Description |
---|
MetricsFile() |
Modifier and Type | Method and Description |
---|---|
void |
addAllMetrics(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(File file1,
File file2)
Compare the metrics and histograms in two files, ignoring headers.
|
static boolean |
areMetricsEqual(File file1,
File file2)
Compare the metrics in two files, ignoring headers and histograms.
|
boolean |
areMetricsEqual(MetricsFile that) |
boolean |
equals(Object o)
Checks that the headers, metrics and histogram are all equal.
|
List<Histogram<HKEY>> |
getAllHistograms() |
List<Header> |
getHeaders()
Returns the list of headers.
|
List<Header> |
getHeaders(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.
|
List<BEAN> |
getMetrics()
Returns the list of headers.
|
Set<String> |
getMetricsColumnLabels() |
int |
getNumHistograms()
Returns the number of histograms added to the metrics file.
|
int |
hashCode() |
void |
read(Reader r)
Reads the Metrics in from the given reader.
|
static <T extends MetricBase> |
readBeans(File file)
Convenience method to read all the Metric beans from a metrics file.
|
static List<Header> |
readHeaders(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(File f)
Writes out the metrics file to the supplied file.
|
void |
write(Writer w)
Writes out the metrics file to the supplied writer.
|
public static final String MAJOR_HEADER_PREFIX
public static final String MINOR_HEADER_PREFIX
public static final String SEPARATOR
public static final String HISTO_HEADER
public static final String METRIC_HEADER
public void addHeader(Header h)
public void addMetric(BEAN bean)
public Histogram<HKEY> getHistogram()
public void setHistogram(Histogram<HKEY> histogram)
public void addHistogram(Histogram<HKEY> histogram)
public int getNumHistograms()
public List<Header> getHeaders(Class<? extends Header> type)
public void write(File f)
f
- a File into which to write the metricspublic void write(Writer w)
w
- a Writer into which to write the metricspublic void read(Reader r)
public boolean equals(Object o)
public boolean areHeadersEqual(MetricsFile that)
public boolean areMetricsEqual(MetricsFile that)
public boolean areHistogramsEqual(MetricsFile that)
public static <T extends MetricBase> List<T> readBeans(File file)
file
- to be read.public static List<Header> readHeaders(File file)
public static boolean areMetricsEqual(File file1, File file2)