CARMA C++
|
Abstract MonitorSubsystem base class. More...
#include <carma/monitor/MonitorSubsystem.h>
Public Member Functions | |
bool | autoWriterIsAlive () const |
Test whether the auto-writer thread is alive (running). More... | |
bool | configure () |
Configure does the complete setup of a monitor subsystem The steps are: More... | |
virtual void | createHierarchy ()=0 |
Create all typed monitor points and hierarchy Every subsystem must define this. More... | |
double | getEndWriteTime () const |
Time the last monitor point set write was finished. More... | |
int | getFrameCount () const |
Get the frame count for the last read frame. More... | |
double | getFrameTime () const |
Get the mjd associated with the frame. More... | |
double | getLastWriterDelay () const |
The next few methods measure performance of monitor data transport. More... | |
double | getLastWriteTime () const |
Time (MJD) of the last write to the ScriberPublisher. More... | |
MonitorPointSet & | getMonitorPointSet () |
Get the monitor point set. More... | |
double | getPublishTime () const |
Get the mjd when the frame was published by the subsystem. More... | |
double | getReceiveTime () const |
Get the mjd when the frame was received by the ACC. More... | |
double | getScriberWriteDelay () const |
Offset from the half-second for writing this subsystem frame to the (local) subsystem IPQ. More... | |
double | getScriberWriteTime () const |
Time this frame of data was written to the subsystem IPQ. More... | |
double | getStartScriberWriteTime () const |
Time the last write was received on the ScriberPublisher. More... | |
double | getStartWriteTime () const |
Time the last monitor point set write was started. More... | |
bool | isCurrent () const |
Returns true if the monitor subsystem contains data that is current. More... | |
bool | isCurrent (long frameCount) const |
Returns true if the monitor subsystem contains data that belongs to the timestamp. More... | |
bool | isSubsystem () const |
Check if the component is a MonitorSubsystem. More... | |
int | maxMonitorPoints () const |
Return the size of the storage allocated for monitor points. More... | |
int | maxSamples () const |
Return the size of the storage allocated for monitor samples. More... | |
MonitorPointSet & | monitorPointSet () |
Get reference to the underlying storage. More... | |
MonitorSubsystem (const std::string &subsystemName, SystemFrameBuffer *buffer=0, int maxMonitorPoints=600, int maxSamples=1800, ARCHIVE_PRIORITY archivePriority=NORMAL, bool onlyDEFAULT=true) | |
Constructor base subsystem configuration The derived class object must be configure() after construction The name is used to lookup the subsystem ID, so only specific subsystem names are allowed. More... | |
unsigned int | read () |
Reads oldest unread data from the IPQ into the local set of monitor points. More... | |
bool | readNewest () |
Reads in the newest data from the IPQ into the local set of monitor points. More... | |
bool | readNewestConditionalCopy () |
If new data is available it is copied from the queue into the monitor system. More... | |
void | resetTimes () |
void | resetValidity () |
Reset validity flags of all data. More... | |
void | startAutoWriter (double delay) const |
method to configure and start the auto-write thread. More... | |
void | stopAutoWriter () const |
Stop the auto-write thread. More... | |
virtual std::string | transportStatisticsToString (bool canonical=false) const |
Dumps transport statistics as a table, with write delays, and transport/write times printed out as doubles, with fixed precision. More... | |
void | updateFrameAverage () |
Average and ave validity is computed and set for each monitor point over all samples in the frame. More... | |
void | write () |
Write out the monitor point data values. More... | |
void | writeWithoutResettingValidities () |
virtual | ~MonitorSubsystem () |
Destructor. More... | |
![]() | |
bool | isActive () |
Checks to see if this system is actively receiving data. More... | |
MonitorSystemContainer (const std::string &systemName) | |
Constructor base subsystem configuration. More... | |
virtual bool | readNewestIfStale () |
Reads in data from the IPQ into the local set of monitor points if data is stale, that is, !isCurrent(). More... | |
virtual | ~MonitorSystemContainer () |
Destructor. More... | |
![]() | |
void | add (MonitorComponent &component) |
Add a subcomponent to this container A reference is kept to this subcomponent, so the caller is responsible for managing the lifecycle of the subcomponent; this container simply expects that it be available for access. More... | |
const Child & | getChild (int index) const |
Get reference to child monitor component by index. More... | |
::std::vector< Child > | getChildVec () const |
Get a vector of monitor components contained by this component. More... | |
MonitorComponent * | getComponentPtr (const ::std::string &name, bool caseSensitive) const |
Get a contained monitor component by hierarchical name The hierarchical name starts below this container and consist of dot (".") separated components. More... | |
MonitorPoint & | getFirstMonitorPoint () |
Recursively find the first monitor point in this container. More... | |
MonitorPoint & | getMonitorPoint (const std::string &name, bool caseSensitive) const |
Get a monitor point by name (hierarchical name OK). More... | |
MonitorPoint & | getMonitorPoint (tagIDType tagID) const |
Get a monitor point by tagID. More... | |
MonitorPoint * | getMonitorPointPtr (const std::string &name, bool caseSensitive) const |
MonitorPoint * | getMonitorPointPtr (tagIDType tagID) const |
int | getNumChildren () const |
Get the number of monitor components contained by this component. More... | |
virtual int | getNumContainerChildren () const |
Get the number of child monitor containers contained by this component. More... | |
virtual int | getNumContainerDescendants () const |
Get the number of child monitor containers contained by this component and it's children. More... | |
virtual int | getNumDescendants () const |
Get the total number of monitor components contained by this component and it's children. More... | |
int | getNumMonitorPoints (bool recurse=false) const |
Get the number of monitor points. More... | |
int | getNumMonitorPoints () |
Get the total number of monitor points in this container. More... | |
int | getNumSamples () |
Get the total number of samples in this container. More... | |
bool | hasAllData () const |
See if all MPs in this component and below have data samples. More... | |
virtual ::std::string | hierarchyToString (bool canonical=false, bool verbose=false, bool value=true, int sampleIndex=0, int indent=0, int levels=-1) const |
Dump this and all contained monitor components to a string. More... | |
virtual ::std::string | hierarchyToStringAverage (bool canonical=false, bool verbose=false, bool value=true, int indent=0, int levels=-1) const |
Dump this and all contained monitor components to a string. More... | |
virtual void | hierarchyToVector (::std::vector< ::std::string > &hierarchyList, bool canonical=false, bool verbose=false, int sampleIndex=0) const |
Dump this and all contained monitor component strings into a map hierarchy. More... | |
virtual std::string | leafToString (bool verbose=false, bool value=true, int sampleIndex=0) const |
Dump all leaf nodes below this component to a string. More... | |
MonitorContainer (const ::std::string &name) | |
Constructor. More... | |
virtual ::std::string | monitorPointTags (bool untagged=false) const |
Write list of monitor points and their tagIDs to a string, one monitor point per line. More... | |
virtual bool | operator== (const MonitorComponent &component) const |
Compares this monitor container for equality to the one passed. More... | |
void | setArchivePriority (const MonitorComponent::ARCHIVE_PRIORITY priority, bool onlyDEFAULT=true) |
Recursively set the archive priority of all monitor points below. More... | |
virtual void | setCanonicalName (const std::string &parents) |
Recursively set the canonical component name for this and all below. More... | |
virtual void | setMonitorPointAttributes () |
Set attributes of all monitor points held anywhere in the hierarchy within (and below) this container. More... | |
void | setNoData () const |
Recursively mark all data samples as INVALID_NO_DATA. More... | |
void | setPersistent (bool persistent) |
Set the persistent attribute for the value of a MonitorPoint, or in the case of a container for its descendants (recursively). More... | |
void | setValidity (MonitorPoint::VALIDITY validity) |
Recursively set validity for all samples of all monitor points below this container. More... | |
std::string | toString (bool canonicalName=false, bool verbose=false, bool value=true, int sampleIndex=0, int indent=0) const |
Write this monitor component to a string. More... | |
std::string | toStringAverage (bool canonicalName=false, bool verbose=false, bool value=true, int indent=0) const |
Write this monitor component to a string, using frame average values. More... | |
~MonitorContainer () | |
Destructor. More... | |
![]() | |
const std::string & | getCanonicalName () const |
Get the canonical component name. More... | |
virtual const std::string & | getDescription () const |
Get the verbose description of the monitor component. More... | |
virtual const std::string & | getLongName () const |
Get the long name of the monitor component. More... | |
virtual const std::string & | getName () const |
Get the component name (leaf part of canonical name). More... | |
virtual std::string | getPhysicalDeviceName () const |
Get the physical device name, if one exists. More... | |
std::string | getPhysicalDeviceString () const |
Get the physical device name, if one exists, enclosed in parentheses. More... | |
std::string | getPhysicalName () const |
Get the physical name, which is location.device.component or if there is no associated physical device it is just component name. More... | |
virtual const std::string & | getShortName () const |
Get the short name of the monitor component. More... | |
virtual bool | isMonitorPoint () const |
Identifies this component as a MonitorPoint or any derivative Should be over-ridden by the MonitorPoint class; others that don't derive from MP can use this default implementation. More... | |
MonitorComponent (const std::string &name) | |
Constructor. More... | |
bool | operator!= (const MonitorComponent &component) const |
Checks if components are not equal. More... | |
void | setDescription (const std::string &text) |
Set the verbose description of the monitor component. More... | |
void | setLongName (const std::string &name) |
Set the long name of the monitor component. More... | |
void | setName (const std::string &name) |
Set the leaf part of the canonical name of the monitor component. More... | |
void | setShortName (const std::string &name) |
Set the short name of the monitor component. More... | |
void | setShortName (const std::string &name, int index) |
Set the short name of the monitor component, with an index appended. More... | |
virtual | ~MonitorComponent () |
Destructor. More... | |
Static Public Member Functions | |
static std::string | makeName (const std::string &name, int number) |
Form a name string that is a root followed by an integer, e.g. More... | |
static std::string | transportHeaderToString () |
Dumps transport statistics table header, with legends for columns. More... | |
![]() | |
static std::string | archivePriorityToString (MonitorComponent::ARCHIVE_PRIORITY priority) |
Get a string representation for an archive priority. More... | |
static std::string | convertAllLower (std::string name) |
Convert a name to all lower case. More... | |
Additional Inherited Members | |
![]() | |
enum | ARCHIVE_PRIORITY { VITAL, USEFUL, NORMAL, DEBUG, VERBOSE, DEFAULT, DONTARCHIVE } |
Archiving priority. More... | |
![]() | |
virtual void | setLocalMonitorPointAttributes () |
Set attributes of all monitor points held directly by this container. More... | |
![]() | |
static Child | findDescendant (const MonitorContainer &rootContainer, const ::std::string &name, bool caseSensitive) |
![]() | |
bool | debug_ |
![]() | |
std::ostream & | operator<< (std::ostream &os, const MonitorComponent &component) |
Abstract MonitorSubsystem base class.
The distinguishing feature of this monitor container is the associated Frame and the virtual configuration methods that must be supplied by the derived class. The configuration steps used internally are:
create hierarchy of typed monitor points - specific subsystem
set tagIDs and canonical names for all MPs - this class
(but it must lookup tagIDs using specific subsystem lookup) set other params for all MPs - specific subsystem
The other params for the MPs may be set when the hierarchy is built or driven from a table/file/database.
Subsystem names are forced to have the first character UC, and all others LC.
After the derived MonitorSubsystem is instantiated it must be configured with the configure() method.
Definition at line 53 of file MonitorSubsystem.h.
carma::monitor::MonitorSubsystem::MonitorSubsystem | ( | const std::string & | subsystemName, |
SystemFrameBuffer * | buffer = 0 , |
||
int | maxMonitorPoints = 600 , |
||
int | maxSamples = 1800 , |
||
ARCHIVE_PRIORITY | archivePriority = NORMAL , |
||
bool | onlyDEFAULT = true |
||
) |
Constructor base subsystem configuration The derived class object must be configure() after construction The name is used to lookup the subsystem ID, so only specific subsystem names are allowed.
subsystemName | monitor subsystem name |
buffer | pointer to storage on ACC; NULL if within subsystem |
maxMonitorPoints | storage to be allocated for monitor points |
maxSamples | storage to be allocated for monitor sample values |
archivePriority | archive priority to set for all points |
onlyDEFAULT | if true, only set arcPriority for points that have DEFAULT priority, otherwise set all of them |
|
virtual |
Destructor.
bool carma::monitor::MonitorSubsystem::autoWriterIsAlive | ( | ) | const |
Test whether the auto-writer thread is alive (running).
bool carma::monitor::MonitorSubsystem::configure | ( | ) |
Configure does the complete setup of a monitor subsystem The steps are:
|
pure virtual |
Create all typed monitor points and hierarchy Every subsystem must define this.
double carma::monitor::MonitorSubsystem::getEndWriteTime | ( | ) | const |
Time the last monitor point set write was finished.
|
virtual |
Get the frame count for the last read frame.
Implements carma::monitor::MonitorSystemContainer.
double carma::monitor::MonitorSubsystem::getFrameTime | ( | ) | const |
Get the mjd associated with the frame.
double carma::monitor::MonitorSubsystem::getLastWriterDelay | ( | ) | const |
The next few methods measure performance of monitor data transport.
They provide the following data:
a) delay associated with the last autowriter thread to write to the ScriberPublisher b) time of the last write to the ScriberPublisher (manual or auto) c) write delay associated with ScriberPublisher writing to the IPQ d) actual time of writing to the IPQ
All times and delays are doubles, measured in seconds. All delays are measured from the corrected UTC half-second time tick. Offset from the half-second for the last auto writer thread.
double carma::monitor::MonitorSubsystem::getLastWriteTime | ( | ) | const |
Time (MJD) of the last write to the ScriberPublisher.
MonitorPointSet& carma::monitor::MonitorSubsystem::getMonitorPointSet | ( | ) |
Get the monitor point set.
double carma::monitor::MonitorSubsystem::getPublishTime | ( | ) | const |
Get the mjd when the frame was published by the subsystem.
Only valid in the ACC.
double carma::monitor::MonitorSubsystem::getReceiveTime | ( | ) | const |
Get the mjd when the frame was received by the ACC.
Only valid in the ACC.
double carma::monitor::MonitorSubsystem::getScriberWriteDelay | ( | ) | const |
Offset from the half-second for writing this subsystem frame to the (local) subsystem IPQ.
double carma::monitor::MonitorSubsystem::getScriberWriteTime | ( | ) | const |
Time this frame of data was written to the subsystem IPQ.
double carma::monitor::MonitorSubsystem::getStartScriberWriteTime | ( | ) | const |
Time the last write was received on the ScriberPublisher.
double carma::monitor::MonitorSubsystem::getStartWriteTime | ( | ) | const |
Time the last monitor point set write was started.
|
virtual |
Returns true if the monitor subsystem contains data that is current.
A read could make the data current, and hence make isCurrent return true. If a read does not make isCurrent true, then the subsystem is probably broken.
Implements carma::monitor::MonitorSystemContainer.
bool carma::monitor::MonitorSubsystem::isCurrent | ( | long | frameCount | ) | const |
Returns true if the monitor subsystem contains data that belongs to the timestamp.
frameCount
.
frameCount | long timestamp to match against timestamp for data in MonitorSubsystem |
|
virtual |
Check if the component is a MonitorSubsystem.
Reimplemented from carma::monitor::MonitorComponent.
|
static |
Form a name string that is a root followed by an integer, e.g.
Bima9. This is a helper method used by subsystems to form their name.
name | root name |
number | to append to the root |
int carma::monitor::MonitorSubsystem::maxMonitorPoints | ( | ) | const |
Return the size of the storage allocated for monitor points.
int carma::monitor::MonitorSubsystem::maxSamples | ( | ) | const |
Return the size of the storage allocated for monitor samples.
MonitorPointSet& carma::monitor::MonitorSubsystem::monitorPointSet | ( | ) |
Get reference to the underlying storage.
|
virtual |
Reads oldest unread data from the IPQ into the local set of monitor points.
This is a blocking read.
Implements carma::monitor::MonitorSystemContainer.
|
virtual |
Reads in the newest data from the IPQ into the local set of monitor points.
There is no blocking!!
Implements carma::monitor::MonitorSystemContainer.
|
virtual |
If new data is available it is copied from the queue into the monitor system.
If no unread data is available then the method returns. In either case there is no blocking.
Implements carma::monitor::MonitorSystemContainer.
void carma::monitor::MonitorSubsystem::resetTimes | ( | ) |
Resets all times associated with transport performance. If these times are not reset, then the last set value remains even if no write/transport occurs.
void carma::monitor::MonitorSubsystem::resetValidity | ( | ) |
Reset validity flags of all data.
All monitor points that are not persistent have the validity set to INVALID_NO_DATA.
void carma::monitor::MonitorSubsystem::startAutoWriter | ( | double | delay | ) | const |
method to configure and start the auto-write thread.
This method configures and starts the thread for automatic writing. This method is a combination of configureAutoWriter and startAutoWriter. The parameter delay must be greater than zero.
double delay in seconds. delay must be less than or equal to MAX_AUTO_WRITE_DELAY and greater than zero as the auto-writer operates on a period of a half-second.
throws | an ErrorException if delay > MAX_AUTO_WRITE_DELAY |
void carma::monitor::MonitorSubsystem::stopAutoWriter | ( | ) | const |
Stop the auto-write thread.
This method stops the thread for automatic writing. The thread makes a clean exit, completing any pending write.
|
static |
Dumps transport statistics table header, with legends for columns.
|
virtual |
Dumps transport statistics as a table, with write delays, and transport/write times printed out as doubles, with fixed precision.
canonical | bool if true, prints canonical name otherwise uses leaf name. |
Reimplemented from carma::monitor::MonitorComponent.
void carma::monitor::MonitorSubsystem::updateFrameAverage | ( | ) |
Average and ave validity is computed and set for each monitor point over all samples in the frame.
|
virtual |
Write out the monitor point data values.
Implements carma::monitor::MonitorSystemContainer.