CARMA C++
carma::monitor::SystemFrame Class Reference

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< SubsystemFramemakeSubsystemFrame (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< SubsystemFramemakeSubsystemFrameForIndex (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< SubsystemFramemakeSubsystemFrameForIndexHoldingLock (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
 

Detailed Description

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

See Also
carma::monitor::MonitorSystem
carma::monitor::SubsystemFrameBuffer
carma/monitor/monitorframe.idl
http://www.mmarray.org/project/WP/Monitoring/monitoringDesign.pdf

Definition at line 59 of file SystemFrame.h.

Constructor & Destructor Documentation

virtual carma::monitor::SystemFrame::~SystemFrame ( )
virtual

Destructor.

carma::monitor::SystemFrame::SystemFrame ( long  maxSubsystems,
long  maxMonitorPoints,
long  maxSamples 
)
protected

Constructs a SystemFrame instance.

Member Function Documentation

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.

Parameters
subsystemIDidentifier for subsystem to be allocated
ssMaxMonitorPointslong maximum number of monitor points this subsystem must accommodate
ssMaxSampleslong maximum number of monitor samples this subsystem must accommodate
Returns
index to allocated subsystem frame.
Exceptions
throwsan 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)

Returns
double delay specified as fractions of a second
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.

Returns
double time of last system IPQ write 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.

Returns
double time of last CarmaMonitorSystem IPQ write specified as an MJD
long carma::monitor::SystemFrame::getFrameCount ( ) const

Returns timestamp for SystemHeader as frameCount.

Returns
long frameCount timestamp for this SystemFrame.
long carma::monitor::SystemFrame::getMaxNumSubsystemFrames ( ) const

Size information - returns maximum number of subsystems this SystemFrame can accommodate.

Returns
long maximum number of subsystems frames possible in this SystemFrame.
long carma::monitor::SystemFrame::getMaxTotalMonitorPoints ( ) const

Size information - returns maximum cumulative number of monitor points across all subsystems that this SystemFrame can accommodate.

Returns
long cumulative maximum number of monitor points, across all subsystem frames, possible in this SystemFrame.
long carma::monitor::SystemFrame::getMaxTotalSamples ( ) const

Size information - returns cumulative maximum number of monitor samples, across all subsystems, this SystemFrame can accommodate.

Returns
long cumulative maximum number of monitor samples, across all subsystems, possible in this SystemFrame.
long carma::monitor::SystemFrame::getNumSubsystemFrames ( ) const

Size information - returns number of allocated subsystems in this SystemFrame.

Returns
long number of allocated subsystems frames 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.

Returns
double time of last RawCarmaMonitorSystem IPQ read 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.

Returns
set of 8 bit flags representing various status information about this frame.
int carma::monitor::SystemFrame::getSubsystemIndexHoldingLock ( unsigned short  subsystemID) const
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.

Parameters
subsystemIDidentifier of subsystem of interest
Returns
int index to entry for subsystem in subsystemFrameOffset array in this SystemFrame - is SUBSYSTEM_FRAME_ABSENT if subsystemID is not found.
bool carma::monitor::SystemFrame::isComplete ( ) const

True if getNumCleanFrames() == 0.

Implies that data in local copy (buffer) reflects data in shared memory.

Returns
bool true if data in local copy is same as data in shared memory.
bool carma::monitor::SystemFrame::isCurrent ( unsigned short  subsystemID) const

True if subsystem with subsystemID has frameCount == this->getFrameCount().

Parameters
subsystemIDidentifier of subsystem of interest.
Returns
bool true if getSubsystemFrame(subsystemID).getFrameCount() == getFrameCount().
bool carma::monitor::SystemFrame::isCurrentFrame ( ) const

Method returns true if frame's timestamp is current; false otherwise.

Returns
bool true if current monitor system frame has a frameCount that corresponds to the current half-second tick.
::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.

Parameters
subsystemIDidentifier of subsystem
Returns
SubsystemFrame& reference to newly created SubsystemFrame object.
See Also
carma::monitor::SubsystemFrame
::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.

Parameters
indexint index in subsystemFrameOffset array in SystemHeader+ managed by this SystemFrame.
Returns
SubsystemFrame& reference to newly created SubsystemFrame object.
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)

Parameters
writeDelaydouble 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.

Parameters
mjdTimestamptime 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.

Parameters
mjdTimestamptime of last CarmaMonitorSystem IPQ write specified as an MJD
long carma::monitor::SystemFrame::setFrameCount ( const long  frameCount)

Sets timestamp for SystemHeader as frameCount.

Parameters
frameCountconst long frameCount timestamp for this SystemFrame.
void carma::monitor::SystemFrame::setNumSubsystemFrames ( unsigned short  numSubsystems)

Size information - Sets number of allocated subsystems in this SystemFrame.

Parameters
numSubsystemsmaximum 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.

Parameters
mjdTimestamptime 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.

Returns
set of 8 bit flags representing various status information about this frame.
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.

Parameters
subsystemIDidentifier of subsystem of interest
Returns
bool false iff FSP for subsystem has not been started
void carma::monitor::SystemFrame::syncSystemAndSubsystemsToNewFrameDataHoldingWriteLock ( )
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.

Parameters
subsystemFrameTransportSubsystemFrame& transported sample data containing all sample values with a subsystem

The documentation for this class was generated from the following file: