Class PVMetrics
java.lang.Object
org.epics.archiverappliance.engine.pv.PVMetrics
PVMetrics includes the dynamic information of the pv
- Author:
- Luofeng Li
-
Constructor Summary
ConstructorsConstructorDescriptionPVMetrics(String pvName, String controlPVname, long startEpochSeconds, ArchDBRTypes dbrTypes) Constructor for PVMetrics -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd the cnxlostepsecs and cnxregainedepsecs to the specified DBRTimeEvent and then reset local state.voidupdate event count and the time of last event and runningvoidadd 1 to the count of the events were dropped because of the over flow of the sample buffervoidaddStorageSize(DBRTimeEvent timeevent) update the staorage sizevoidaddTimestampWrongEventCount(Instant 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.longlonglonglonglongintlongdoublelongIf the PV changes DBR_Type, we do not add it to the sample buffer.longThis 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 eventstreamslonglongdoublelonglongdoublelongvoidincrementInvalidTypeLostEventCount(ArchDBRTypes newCADBRType) voidbooleanbooleanbooleanisEnable()booleanvoidvoidsetArchving(boolean isArchving) set the archiving statusvoidsetConnected(boolean isConnected) set the connection statusvoidsetConnectionEstablishedEpochSeconds(long connectionEstablishedEpochSeconds) voidsetConnectionFirstEstablishedEpochSeconds(long connectionFirstEstablishedEpochSeconds) set the time for the first connectionvoidsetConnectionLastLostEpochSeconds(long connectionLastLostEpochSeconds) voidsetConnectionLastRestablishedEpochSeconds(long connectionLastRestablishedEpochSeconds) set the time when the last connection was establishedvoidsetConnectionLossRegainCount(long connectionLossRegainCount) set the count of the connection lost and regainedvoidsetConnectionRequestMadeEpochSeconds(long connectionRequestMadeEpochSeconds) set the the time when the connection request was sentvoidsetElementCount(int elementCount) set the element count of this pvvoidsetEnable(boolean isEnable) voidsetHostName(String hostName) voidsetLastConnectionEventState(PVConnectionState lastConnectionEventState) voidsetLastEventFromIOCTimeStamp(Instant lastEventFromIOCTimeStamp) voidsetLastRotateLogsEpochSeconds(long lastRotateLogsEpochSeconds) set the time when the last data of this pv was storedvoidsetMonitor(boolean isMonitor) set the archiving modevoidsetSamplingPeriod(double samplingPeriod) set the sample periodvoidsetScanPeriodMillis(long scanPeriodMillis) voidsetSecondsOfLastEvent(long secondsOfLastEvent) set the last event time
-
Constructor Details
-
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 Details
-
setHostName
-
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
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
-
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
update the staorage size- Parameters:
timeevent- DBRTimeEvent
-
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
- 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
- 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
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
-
lastConnectionEventState
-
setLastConnectionEventState
-
resetConnectionLastLostEpochSeconds
public void resetConnectionLastLostEpochSeconds() -
addConnectionLostRegainedFields
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() -
getRetievalMetrics
-