@NotThreadSafe public final class TimeSeries extends Object implements Serializable
Modifier and Type | Class and Description |
---|---|
class |
TimeSeries.Summary
Class contains the summary of the TimeSeries.
|
Constructor and Description |
---|
TimeSeries()
Creates a TimeSeries instance with default width set to 1 second.
|
TimeSeries(long widthNano)
Creates a TimeSeries instance with given width.
|
Modifier and Type | Method and Description |
---|---|
void |
add(TimeSeries other)
Add one histogram to the current one.
|
int |
get(long timeNano) |
TreeMap<Long,Integer> |
getSeries() |
TimeSeries.Summary |
getSummary() |
long |
getWidthNano() |
void |
print(PrintStream stream)
Print the time series densely, i.e.
|
void |
record(long timeNano)
Record one event at a timestamp into the time series.
|
void |
record(long timeNano,
int numEvents)
Record events at a timestamp into the time series.
|
void |
sparsePrint(PrintStream stream)
Print the time series sparsely, i.e.
|
String |
toString() |
public TimeSeries(long widthNano)
widthNano
- the granularity of the time series. If this is set to 1 min, we count
the number of events of every minute.public TimeSeries()
public void record(long timeNano)
timeNano
- the time in nano secondspublic void record(long timeNano, int numEvents)
timeNano
- the time in nano secondsnumEvents
- the number of events happened at timeNanopublic int get(long timeNano)
timeNano
- the time in nano secondspublic long getWidthNano()
public void add(TimeSeries other)
other
- the TimeSeries instance to addpublic TimeSeries.Summary getSummary()
TimeSeries.Summary
public void sparsePrint(PrintStream stream)
stream
- the print streampublic void print(PrintStream stream)
stream
- the print streamCopyright © 2023. All Rights Reserved.