mantaflow  0.10
A framework for fluid simulation
timing.h
Go to the documentation of this file.
1 
2 /******************************************************************************
3  *
4  * MantaFlow fluid solver framework
5  * Copyright 2011 Tobias Pfaff, Nils Thuerey
6  *
7  * This program is free software, distributed under the terms of the
8  * GNU General Public License (GPL)
9  * http://www.gnu.org/licenses
10  *
11  * Plugin timing
12  *
13  ******************************************************************************/
14 
15 #ifndef _TIMING_H
16 #define _TIMING_H
17 
18 #include "manta.h"
19 #include <map>
20 namespace Manta {
21 
22 
23 class TimingData {
24 private:
25  TimingData();
26 public:
27  static TimingData& instance() { static TimingData a; return a; }
28 
29  void print();
30  void saveMean(const std::string& filename);
31  void start(FluidSolver* parent, const std::string& name);
32  void stop(FluidSolver* parent, const std::string& name);
33 protected:
34  void step();
35  struct TimingSet {
36  TimingSet() : num(0),updated(false) { cur.clear(); total.clear(); }
37  MuTime cur, total;
38  int num;
39  bool updated;
40  std::string solver;
41  };
42  bool updated;
43 
44  int num;
45  MuTime mPluginTimer;
46  std::string mLastPlugin;
47  std::map<std::string, std::vector<TimingSet> > mData;
48 };
49 
50 // Python interface
52 PYTHON class Timings : public PbClass {
53 public:
54  PYTHON() Timings() : PbClass(0) {}
55 
56  PYTHON() void display() { TimingData::instance().print(); }
57  PYTHON() void saveMean(std::string file) { TimingData::instance().saveMean(file); }
58 };
59 
60 }
61 
62 #endif
63 
64 
Definition: commonkernels.h:22
Definition: timing.h:35
Definition: timing.h:23
Timing class for preformance measuring.
Definition: general.h:109
Definition: timing.h:52
Definition: fluidsolver.h:28