rasdaman client API  10.6.3
The Array Analytics Engine: Datacubes at Your Fingertips
rmdebug.hh
Go to the documentation of this file.
1 /*
2  * This file is part of rasdaman community.
3  *
4  * Rasdaman community is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * Rasdaman community is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public License
15  * along with rasdaman community. If not, see <http://www.gnu.org/licenses/>.
16  *
17  * Copyright 2003 - 2010 Peter Baumann / rasdaman GmbH.
18  *
19  * For more information please see <http://www.rasdaman.org>
20  * or contact Peter Baumann via <baumann@rasdaman.com>.
21 */
22 
23 #ifndef RMDEBUG_HH
24 #define RMDEBUG_HH
25 
26 #include <sys/time.h>
27 
28 // generate benchmark code only when RMANBENCHMARK is set
29 #ifdef RMANBENCHMARK
30 #define RMTIMER(class, func) RMTimer localRMTimer = RMTimer(class, func);
31 #else
32 #define RMTIMER(class, func)
33 #endif
34 
36 
67 class RMTimer
68 {
69 public:
71  RMTimer(const char *newClass, const char *newFunc,
72  int newBmLevel = 4);
78  ~RMTimer();
81  void setOutput(int newOutput);
86  void pause();
89  void resume();
91  void start();
95  void stop();
101  int getTime();
103 
104 private:
106  const char *myClass;
108  const char *myFunc;
110  int output;
112  int bmLevel;
113  // reference parameter for gettimeofday().
114  timeval acttime;
116  long accuTime;
118  unsigned short running;
120  long oldsec;
122  long oldusec;
124  void fetchTime();
125 };
127 
128 #endif
RMTimer::resume
void resume()
resumes timer.
RMTimer::RMTimer
RMTimer(const char *newClass, const char *newFunc, int newBmLevel=4)
constructor, initializes members and starts timer.
RMTimer::setOutput
void setOutput(int newOutput)
switch output on RMInit::bmOut on and off.
RMTimer::pause
void pause()
If newOutoutput is FALSE no output is created on RMInit::bmOut on the following calls to stop() and ~...
RMTimer::start
void start()
resets timer.
RMTimer::getTime
int getTime()
Time spent is the time since construction or last start() excluding the times between pause() and res...
RMTimer
Module: raslib.
Definition: rmdebug.hh:67
RMTimer::~RMTimer
~RMTimer()
The parameters newClass and newFunc have to be string literals.
RMTimer::stop
void stop()
Also switches output to RMInit::bmOut on again.