casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Attributes | List of all members
casa::PlotLogMeasurement Class Reference

Used to report time and memory measurements. More...

#include <PlotLogger.h>

Inheritance diagram for casa::PlotLogMeasurement:
casa::PlotLogMessage casacore::LogMessage

Public Types

enum  TimeUnit { SECOND }
 Static //. More...
 
enum  MemoryUnit {
  BYTE,
  KILOBYTE,
  MEGABYTE
}
 Available memory units. More...
 
- Public Types inherited from casacore::LogMessage
enum  Priority {
  DEBUGGING,
  DEBUG2,
  DEBUG1,
  NORMAL5,
  NORMAL4,
  NORMAL3,
  NORMAL2,
  NORMAL1,
  NORMAL,
  WARN,
  SEVERE
}
 An "importance" which is assigned to each LogMessage. More...
 

Public Member Functions

 PlotLogMeasurement (const casacore::String &origin1, const casacore::String &origin2, TimeUnit timeUnit=DEFAULT_TIME_UNIT, MemoryUnit memoryUnit=DEFAULT_MEMORY_UNIT, int eventType=DEFAULT_EVENT_TYPE)
 Non-Static //. More...
 
 PlotLogMeasurement (const PlotLogMeasurement &copy)
 Copy constructor. More...
 
 ~PlotLogMeasurement ()
 Destructor. More...
 
time_t startTime () const
 Returns the time/memory when the measurement started. More...
 
unsigned int startMemory () const
 
double time () const
 Returns the time/memory difference between when the measurement started and when the measurement ended. More...
 
double memory () const
 
TimeUnit timeUnit () const
 Returns the time/memory units for this measurement. More...
 
MemoryUnit memoryUnit () const
 
void startMeasurement ()
 Starts the measurement by setting the start time and memory. More...
 
void stopMeasurement ()
 Calculates the measurements from the last starting point to this point, and generates the log message. More...
 
- Public Member Functions inherited from casa::PlotLogMessage
 PlotLogMessage (int eventType=DEFAULT_EVENT_TYPE)
 Non-Static //. More...
 
 PlotLogMessage (const casacore::String &origin1, const casacore::String &origin2, int eventType=DEFAULT_EVENT_TYPE)
 Constructor which takes the origin(s) and an optional priority. More...
 
 PlotLogMessage (const casacore::String &origin1, const casacore::String &origin2, const casacore::String &message, int eventType=DEFAULT_EVENT_TYPE)
 Constructor which takes the origin(s), the message, and an optional priority. More...
 
 PlotLogMessage (const PlotLogMessage &copy)
 Copy constructor. More...
 
virtual ~PlotLogMessage ()
 Destructor. More...
 
virtual int eventType () const
 Returns the event type of this message. More...
 
- Public Member Functions inherited from casacore::LogMessage
 LogMessage (Priority priority=NORMAL)
 Create a message with the given priority and the current time, and an empty origin and message. More...
 
 LogMessage (const LogOrigin &sourceLocation, Priority priority=NORMAL)
 Create a message with the given location and priority, the current time and an empty message. More...
 
 LogMessage (const String &message, const LogOrigin &sourceLocation, Priority=NORMAL)
 Create a completely filled out LogMessage. More...
 
 LogMessage (const LogMessage &other)
 Make this LogMessage a copy of other. More...
 
LogMessageoperator= (const LogMessage &other)
 
 ~LogMessage ()
 
const Stringmessage () const
 Get the message text. More...
 
LogMessagemessage (const String &message, Bool keepLastTime=False)
 Set the message text. More...
 
uInt line () const
 Get and set the line number in the LogOrigin. More...
 
LogMessageline (uInt which)
 
LogMessagesourceLocation (const SourceLocation *where)
 Set the source location - usually this will be called with the macro WHERE. More...
 
const LogOriginorigin () const
 Get and set the origin of this LogMessage. More...
 
LogMessageorigin (const LogOrigin &origin)
 
Priority priority () const
 Get or change the priority of this LogMessage. More...
 
LogMessagepriority (Priority which)
 
const TimemessageTime () const
 Returns the time at which the message text was created. More...
 
LogMessagemessageTime (const Time &theTime)
 Normally you should not manually set the time, however there may be rare circumstances where it is useful - for example if you have a single static message that you want to send out at various times. More...
 
String toString () const
 Turn this entire LogMessage into a String. More...
 
String toTermString () const
 

Static Public Member Functions

static casacore::String timeUnits (TimeUnit t)
 Get a string representation of the given time/memory unit. More...
 
static casacore::String memoryUnits (MemoryUnit m)
 
