Timer.h
Go to the documentation of this file.
/* Frobby: Software for monomial ideal computations.
Copyright (C) 2007 Bjarke Hammersholt Roune (www.broune.com)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see http://www.gnu.org/licenses/.
*/
#ifndef TIMER_GUARD
#define TIMER_GUARD
#include <ctime>
class Timer {
public:
Timer() {reset();}
void reset() {_clocksAtReset = clock();}
unsigned long getMilliseconds() const;
void print(FILE* out) const;
private:
std::clock_t _clocksAtReset;
};
#endif
Timer::print
void print(FILE *out) const
Prints the elapsed time in a human readable format.
Definition Timer.cpp:29
Timer::Timer
Timer()
Definition Timer.h:29
Timer::reset
void reset()
Resets the amount of elapsed CPU time to zero.
Definition Timer.h:32
Timer::getMilliseconds
unsigned long getMilliseconds() const
Returns the number of CPU milliseconds since the last reset.
Definition Timer.cpp:20
Timer::_clocksAtReset
std::clock_t _clocksAtReset
Definition Timer.h:43