Paramotopy
parallel parameter homotopy through bertini
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
timing.hpp
Go to the documentation of this file.
1 #include <mpi.h>
2 
3 #include <sys/wait.h>
4 #include <sys/stat.h>
5 #include <sys/types.h>
6 #include <vector>
7 #include <map>
8 #include <iostream>
9 #include <string>
10 #include <sstream>
11 #include <fstream>
12 #include <iostream>
13 #include <stdio.h>
14 #include <stdlib.h>
15 #include <chrono>
16 
17 #define BOOST_FILESYSTEM_VERSION 3
18 #define BOOST_FILESYSTEM_NO_DEPRECATED
19 
20 #include <boost/filesystem.hpp>
21 #include <boost/filesystem/operations.hpp>
22 #include <boost/filesystem/path.hpp>
23 #include <boost/progress.hpp>
24 #include <boost/regex.hpp>
25 
26 #ifndef __TIMING_H__
27 #define __TIMING_H__
28 
29 
30 
31 
36 class timer_data{
37 
38 
39 public:
40 
41 
42 
44  std::chrono::high_resolution_clock::time_point t1;
45 
47  std::chrono::milliseconds elapsed_time;
48 
51 
52 
53 
56  num_calls_timed = 0;
57  elapsed_time = std::chrono::milliseconds(0);
58  }
59 
60 
61 };
62 
63 
64 
65 
71 class timer{
72 
73 public:
74 
75 
76  //data members
77 
78 
80  timer(){
81 
82  timer::press_start("total");
83 
84  };
85 
86 
87 
88 
93  void press_start(const std::string timer_name);
94 
100  void add_time(const std::string timer_name);
101 
108  void add_time(const std::string timer_name, const int num_incrementations);
109 
115  bool write_timing_data(const boost::filesystem::path folder_to_write_to, const int myid);
116 
117 
118 private:
119 
120 
121  //data members
122 
124  std::map< std::string, timer_data > active_timers;
125 
126 
127  //functions
128 
133  bool create_timer(const std::string timer_name);
134 
135 
136 };
137 
138 
139 
140 // double start_time;
141 // double t1;
142 
143 
144 
145 
146 
147 #endif
148 
std::map< std::string, timer_data > active_timers
Definition: timing.hpp:124
timer_data()
Definition: timing.hpp:55
std::chrono::milliseconds elapsed_time
Definition: timing.hpp:47
timer()
Definition: timing.hpp:80
bool create_timer(const std::string timer_name)
Definition: timing.cpp:41
int num_calls_timed
Definition: timing.hpp:50
std::chrono::high_resolution_clock::time_point t1
Definition: timing.hpp:44
void add_time(const std::string timer_name)
Definition: timing.cpp:12
Small class, with no methods, for holding timing data.
Definition: timing.hpp:36
bool write_timing_data(const boost::filesystem::path folder_to_write_to, const int myid)
Definition: timing.cpp:57
void press_start(const std::string timer_name)
Definition: timing.cpp:5
Capable of timing arbitrary categories of processes, using a map of timer_data's. ...
Definition: timing.hpp:71