Class PVMetrics
- java.lang.Object
-
- org.epics.archiverappliance.engine.pv.PVMetrics
-
public class PVMetrics extends Object
PVMetrics includes the dynamic information of the pv- Author:
- Luofeng Li
-
-
Constructor Summary
Constructors Constructor Description PVMetrics(String pvName, String controlPVname, long startEpochSeconds, ArchDBRTypes dbrTypes)
Constructor for PVMetrics
-
Method Summary
Modifier and Type Method Description void
addConnectionLostRegainedFields(DBRTimeEvent event)
Add the cnxlostepsecs and cnxregainedepsecs to the specified DBRTimeEvent and then reset local state.void
addEventCounts()
update event count and the time of last event and runningvoid
addSampleBufferFullLostEventCount()
add 1 to the count of the events were dropped because of the over flow of the sample buffervoid
addStorageSize(DBRTimeEvent timeevent)
update the staorage sizevoid
addTimestampWrongEventCount(Timestamp incorrectTimeStamp)
add 1 to the count of the events were dropped because of the wrong time stamp We keep a copy of the last incorrect timestamp we obtained and only increment if the current incorrect timestamp is different.ArchDBRTypes
getArchDBRTypes()
long
getConnectionFirstEstablishedEpochSeconds()
long
getConnectionLastLostEpochSeconds()
long
getConnectionLastRestablishedEpochSeconds()
long
getConnectionLossRegainCount()
long
getConnectionRequestMadeEpochSeconds()
String
getcontrolPVname()
LinkedList<Map<String,String>>
getDetailedStatus()
int
getElementCount()
long
getEventCounts()
double
getEventRate()
long
getInvalidTypeLostEventCount()
If the PV changes DBR_Type, we do not add it to the sample buffer.long
getLastEventFromIOCTimeStamp()
String
getLastEventFromIOCTimeStampStr()
This is the timestamp of the last event from the IOC regardless of whether the timestamp is accurate or not Note this may not be what's written out into the archive that we used to compare against to enforce monotonically increasing eventstreamslong
getLastRotateLogsEpochSeconds()
String
getPvName()
long
getSampleBufferFullLostEventCount()
double
getSamplingPeriod()
long
getScanPeriodMillis()
long
getSecondsOfLastEvent()
double
getStorageRate()
long
getTimestampWrongEventCount()
void
incrementInvalidTypeLostEventCount(ArchDBRTypes newCADBRType)
void
incrementScanRawEventCount()
boolean
isArchving()
boolean
isConnected()
boolean
isEnable()
boolean
isLastConnectionEventState()
boolean
isMonitor()
void
resetConnectionLastLostEpochSeconds()
void
setArchving(boolean isArchving)
set the archiving statusvoid
setConnected(boolean isConnected)
set the connection statusvoid
setConnectionEstablishedEpochSeconds(long connectionEstablishedEpochSeconds)
void
setConnectionFirstEstablishedEpochSeconds(long connectionFirstEstablishedEpochSeconds)
set the time for the first connectionvoid
setConnectionLastLostEpochSeconds(long connectionLastLostEpochSeconds)
void
setConnectionLastRestablishedEpochSeconds(long connectionLastRestablishedEpochSeconds)
set the time when the last connection was establishedvoid
setConnectionLossRegainCount(long connectionLossRegainCount)
set the count of the connection lost and regainedvoid
setConnectionRequestMadeEpochSeconds(long connectionRequestMadeEpochSeconds)
set the the time when the connection request was sentvoid
setElementCount(int elementCount)
set the element count of this pvvoid
setEnable(boolean isEnable)
void
setHostName(String hostName)
void
setLastConnectionEventState(boolean lastConnectionEventState)
void
setLastEventFromIOCTimeStamp(Timestamp lastEventFromIOCTimeStamp)
void
setLastRotateLogsEpochSeconds(long lastRotateLogsEpochSeconds)
set the time when the last data of this pv was storedvoid
setMonitor(boolean isMonitor)
set the archiving modevoid
setSamplingPeriod(double samplingPeriod)
set the sample periodvoid
setScanPeriodMillis(long scanPeriodMillis)
void
setSecondsOfLastEvent(long secondsOfLastEvent)
set the last event time
-
-
-
Constructor Detail
-
PVMetrics
public PVMetrics(String pvName, String controlPVname, long startEpochSeconds, ArchDBRTypes dbrTypes)
Constructor for PVMetrics- Parameters:
pvName
- the name of pvcontrolPVname
- the name of pv who controls this pv archived or notstartEpochSeconds
- the starting time and it is the the number of seconds since 1970/01/01dbrTypes
- ArchDBRTypes
-
-
Method Detail
-
setHostName
public void setHostName(String hostName)
-
getcontrolPVname
public String getcontrolPVname()
- Returns:
- the name of pv who controlled this pv archived or not
-
setConnectionLastLostEpochSeconds
public void setConnectionLastLostEpochSeconds(long connectionLastLostEpochSeconds)
-
getConnectionLastLostEpochSeconds
public long getConnectionLastLostEpochSeconds()
- Returns:
- the time when last connection was lost and it is the the number of seconds since 1970/01/01
-
addTimestampWrongEventCount
public void addTimestampWrongEventCount(Timestamp incorrectTimeStamp)
add 1 to the count of the events were dropped because of the wrong time stamp We keep a copy of the last incorrect timestamp we obtained and only increment if the current incorrect timestamp is different.- Parameters:
incorrectTimeStamp
-
-
addSampleBufferFullLostEventCount
public void addSampleBufferFullLostEventCount()
add 1 to the count of the events were dropped because of the over flow of the sample buffer
-
incrementInvalidTypeLostEventCount
public void incrementInvalidTypeLostEventCount(ArchDBRTypes newCADBRType)
-
incrementScanRawEventCount
public void incrementScanRawEventCount()
-
getInvalidTypeLostEventCount
public long getInvalidTypeLostEventCount()
If the PV changes DBR_Type, we do not add it to the sample buffer. This keeps track of how many event were lost because of a type change.- Returns:
- invalidTypeLostEventCount
-
getTimestampWrongEventCount
public long getTimestampWrongEventCount()
- Returns:
- the count of the events were dropped because of the wrong time stamp
-
getSampleBufferFullLostEventCount
public long getSampleBufferFullLostEventCount()
- Returns:
- count of the events were dropped because of over flow of the sample buffer
-
isEnable
public boolean isEnable()
- Returns:
- true if this pv is archived. Otherwise false
-
setEnable
public void setEnable(boolean isEnable)
-
setConnectionEstablishedEpochSeconds
public void setConnectionEstablishedEpochSeconds(long connectionEstablishedEpochSeconds)
-
addEventCounts
public void addEventCounts()
update event count and the time of last event and running
-
getEventRate
public double getEventRate()
- Returns:
- the average event rate in count/second
-
getStorageRate
public double getStorageRate()
- Returns:
- the average storage rate in byte/second
-
addStorageSize
public void addStorageSize(DBRTimeEvent timeevent)
update the staorage size- Parameters:
timeevent
- DBRTimeEvent
-
getPvName
public String getPvName()
- Returns:
- the name of this pv
-
isArchving
public boolean isArchving()
- Returns:
- true if this pv is archived.Otherwise, false
-
setArchving
public void setArchving(boolean isArchving)
set the archiving status- Parameters:
isArchving
-
-
getArchDBRTypes
public ArchDBRTypes getArchDBRTypes()
- Returns:
- the archiving dbr type of this pv
-
getElementCount
public int getElementCount()
- Returns:
- the element count of this pv's value
-
setElementCount
public void setElementCount(int elementCount)
set the element count of this pv- Parameters:
elementCount
-
-
isMonitor
public boolean isMonitor()
- Returns:
- true if this pv is archived in monitor mode.Otherwise, false
-
setMonitor
public void setMonitor(boolean isMonitor)
set the archiving mode- Parameters:
isMonitor
-
-
getSamplingPeriod
public double getSamplingPeriod()
- Returns:
- the sample period
-
setSamplingPeriod
public void setSamplingPeriod(double samplingPeriod)
set the sample period- Parameters:
samplingPeriod
- in second
-
isConnected
public boolean isConnected()
- Returns:
- true if this pv connected .Otherwise, false
-
setConnected
public void setConnected(boolean isConnected)
set the connection status- Parameters:
isConnected
-
-
getSecondsOfLastEvent
public long getSecondsOfLastEvent()
- Returns:
- the time of last event and it is the the number of seconds since 1970/01/01
-
setSecondsOfLastEvent
public void setSecondsOfLastEvent(long secondsOfLastEvent)
set the last event time- Parameters:
secondsOfLastEvent
- the time of last event and it is the the number of seconds since 1970/01/01
-
getLastRotateLogsEpochSeconds
public long getLastRotateLogsEpochSeconds()
- Returns:
- the last time when this pv's data was stored in short term storage. and it is the the number of seconds since 1970/01/01
-
setLastRotateLogsEpochSeconds
public void setLastRotateLogsEpochSeconds(long lastRotateLogsEpochSeconds)
set the time when the last data of this pv was stored- Parameters:
lastRotateLogsEpochSeconds
- the last time when this pv's data was stored in short term storage. and it is the the number of seconds since 1970/01/01
-
getConnectionFirstEstablishedEpochSeconds
public long getConnectionFirstEstablishedEpochSeconds()
- Returns:
- the time when the first connection was established and it is the the number of seconds since 1970/01/01
-
setConnectionFirstEstablishedEpochSeconds
public void setConnectionFirstEstablishedEpochSeconds(long connectionFirstEstablishedEpochSeconds)
set the time for the first connection- Parameters:
connectionFirstEstablishedEpochSeconds
- the time when the first connection was established and it is the the number of seconds since 1970/01/01
-
getConnectionLastRestablishedEpochSeconds
public long getConnectionLastRestablishedEpochSeconds()
- Returns:
- the time when the last connection was established and it is the the number of seconds since 1970/01/01
-
setConnectionLastRestablishedEpochSeconds
public void setConnectionLastRestablishedEpochSeconds(long connectionLastRestablishedEpochSeconds)
set the time when the last connection was established- Parameters:
connectionLastRestablishedEpochSeconds
- the time when the last connection was established and it is the the number of seconds since 1970/01/01
-
getConnectionLossRegainCount
public long getConnectionLossRegainCount()
- Returns:
- the count of the connection lost and regained
-
setConnectionLossRegainCount
public void setConnectionLossRegainCount(long connectionLossRegainCount)
set the count of the connection lost and regained- Parameters:
connectionLossRegainCount
- the count of the connection lost and regained
-
getDetailedStatus
public LinkedList<Map<String,String>> getDetailedStatus()
- Returns:
- the json string includes all the info in this class
-
getConnectionRequestMadeEpochSeconds
public long getConnectionRequestMadeEpochSeconds()
- Returns:
- the time when the connection request was sent and it is the the number of seconds since 1970/01/01
-
setConnectionRequestMadeEpochSeconds
public void setConnectionRequestMadeEpochSeconds(long connectionRequestMadeEpochSeconds)
set the the time when the connection request was sent- Parameters:
connectionRequestMadeEpochSeconds
- the time when the connection request was sent and it is the the number of seconds since 1970/01/01
-
getLastEventFromIOCTimeStampStr
public String getLastEventFromIOCTimeStampStr()
This is the timestamp of the last event from the IOC regardless of whether the timestamp is accurate or not Note this may not be what's written out into the archive that we used to compare against to enforce monotonically increasing eventstreams- Returns:
- HumanReadableLastEventFromIOCTimeStamp
-
getLastEventFromIOCTimeStamp
public long getLastEventFromIOCTimeStamp()
-
setLastEventFromIOCTimeStamp
public void setLastEventFromIOCTimeStamp(Timestamp lastEventFromIOCTimeStamp)
-
isLastConnectionEventState
public boolean isLastConnectionEventState()
-
setLastConnectionEventState
public void setLastConnectionEventState(boolean lastConnectionEventState)
-
resetConnectionLastLostEpochSeconds
public void resetConnectionLastLostEpochSeconds()
-
addConnectionLostRegainedFields
public void addConnectionLostRegainedFields(DBRTimeEvent event)
Add the cnxlostepsecs and cnxregainedepsecs to the specified DBRTimeEvent and then reset local state.- Parameters:
event
- DBRTimeEvent
-
getScanPeriodMillis
public long getScanPeriodMillis()
-
setScanPeriodMillis
public void setScanPeriodMillis(long scanPeriodMillis)
-
getEventCounts
public long getEventCounts()
-
-