MTimer Class Reference
[OpenMaya - API module for common classes]

#include <MTimer.h>

List of all members.


Detailed Description

This class works similar to timerX MEL command.

MTimer class provides the functionality for calculating the time elapsed/consumed in executing a particular portion of the code. The portion of the code to be timed is embedded inbetween the calls to'beginTimer()' and 'endTimer()'. A call to 'elapsedTime()' gives the time spent in executing that portion of the code. The calculated time in seconds will be with 2 decimal accuracy.

Examples:

threadTestCmd.cpp, and threadTestWithLocksCmd.cpp.


Public Member Functions

 MTimer ()
 MTimer (const MTimer &)
 ~MTimer ()
void beginTimer ()
void endTimer ()
double elapsedTime ()
MTimeroperator= (const MTimer &rhs)
bool operator== (const MTimer &rhs) const
bool operator!= (const MTimer &rhs) const
void clear ()

Constructor & Destructor Documentation

MTimer::MTimer (  ) 

Default class constructor.

MTimer::MTimer ( const MTimer src  ) 

Copy Constructor.

Parameters:
[in] src the instance to copy

MTimer::~MTimer (  ) 

The class destructor.


Member Function Documentation

void MTimer::beginTimer (  ) 

The call to this function starts the timer.

Examples:

void MTimer::endTimer (  ) 

The call to this function ends the timer.

Examples:

double MTimer::elapsedTime (  ) 

This function returns the time elapsed between the calls to beginTimer and endTimer.

Examples:

MTimer & MTimer::operator= ( const MTimer rhs  ) 

Assignment operator.

Parameters:
[in] rhs The timer to copy from.

bool MTimer::operator== ( const MTimer rhs  )  const

Equality operator. Checks whether the start time and end time are same.

Parameters:
[in] rhs The timer to compare with.

bool MTimer::operator!= ( const MTimer rhs  )  const

InEquality operator.

Parameters:
[in] rhs The timer to compare with.

void MTimer::clear (  ) 

This function resets the member variables so that same MTimer object can be used to time other portions of the code.


Autodesk® Maya® 2009 © 1997-2008 Autodesk, Inc. All rights reserved. Generated with doxygen 1.5.6