casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Attributes
casa::PlotLogMeasurement Class Reference

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

#include <PlotLogger.h>

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

List of all members.

Public Types

enum  TimeUnit { SECOND }
 Static //. More...
enum  MemoryUnit {
  BYTE,
  KILOBYTE,
  MEGABYTE
}
 Available memory units. More...

Public Member Functions

 PlotLogMeasurement (const String &origin1, const String &origin2, TimeUnit timeUnit=DEFAULT_TIME_UNIT, MemoryUnit memoryUnit=DEFAULT_MEMORY_UNIT, int eventType=DEFAULT_EVENT_TYPE)
 Non-Static //.
 PlotLogMeasurement (const PlotLogMeasurement &copy)
 Copy constructor.
 ~PlotLogMeasurement ()
 Destructor.
time_t startTime () const
 Returns the time/memory when the measurement started.
unsigned int startMemory () const
double time () const
 Returns the time/memory difference between when the measurement started and when the measurement ended.
double memory () const
TimeUnit timeUnit () const
 Returns the time/memory units for this measurement.
MemoryUnit memoryUnit () const
void startMeasurement ()
 Starts the measurement by setting the start time and memory.
void stopMeasurement ()
 Calculates the measurements from the last starting point to this point, and generates the log message.

Static Public Member Functions

static String timeUnits (TimeUnit t)
 Get a string representation of the given time/memory unit.
static String memoryUnits (MemoryUnit m)

Static Public Attributes

static const TimeUnit DEFAULT_TIME_UNIT
 Default units.
static const MemoryUnit DEFAULT_MEMORY_UNIT

Private Attributes

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

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]. Memory: [memory] [memoryUnits]. If the measurement has not been ended, calls stopMeasurement() first.

Definition at line 95 of file PlotLogger.h.


Member Enumeration Documentation

Available memory units.

Enumerator:
BYTE 
KILOBYTE 
MEGABYTE 

Definition at line 106 of file PlotLogger.h.

Static //.

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

Enumerator:
SECOND 

Definition at line 101 of file PlotLogger.h.


Constructor & Destructor Documentation

casa::PlotLogMeasurement::PlotLogMeasurement ( const String origin1,
const 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().

Copy constructor.

Destructor.


Member Function Documentation

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

Returns the time/memory when the measurement started.

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

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

Invalid if the measurement was never started and ended.

Returns the time/memory units for this measurement.

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


Member Data Documentation

Definition at line 113 of file PlotLogger.h.

Default units.

Definition at line 112 of file PlotLogger.h.

Definition at line 176 of file PlotLogger.h.

Memory unit.

Definition at line 182 of file PlotLogger.h.

Start memory.

Definition at line 173 of file PlotLogger.h.

Start time.

Definition at line 170 of file PlotLogger.h.

Time and memory differences.

Definition at line 176 of file PlotLogger.h.

Time unit.

Definition at line 179 of file PlotLogger.h.


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