CARMA C++
MonitorSubsystem.h
Go to the documentation of this file.
1 #ifndef CARMA_MONITOR_MONITORSUBSYSTEM_H
2 #define CARMA_MONITOR_MONITORSUBSYSTEM_H
3 
15 #include <string>
16 
18 
19 namespace carma {
20 
21 namespace dbms {
22  class TagIDAuthority;
23 }
24 
25 namespace monitor {
26 
27 
28 class MonitorPointSet;
29 class SystemFrameBuffer;
30 
31 
54 public:
55 
70  MonitorSubsystem( const std::string & subsystemName,
71  SystemFrameBuffer * buffer = 0,
72  int maxMonitorPoints = 600,
73  int maxSamples = 1800,
74  ARCHIVE_PRIORITY archivePriority = NORMAL,
75  bool onlyDEFAULT = true );
76 
80  virtual ~MonitorSubsystem( );
81 
95  bool configure();
96 
102  virtual void createHierarchy() = 0;
103 
109 
110 
111 
117  void resetValidity();
118 
123  void updateFrameAverage();
124 
128  double getFrameTime() const;
129 
134  double getPublishTime() const;
135 
140  double getReceiveTime() const;
141 
147  double getStartWriteTime() const ;
148 
154  double getEndWriteTime() const ;
155 
161  double getStartScriberWriteTime() const ;
162 
163 
184  double getLastWriterDelay () const ;
185 
191  double getLastWriteTime () const ;
192 
200  double getScriberWriteDelay() const;
201 
208  double getScriberWriteTime() const;
209 
215  void resetTimes () ;
216 
234  void startAutoWriter (double delay) const;
235 
244  void stopAutoWriter() const ;
245 
252  bool autoWriterIsAlive() const ;
253 
254 
262  static std::string makeName(const std::string& name, int number);
263 
267  int maxMonitorPoints() const ;
268 
272  int maxSamples() const ;
273 
274  // virtual, so docs have already been done...
275  bool isSubsystem() const;
276 
282 
287  static std::string transportHeaderToString () ;
288 
298  virtual std::string transportStatisticsToString (bool canonical = false) const;
299 
308  bool isCurrent () const;
309 
310 
320  bool isCurrent (long frameCount) const;
321 
322  /*
323  * Overridden methods of abstract MonitorSystemContainer methods.
324  * Documentation supplied by base class.
325  */
326  unsigned int read();
327  bool readNewest();
329  void write( );
330  void writeWithoutResettingValidities();
331  int getFrameCount() const;
332 
333 
334 private:
341  void setIdentity();
342 
343  void setMpTagIds( carma::dbms::TagIDAuthority & authority );
344 
350  void allocateAllMonitorPoints( );
351 
352  MonitorPointSet & monitorPointSet_;
353  const int maxMonitorPoints_;
354  const int maxSamples_;
355  ARCHIVE_PRIORITY archivePriority_;
356  bool onlyDEFAULT_;
357 };
358 
359 
360 } // namespace carma::monitor
361 } // namespace carma
362 
363 
364 #endif
double getStartScriberWriteTime() const
Time the last write was received on the ScriberPublisher.
void startAutoWriter(double delay) const
method to configure and start the auto-write thread.
bool autoWriterIsAlive() const
Test whether the auto-writer thread is alive (running).
double getReceiveTime() const
Get the mjd when the frame was received by the ACC.
ARCHIVE_PRIORITY
Archiving priority.
double getFrameTime() const
Get the mjd associated with the frame.
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 construct...
bool isSubsystem() const
Check if the component is a MonitorSubsystem.
int maxSamples() const
Return the size of the storage allocated for monitor samples.
double getScriberWriteTime() const
Time this frame of data was written to the subsystem IPQ.
A class that manages the sets of monitor points for a monitor subsystem.
int getFrameCount() const
Get the frame count for the last read frame.
void stopAutoWriter() const
Stop the auto-write thread.
void resetValidity()
Reset validity flags of all data.
bool readNewestConditionalCopy()
If new data is available it is copied from the queue into the monitor system.
Data should be archived by default when performance and bandwidth allow.
An abstract base class used to support the common functionality of a MonitorSystem and a MonitorSubsy...
bool readNewest()
Reads in the newest data from the IPQ into the local set of monitor points.
double getPublishTime() const
Get the mjd when the frame was published by the subsystem.
double getScriberWriteDelay() const
Offset from the half-second for writing this subsystem frame to the (local) subsystem IPQ...
double getEndWriteTime() const
Time the last monitor point set write was finished.
MonitorPointSet & getMonitorPointSet()
Get the monitor point set.
double getLastWriterDelay() const
The next few methods measure performance of monitor data transport.
Monitor system container interface definition.
unsigned int read()
Reads oldest unread data from the IPQ into the local set of monitor points.
double getLastWriteTime() const
Time (MJD) of the last write to the ScriberPublisher.
bool configure()
Configure does the complete setup of a monitor subsystem The steps are:
virtual ~MonitorSubsystem()
Destructor.
static std::string transportHeaderToString()
Dumps transport statistics table header, with legends for columns.
double getStartWriteTime() const
Time the last monitor point set write was started.
A lookup class for mapping names and IDs.
virtual void createHierarchy()=0
Create all typed monitor points and hierarchy Every subsystem must define this.
void write()
Write out the monitor point data values.
bool isCurrent() const
Returns true if the monitor subsystem contains data that is current.
MonitorPointSet & monitorPointSet()
Get reference to the underlying storage.
int maxMonitorPoints() const
Return the size of the storage allocated for monitor points.
void updateFrameAverage()
Average and ave validity is computed and set for each monitor point over all samples in the frame...
static std::string makeName(const std::string &name, int number)
Form a name string that is a root followed by an integer, e.g.
virtual std::string transportStatisticsToString(bool canonical=false) const
Dumps transport statistics as a table, with write delays, and transport/write times printed out as do...
Abstract MonitorSubsystem base class.