Cadabra
Computer algebra system for field theory problems
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
ProgressMonitor.hh
Go to the documentation of this file.
1 
2 #pragma once
3 
4 #include <string>
5 #include <chrono>
6 #include <stack>
7 #include <map>
8 #include <vector>
9 
11  public:
13  virtual ~ProgressMonitor();
14 
15  virtual void group(std::string name="");
16  virtual void progress(int n, int total);
17 
18  void print() const;
19 
20  class Total {
21  public:
22  Total();
23 
24  std::string name;
25  size_t call_count;
26  std::chrono::milliseconds time_spent;
28 
29  long time_spent_as_long() const;
30 
31  bool operator==(const Total& other) const;
32 
33  std::string str() const;
34  };
35 
36  std::vector<Total> totals() const;
37 
38  private:
39  class Block {
40  public:
41  Block();
42 
43  std::string name;
44  std::chrono::milliseconds started;
46  };
47 
48  std::stack<Block> call_stack;
49  std::map<std::string, Total> call_totals;
50 };
51 
52 
ProgressMonitor()
Definition: ProgressMonitor.cc:6
Block()
Definition: ProgressMonitor.cc:14
virtual void progress(int n, int total)
Definition: ProgressMonitor.cc:67
std::string str() const
Definition: ProgressMonitor.cc:25
Definition: ProgressMonitor.hh:10
long time_spent_as_long() const
Definition: ProgressMonitor.cc:73
std::stack< Block > call_stack
Definition: ProgressMonitor.hh:48
void print() const
Definition: ProgressMonitor.cc:78
std::vector< Total > totals() const
Definition: ProgressMonitor.cc:89
virtual ~ProgressMonitor()
Definition: ProgressMonitor.cc:10
virtual void group(std::string name="")
Definition: ProgressMonitor.cc:33
size_t call_count
Definition: ProgressMonitor.hh:25
Definition: ProgressMonitor.hh:20
Definition: ProgressMonitor.hh:39
std::chrono::milliseconds started
Definition: ProgressMonitor.hh:44
int total_steps
Definition: ProgressMonitor.hh:45
bool operator==(const Total &other) const
Definition: ProgressMonitor.cc:98
std::string name
Definition: ProgressMonitor.hh:24
int total_steps
Definition: ProgressMonitor.hh:27
std::string name
Definition: ProgressMonitor.hh:43
std::map< std::string, Total > call_totals
Definition: ProgressMonitor.hh:49
Total()
Definition: ProgressMonitor.cc:20
int step
Definition: ProgressMonitor.hh:45
std::chrono::milliseconds time_spent
Definition: ProgressMonitor.hh:26