1 /** @file
2  *****************************************************************************
3 
4  Declaration of functions for profiling code blocks.
5 
6  Reports time, operation counts, memory usage, and others.
7 
8  *****************************************************************************
9  * @author     This file is part of libff, developed by SCIPR Lab
10  *             and contributors (see AUTHORS).
11  * @copyright  MIT license (see LICENSE file)
12  *****************************************************************************/
13 
14 #ifndef PROFILING_HPP_
15 #define PROFILING_HPP_
16 
17 #include <cstddef>
18 #include <map>
19 #include <string>
20 #include <vector>
21 
22 namespace libff {
23 
24 void start_profiling();
25 long long get_nsec_time();
26 void print_time(const char* msg);
27 void print_header(const char* msg);
28 
29 void print_indent();
30 
31 extern bool inhibit_profiling_info;
32 extern bool inhibit_profiling_counters;
33 extern std::map<std::string, size_t> invocation_counts;
34 extern std::map<std::string, long long> last_times;
35 extern std::map<std::string, long long> cumulative_times;
36 
37 void clear_profiling_counters();
38 
39 void print_cumulative_time_entry(const std::string &key, const long long factor=1);
40 void print_cumulative_times(const long long factor=1);
41 void print_cumulative_op_counts(const bool only_fq=false);
42 
43 void enter_block(const std::string &msg, const bool indent=true);
44 void leave_block(const std::string &msg, const bool indent=true);
45 
46 void print_mem(const std::string &s = "");
47 void print_compilation_info();
48 
49 } // libff
50 
51 #endif // PROFILING_HPP_
52