Class LongTermStatsBase
java.lang.Object
com.biglybt.core.stats.transfer.impl.LongTermStatsBase
- All Implemented Interfaces:
LongTermStatsWrapper.LongTermStatsWrapperHelper
,LongTermStats
- Direct Known Subclasses:
LongTermStatsGenericImpl
,LongTermStatsImpl
public abstract class LongTermStatsBase
extends Object
implements LongTermStatsWrapper.LongTermStatsWrapperHelper
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static class
private class
Nested classes/interfaces inherited from interface com.biglybt.core.stats.transfer.LongTermStats
LongTermStats.GenericStatsSource, LongTermStats.RecordAccepter
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected boolean
protected boolean
private LongTermStatsBase.DayCache
protected static final long
private static final SimpleDateFormat
protected boolean
private final AsyncDispatcher
private TimerEventPeriodic
protected static final long
protected final long[]
private final CopyOnWriteList
<Object[]> protected static final long
private final Map
<String, LongTermStatsBase.MonthCache> private static final int
private long
protected static final int
protected static final int
protected static final int
private long
private int
private int
private final Average[]
protected final int
protected File
private static final SimpleDateFormat
protected static final int
protected static final long
private PrintWriter
private String
Fields inherited from interface com.biglybt.core.stats.transfer.LongTermStats
PT_CURRENT_DAY, PT_CURRENT_HOUR, PT_CURRENT_MONTH, PT_CURRENT_WEEK, PT_NAMES, PT_SLIDING_DAY, PT_SLIDING_HOUR, PT_SLIDING_WEEK, ST_DATA_DOWNLOAD, ST_DATA_UPLOAD, ST_DHT_DOWNLOAD, ST_DHT_UPLOAD, ST_PROTOCOL_DOWNLOAD, ST_PROTOCOL_UPLOAD
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addListener
(long min_delta_bytes, LongTermStatsListener listener) void
long[]
private LongTermStatsBase.MonthCache
getMonthCache
(String year, String month) protected abstract long[]
getNewFileSessionStats
(long[] line_stats) long
private static String
getString
(long[] stats) long[]
getTotalUsageInPeriod
(int period_type, double multiplier) long[]
getTotalUsageInPeriod
(int period_type, double multiplier, LongTermStats.RecordAccepter accepter) long[]
getTotalUsageInPeriod
(Date start_date, Date end_date) long[]
getTotalUsageInPeriod
(Date start_date, Date end_date, LongTermStats.RecordAccepter accepter) boolean
void
removeListener
(LongTermStatsListener listener) void
reset()
protected void
protected abstract void
protected void
sessionStartComplete
(String name) protected void
protected abstract void
updateStats
(int record_type) protected void
write
(int record_type, long[] line_stats)
-
Field Details
-
VERSION
protected static final int VERSION- See Also:
-
MIN_IN_MILLIS
protected static final long MIN_IN_MILLIS- See Also:
-
HOUR_IN_MILLIS
protected static final long HOUR_IN_MILLIS- See Also:
-
DAY_IN_MILLIS
protected static final long DAY_IN_MILLIS- See Also:
-
WEEK_IN_MILLIS
protected static final long WEEK_IN_MILLIS- See Also:
-
RT_SESSION_START
protected static final int RT_SESSION_START- See Also:
-
RT_SESSION_STATS
protected static final int RT_SESSION_STATS- See Also:
-
RT_SESSION_END
protected static final int RT_SESSION_END- See Also:
-
STAT_ENTRY_COUNT
protected final int STAT_ENTRY_COUNT -
line_stats_prev
protected final long[] line_stats_prev -
stat_averages
-
active
protected boolean active -
closing
protected boolean closing -
destroyed
protected volatile boolean destroyed -
overall_start_time
private volatile long overall_start_time -
event
-
writer
-
writer_rel_file
-
debug_utc_format
-
utc_date_format
-
stats_dir
-
session_total
private long session_total -
listeners
-
dispatcher
-
start_of_week
private int start_of_week -
start_of_month
private int start_of_month -
day_cache
-
MONTH_CACHE_MAX
private static final int MONTH_CACHE_MAX- See Also:
-
month_cache_map
-
-
Constructor Details
-
LongTermStatsBase
protected LongTermStatsBase(int entry_count)
-
-
Method Details
-
sessionStart
protected abstract void sessionStart() -
sessionStartComplete
-
sessionEnd
protected void sessionEnd() -
updateStats
protected void updateStats() -
updateStats
protected abstract void updateStats(int record_type) -
getNewFileSessionStats
protected abstract long[] getNewFileSessionStats(long[] line_stats) -
write
protected void write(int record_type, long[] line_stats) -
isEnabled
public boolean isEnabled()- Specified by:
isEnabled
in interfaceLongTermStats
-
reset
public void reset()- Specified by:
reset
in interfaceLongTermStats
-
destroyAndDeleteData
public void destroyAndDeleteData()- Specified by:
destroyAndDeleteData
in interfaceLongTermStatsWrapper.LongTermStatsWrapperHelper
-
getOverallStartTime
public long getOverallStartTime()- Specified by:
getOverallStartTime
in interfaceLongTermStats
-
getTotalUsageInPeriod
- Specified by:
getTotalUsageInPeriod
in interfaceLongTermStats
-
getTotalUsageInPeriod
public long[] getTotalUsageInPeriod(Date start_date, Date end_date, LongTermStats.RecordAccepter accepter) - Specified by:
getTotalUsageInPeriod
in interfaceLongTermStats
-
getTotalUsageInPeriod
public long[] getTotalUsageInPeriod(int period_type, double multiplier) - Specified by:
getTotalUsageInPeriod
in interfaceLongTermStats
-
getTotalUsageInPeriod
public long[] getTotalUsageInPeriod(int period_type, double multiplier, LongTermStats.RecordAccepter accepter) - Specified by:
getTotalUsageInPeriod
in interfaceLongTermStats
-
getCurrentRateBytesPerSecond
public long[] getCurrentRateBytesPerSecond()- Specified by:
getCurrentRateBytesPerSecond
in interfaceLongTermStats
-
getString
-
getMonthCache
-
addListener
- Specified by:
addListener
in interfaceLongTermStats
-
removeListener
- Specified by:
removeListener
in interfaceLongTermStats
-