CARMA C++
|
Frame containing monitor points for all monitor subsystems. More...
#include "carma/monitor/SystemFrame.h"
Inherited by carma::monitor::SystemFrameBuffer.
Public Member Functions | |
int | allocateSubsystemFrame (unsigned short subsystemID, long ssMaxMonitorPoints, long ssMaxSamples) |
method to allocate space within the system frame for a subsystem frame, its monitor points and its samples. More... | |
void | clearAllTimes () |
Clears all times - collator time, raw read time and final write time. More... | |
double | getCollatorWriteDelay () const |
Returns the delay used by the writer part of the frameCollator to write to the associated IPQ in the ACC. More... | |
double | getCollatorWriteTime () const |
Gets the time of the last collator write to the associated system IPQ. More... | |
double | getFinalWriteTime () const |
Gets the time of the last write to the associated CarmaMonitorSystem. More... | |
long | getFrameCount () const |
Returns timestamp for SystemHeader as frameCount. More... | |
long | getMaxNumSubsystemFrames () const |
Size information - returns maximum number of subsystems this SystemFrame can accommodate. More... | |
long | getMaxTotalMonitorPoints () const |
Size information - returns maximum cumulative number of monitor points across all subsystems that this SystemFrame can accommodate. More... | |
long | getMaxTotalSamples () const |
Size information - returns cumulative maximum number of monitor samples, across all subsystems, this SystemFrame can accommodate. More... | |
long | getNumSubsystemFrames () const |
Size information - returns number of allocated subsystems in this SystemFrame. More... | |
double | getRawReadTime () const |
Gets the time of the last read from the associated RawCarmaMonitorSystem. More... | |
unsigned char | getStatusFlags () const |
Returns status flags for system frame. More... | |
size_t | getSystemTotalSizeInBytes () const |
bool | isComplete () const |
True if getNumCleanFrames() == 0. More... | |
bool | isCurrent (unsigned short subsystemID) const |
True if subsystem with subsystemID has frameCount == this->getFrameCount(). More... | |
bool | isCurrentFrame () const |
Method returns true if frame's timestamp is current; false otherwise. More... | |
::std::auto_ptr< SubsystemFrame > | makeSubsystemFrame (unsigned short subsystemID) const |
Returns a SubsystemFrame object wrapped around an internally stored SubsystemHeader structure containing monitor subsystem information for subsystem with ID 'subsystemID'. More... | |
::std::auto_ptr< SubsystemFrame > | makeSubsystemFrameForIndex (int index) const |
Returns newly created SubsystemFrame object given the index to the subsystem in the subsystemFrameOffset array. More... | |
void | resetNumCleanFrames () |
Sets numCleanSubsystemnFrames_ to getNumSubsystemFrames(). More... | |
void | setCollatorWriteDelay (double writeDelay) |
Writes the value of the delay used by the writer part of the frameCollator * to write to the associated IPQ in the ACC. More... | |
void | setCollatorWriteTime (double mjdTimestamp) |
Sets the time of the last collator write to the associated system IPQ. More... | |
void | setFinalWriteTime (double mjdTimestamp) |
Sets the time of the last write to the associated CarmaMonitorSystem. More... | |
long | setFrameCount (const long frameCount) |
Sets timestamp for SystemHeader as frameCount. More... | |
void | setNumSubsystemFrames (unsigned short numSubsystems) |
Size information - Sets number of allocated subsystems in this SystemFrame. More... | |
void | setRawReadTime (double mjdTimestamp) |
Sets the time of the last read from the associated RawCarmaMonitorSystem. More... | |
void | setStatusFlags (unsigned char flags) |
Sets status flags for system frame. More... | |
bool | subsystemFrameIsWritten (unsigned short subsystemID) const |
Returns true if subsystem frame corresponding to 'subsystemID' was written to its IPQ even once. More... | |
void | synchronize (const SystemFrame &src) |
void | writeSubsystemFrame (const TransportSubsystemFrame &subsystemFrame) |
Writes transported sample values into subsystem frame given all sample values assciated with the subsystem in the form of a TransportSubsystemFrame structure. More... | |
virtual | ~SystemFrame () |
Destructor. More... | |
Static Public Member Functions | |
static size_t | getSystemHeaderSizeInBytes () |
Protected Member Functions | |
int | allocateSubsystemHoldingWriteLock (unsigned short subsystemID, long ssMaxMonitorPoints, long ssMaxSamples) |
bool | checkIsCurrentFrameHoldingLock (double *mjdDelta) const |
int | getSubsystemIndexHoldingLock (unsigned short subsystemID) const |
Given the subsystemID, returns the index of the subsystem in the subsystemFrameOffset array. More... | |
const SystemHeader & | getSystemFrameDataHoldingLock () const |
SystemHeader & | getSystemFrameDataHoldingWriteLock () |
::std::auto_ptr< SubsystemFrame > | makeSubsystemFrameForIndexHoldingLock (int index) const |
void | syncSystemAndSubsystemsToNewFrameDataHoldingWriteLock () |
Sets the pointers to the subsystem index array (subsystemIndex) and the subsystem offset array (subsystemFrameOffset). More... | |
SystemFrame (long maxSubsystems, long maxMonitorPoints, long maxSamples) | |
Constructs a SystemFrame instance. More... | |
Protected Attributes | |
const size_t * | frameDataSsDataOffsetArray_ |
const int * | frameDataSsIndexArray_ |
const size_t | frameStorageSizeInBytes_ |
util::PthreadRWLock | guard_ |
const long | maxMonitorPoints_ |
const long | maxSamples_ |
const long | maxSubsystems_ |
Static Protected Attributes | |
static const int | SUBSYSTEM_FRAME_ABSENT |
Frame containing monitor points for all monitor subsystems.
A monitor subsystem is any collection of CARMA components that communicates with the Array Control Computer through a single computer. A monitor system is the collection of all monitor subsystems of interest. This collection of monitor points across all subsystems is available in the Array Control Computer. The Carma Monitor System storage is managed by this class.
A SystemFrameBuffer allows changes made to monitor point values in shared memory to be reflected in the local copy in this class instance.
NOTE: The term "monitor stream" as used in this document refers to all monitor data collected at each monitor subsystem, flowing to the ACC and merged there to form the totality of monitor information across all of CARMA. The term "client" as used in this document refers to clients of monitor system processes - these can be processes that write monitor data to the monitor stream, and processes that read monitor data from the monitor stream.
::carma::monitor::SubsystemFrameBuffer::read
Definition at line 59 of file SystemFrame.h.
|
virtual |
Destructor.
|
protected |
Constructs a SystemFrame instance.
int carma::monitor::SystemFrame::allocateSubsystemFrame | ( | unsigned short | subsystemID, |
long | ssMaxMonitorPoints, | ||
long | ssMaxSamples | ||
) |
method to allocate space within the system frame for a subsystem frame, its monitor points and its samples.
This method returns the index for the allocated subsystem frame. This index may be used with other methods of the SystemFrame class to get the subsystem frame.
subsystemID | identifier for subsystem to be allocated |
ssMaxMonitorPoints | long maximum number of monitor points this subsystem must accommodate |
ssMaxSamples | long maximum number of monitor samples this subsystem must accommodate |
throws | an ErrorException if the frame does not have enough space to accomodate the subsystem frame. |
void carma::monitor::SystemFrame::clearAllTimes | ( | ) |
Clears all times - collator time, raw read time and final write time.
Resets all times to 0.0D.
double carma::monitor::SystemFrame::getCollatorWriteDelay | ( | ) | const |
Returns the delay used by the writer part of the frameCollator to write to the associated IPQ in the ACC.
The delay is specified as a fraction of a second after the half-second tick - it is in the range [0.0, 500.0)
double carma::monitor::SystemFrame::getCollatorWriteTime | ( | ) | const |
Gets the time of the last collator write to the associated system IPQ.
The time is specified as an MJD.
double carma::monitor::SystemFrame::getFinalWriteTime | ( | ) | const |
Gets the time of the last write to the associated CarmaMonitorSystem.
The time is specified as an MJD.
long carma::monitor::SystemFrame::getFrameCount | ( | ) | const |
Returns timestamp for SystemHeader as frameCount.
long carma::monitor::SystemFrame::getMaxNumSubsystemFrames | ( | ) | const |
Size information - returns maximum number of subsystems this SystemFrame can accommodate.
long carma::monitor::SystemFrame::getMaxTotalMonitorPoints | ( | ) | const |
Size information - returns maximum cumulative number of monitor points across all subsystems that this SystemFrame can accommodate.
long carma::monitor::SystemFrame::getMaxTotalSamples | ( | ) | const |
Size information - returns cumulative maximum number of monitor samples, across all subsystems, this SystemFrame can accommodate.
long carma::monitor::SystemFrame::getNumSubsystemFrames | ( | ) | const |
Size information - returns number of allocated subsystems in this SystemFrame.
double carma::monitor::SystemFrame::getRawReadTime | ( | ) | const |
Gets the time of the last read from the associated RawCarmaMonitorSystem.
The time is specified as an MJD.
unsigned char carma::monitor::SystemFrame::getStatusFlags | ( | ) | const |
Returns status flags for system frame.
Used internally to determine if frame was written to IPQ.
|
protected |
Given the subsystemID, returns the index of the subsystem in the subsystemFrameOffset array.
Uses a binary search on the sorted subsystemIndex array with the subsystemID as the key.
subsystemID | identifier of subsystem of interest |
bool carma::monitor::SystemFrame::isComplete | ( | ) | const |
True if getNumCleanFrames() == 0.
Implies that data in local copy (buffer) reflects data in shared memory.
bool carma::monitor::SystemFrame::isCurrent | ( | unsigned short | subsystemID | ) | const |
True if subsystem with subsystemID has frameCount == this->getFrameCount().
subsystemID | identifier of subsystem of interest. |
bool carma::monitor::SystemFrame::isCurrentFrame | ( | ) | const |
Method returns true if frame's timestamp is current; false otherwise.
::std::auto_ptr< SubsystemFrame > carma::monitor::SystemFrame::makeSubsystemFrame | ( | unsigned short | subsystemID | ) | const |
Returns a SubsystemFrame object wrapped around an internally stored SubsystemHeader structure containing monitor subsystem information for subsystem with ID 'subsystemID'.
It is the caller's responsibility to delete memory.
subsystemID | identifier of subsystem |
::std::auto_ptr< SubsystemFrame > carma::monitor::SystemFrame::makeSubsystemFrameForIndex | ( | int | index | ) | const |
Returns newly created SubsystemFrame object given the index to the subsystem in the subsystemFrameOffset array.
index | int index in subsystemFrameOffset array in SystemHeader+ managed by this SystemFrame. |
void carma::monitor::SystemFrame::resetNumCleanFrames | ( | ) |
Sets numCleanSubsystemnFrames_ to getNumSubsystemFrames().
void carma::monitor::SystemFrame::setCollatorWriteDelay | ( | double | writeDelay | ) |
Writes the value of the delay used by the writer part of the frameCollator * to write to the associated IPQ in the ACC.
The delay is specified as a fraction of a second after the half-second tick - it is in the range [0.0, 500.0)
writeDelay | double delay specified as fractions of a second |
void carma::monitor::SystemFrame::setCollatorWriteTime | ( | double | mjdTimestamp | ) |
Sets the time of the last collator write to the associated system IPQ.
The time is specified as an MJD.
mjdTimestamp | time of last system IPQ write specified as an MJD |
void carma::monitor::SystemFrame::setFinalWriteTime | ( | double | mjdTimestamp | ) |
Sets the time of the last write to the associated CarmaMonitorSystem.
The time is specified as an MJD.
mjdTimestamp | time of last CarmaMonitorSystem IPQ write specified as an MJD |
long carma::monitor::SystemFrame::setFrameCount | ( | const long | frameCount | ) |
Sets timestamp for SystemHeader as frameCount.
frameCount | const long frameCount timestamp for this SystemFrame. |
void carma::monitor::SystemFrame::setNumSubsystemFrames | ( | unsigned short | numSubsystems | ) |
Size information - Sets number of allocated subsystems in this SystemFrame.
numSubsystems | maximum number of allocated subsystems frames in this SystemFrame. |
void carma::monitor::SystemFrame::setRawReadTime | ( | double | mjdTimestamp | ) |
Sets the time of the last read from the associated RawCarmaMonitorSystem.
The time is specified as an MJD.
mjdTimestamp | time of last RawCarmaMonitorSystem IPQ read specified as an MJD |
void carma::monitor::SystemFrame::setStatusFlags | ( | unsigned char | flags | ) |
Sets status flags for system frame.
Used internally to determine if frame was written to IPQ.
bool carma::monitor::SystemFrame::subsystemFrameIsWritten | ( | unsigned short | subsystemID | ) | const |
Returns true if subsystem frame corresponding to 'subsystemID' was written to its IPQ even once.
In other words, this is false iff the frameScriberPublisher for this subsystem was not started to date.
subsystemID | identifier of subsystem of interest |
|
protected |
Sets the pointers to the subsystem index array (subsystemIndex) and the subsystem offset array (subsystemFrameOffset).
These pointers have to be set so there's enough space for each of these arrays. This method is also called after a read as the pointers will be pointing to addresses in the address space of the process that last wrote to the IPQ.
void carma::monitor::SystemFrame::writeSubsystemFrame | ( | const TransportSubsystemFrame & | subsystemFrame | ) |
Writes transported sample values into subsystem frame given all sample values assciated with the subsystem in the form of a TransportSubsystemFrame structure.
subsystemFrame | TransportSubsystemFrame& transported sample data containing all sample values with a subsystem |