- Static Public Member Functions inherited from casacore::LogMessage
static const StringtoString (Priority which)
 Map the given priority into a String - so, for example, it can be stored in a table. More...
 

Static Public Attributes

static const TimeUnit DEFAULT_TIME_UNIT
 Default units. More...
 
static const MemoryUnit DEFAULT_MEMORY_UNIT
 
- Static Public Attributes inherited from casa::PlotLogMessage
static const int DEFAULT_EVENT_TYPE
 Static //. More...
 

Private Attributes

time_t m_startTime
 Start time. More...
 
unsigned int m_startMemory
 Start memory. More...
 
double m_time
 casacore::Time and memory differences More...
 
double m_memory
 
TimeUnit m_timeUnit
 casacore::Time unit More...
 
MemoryUnit m_memoryUnit
 casacore::Memory unit More...
 

Additional Inherited Members

- Protected Attributes inherited from casa::PlotLogMessage
int m_eventType
 Event type, either a value from PlotLogger::Event, or a custom user-defined value. More...
 

Detailed Description

Used to report time and memory measurements.

This functionality can be accessed either directly with a PlotLogMeasurement object or indirectly through the PlotLogger class. Message is: END.: [time] [timeUnits]. casacore::Memory: [memory] [memoryUnits]. If the measurement has not been ended, calls stopMeasurement() first.

Definition at line 92 of file PlotLogger.h.

Member Enumeration Documentation

Available memory units.

Enumerator
BYTE 
KILOBYTE 
MEGABYTE 

Definition at line 103 of file PlotLogger.h.

Static //.

Available time units. Currently only seconds because that's all that C++ natively supports.

Enumerator
SECOND 

Definition at line 98 of file PlotLogger.h.

Constructor & Destructor Documentation

casa::PlotLogMeasurement::PlotLogMeasurement ( const casacore::String origin1,
const casacore::String origin2,
TimeUnit  timeUnit = DEFAULT_TIME_UNIT,
MemoryUnit  memoryUnit = DEFAULT_MEMORY_UNIT,
int  eventType = DEFAULT_EVENT_TYPE 
)

Non-Static //.

Constructor which takes the origin(s), optional time and memory units, and an optional priority. Also calls startMeasurement().

casa::PlotLogMeasurement::PlotLogMeasurement ( const PlotLogMeasurement copy)

Copy constructor.

casa::PlotLogMeasurement::~PlotLogMeasurement ( )

Destructor.

Member Function Documentation

double casa::PlotLogMeasurement::memory ( ) const
MemoryUnit casa::PlotLogMeasurement::memoryUnit ( ) const
static casacore::String casa::PlotLogMeasurement::memoryUnits ( MemoryUnit  m)
static
void casa::PlotLogMeasurement::startMeasurement ( )

Starts the measurement by setting the start time and memory.

Measurement automatically begins when the object is constructed, but can be restarted as desired.

unsigned int casa::PlotLogMeasurement::startMemory ( ) const
time_t casa::PlotLogMeasurement::startTime ( ) const

Returns the time/memory when the measurement started.

void casa::PlotLogMeasurement::stopMeasurement ( )

Calculates the measurements from the last starting point to this point, and generates the log message.

double casa::PlotLogMeasurement::time ( ) const

Returns the time/memory difference between when the measurement started and when the measurement ended.

Invalid if the measurement was never started and ended.

TimeUnit casa::PlotLogMeasurement::timeUnit ( ) const

Returns the time/memory units for this measurement.

static casacore::String casa::PlotLogMeasurement::timeUnits ( TimeUnit  t)
static

Get a string representation of the given time/memory unit.

Member Data Documentation

const MemoryUnit casa::PlotLogMeasurement::DEFAULT_MEMORY_UNIT
static

Definition at line 110 of file PlotLogger.h.

const TimeUnit casa::PlotLogMeasurement::DEFAULT_TIME_UNIT
static

Default units.

Definition at line 109 of file PlotLogger.h.

double casa::PlotLogMeasurement::m_memory
private

Definition at line 173 of file PlotLogger.h.

MemoryUnit casa::PlotLogMeasurement::m_memoryUnit
private

casacore::Memory unit

Definition at line 179 of file PlotLogger.h.

unsigned int casa::PlotLogMeasurement::m_startMemory
private

Start memory.

Definition at line 170 of file PlotLogger.h.

time_t casa::PlotLogMeasurement::m_startTime
private

Start time.

Definition at line 167 of file PlotLogger.h.

double casa::PlotLogMeasurement::m_time
private

casacore::Time and memory differences

Definition at line 173 of file PlotLogger.h.

TimeUnit casa::PlotLogMeasurement::m_timeUnit
private

casacore::Time unit

Definition at line 176 of file PlotLogger.h.


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