Blender  V2.93
TimeUtils.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  */
16 
17 #pragma once
18 
24 #include <time.h>
25 
26 #ifdef WITH_CXX_GUARDEDALLOC
27 # include "MEM_guardedalloc.h"
28 #endif
29 
30 namespace Freestyle {
31 
32 class Chronometer {
33  public:
34  inline Chronometer()
35  {
36  }
37  inline ~Chronometer()
38  {
39  }
40 
41  inline clock_t start()
42  {
43  _start = clock();
44  return _start;
45  }
46 
47  inline double stop()
48  {
49  clock_t stop = clock();
50  return (double)(stop - _start) / CLOCKS_PER_SEC;
51  }
52 
53  private:
54  clock_t _start;
55 
56 #ifdef WITH_CXX_GUARDEDALLOC
57  MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:Chronometer")
58 #endif
59 };
60 
61 } /* namespace Freestyle */
Read Guarded memory(de)allocation.
inherits from class Rep
Definition: AppCanvas.cpp:32