cuIBM
A GPU-based Immersed Boundary Method code
Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | List of all members
Logger Class Reference

Monitors the time spent to achieve a certain task. More...

#include <logger.h>

Public Member Functions

 Logger ()
 Constructor. More...
 
 Logger (std::string folder)
 Constructor overloading. Opens files given the case directory. More...
 
 ~Logger ()
 Destructor. More...
 
void startTimer (std::string event)
 Starts the timer. More...
 
void stopTimer (std::string event, bool print=false)
 Stops the timer. More...
 
void eraseTimer (std::string event)
 Erases the timer of a given event. More...
 
void resetTimer ()
 Resets the timer. More...
 
void resetTimeStep ()
 Resets the time-step timer. More...
 
void allocMemory (std::string event, double bytes)
 Allocates memory for an event given a size. More...
 
void freeMemory (std::string event, double bytes)
 Frees memory allocated for a given event. More...
 
void printTime (std::string event)
 Prints the time spent to achieve a event. More...
 
void printMemory (std::string event)
 Prints the memory allocated for a given event. More...
 
void printAllTime ()
 Prints time spent for each event as well as the total time. More...
 
void writeLegend ()
 Writes the events into a file. More...
 
void writeTime ()
 Writes time spent for each event into a file. More...
 
void writeTimeStep (int n)
 Writes time spent for an iteration into a file. More...
 

Public Attributes

bool printNow
 boolean to print or not the time in the terminal More...
 

Private Member Functions

double get_time ()
 Gets the time of the day. More...
 

Private Attributes

std::ofstream file
 file to write the time spent More...
 
std::ofstream stepFile
 file to write the time spent for 1 step More...
 
std::ofstream legendFile
 file to write the name of the events More...
 
Event tic
 contain the starting time of events More...
 
Event timer
 contain the total time spent of events during the simulation More...
 
Event timeStep
 contain the tiem spent times of events for 1 step More...
 
Event memory
 contain info about the memomry allocated for events More...
 

Detailed Description

Monitors the time spent to achieve a certain task.

Definition at line 33 of file logger.h.

Constructor & Destructor Documentation

Logger::Logger ( )
inline

Constructor.

Definition at line 62 of file logger.h.

Logger::Logger ( std::string  folder)
inline

Constructor overloading. Opens files given the case directory.

Parameters
folderdirectory of the simulation

Definition at line 69 of file logger.h.

Logger::~Logger ( )
inline

Destructor.

Definition at line 80 of file logger.h.

References writeLegend().

Member Function Documentation

void Logger::allocMemory ( std::string  event,
double  bytes 
)
inline

Allocates memory for an event given a size.

Parameters
eventa string that describes the event
bytesthe number of bytes for allocation

Definition at line 146 of file logger.h.

void Logger::eraseTimer ( std::string  event)
inline

Erases the timer of a given event.

Parameters
eventa string that describes the event

Definition at line 117 of file logger.h.

void Logger::freeMemory ( std::string  event,
double  bytes 
)
inline

Frees memory allocated for a given event.

Parameters
eventa string that describes the event
bytesthe number of bytes

Definition at line 157 of file logger.h.

double Logger::get_time ( )
inlineprivate

Gets the time of the day.

Returns
the time of the day (micro-second precision)

Definition at line 49 of file logger.h.

Referenced by startTimer(), and stopTimer().

void Logger::printAllTime ( )
inline

Prints time spent for each event as well as the total time.

Definition at line 185 of file logger.h.

Referenced by io::printTimingInfo().

void Logger::printMemory ( std::string  event)
inline

Prints the memory allocated for a given event.

Parameters
eventa string that describes the event

Definition at line 177 of file logger.h.

void Logger::printTime ( std::string  event)
inline

Prints the time spent to achieve a event.

Parameters
eventa string that describes the event

Definition at line 167 of file logger.h.

void Logger::resetTimer ( )
inline

Resets the timer.

Definition at line 125 of file logger.h.

void Logger::resetTimeStep ( )
inline

Resets the time-step timer.

Definition at line 134 of file logger.h.

void Logger::startTimer ( std::string  event)
inline

Starts the timer.

Parameters
eventa string that describes the event to monitor

Definition at line 92 of file logger.h.

References get_time().

void Logger::stopTimer ( std::string  event,
bool  print = false 
)
inline

Stops the timer.

Parameters
eventa string that describes the event monitored
printboolean to print the time or not in the terminal

Definition at line 103 of file logger.h.

References get_time().

void Logger::writeLegend ( )
inline

Writes the events into a file.

Definition at line 203 of file logger.h.

Referenced by ~Logger().

void Logger::writeTime ( )
inline

Writes time spent for each event into a file.

Definition at line 214 of file logger.h.

void Logger::writeTimeStep ( int  n)
inline

Writes time spent for an iteration into a file.

Parameters
nthe iteration number

Definition at line 225 of file logger.h.

Member Data Documentation

std::ofstream Logger::file
private

file to write the time spent

Definition at line 36 of file logger.h.

std::ofstream Logger::legendFile
private

file to write the name of the events

Definition at line 36 of file logger.h.

Event Logger::memory
private

contain info about the memomry allocated for events

Definition at line 39 of file logger.h.

bool Logger::printNow

boolean to print or not the time in the terminal

Definition at line 57 of file logger.h.

std::ofstream Logger::stepFile
private

file to write the time spent for 1 step

Definition at line 36 of file logger.h.

Event Logger::tic
private

contain the starting time of events

Definition at line 39 of file logger.h.

Event Logger::timer
private

contain the total time spent of events during the simulation

Definition at line 39 of file logger.h.

Event Logger::timeStep
private

contain the tiem spent times of events for 1 step

Definition at line 39 of file logger.h.


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