JASPL  0.2
Just Another Signal Processing Library
debug.h
1 #ifndef DEBUG_H
2 #define DEBUG_H
3 
4 #ifdef DEBUG
5 #define DEBUG_ON 1
6 #else
7 #define DEBUG_ON 0
8 #endif
9 
10 // C System Headers
11 #include <stdio.h>
12 // C++ System headers
13 #include <sstream>
14 #include <string>
15 #include <stdexcept>
16 #include <iostream>
17 // Boost Headers
18 //
19 // Miscellaneous Headers
20 //
21 
22 #define TIME_IT( func, ... ) \
23  do { \
24  auto start = std::chrono::high_resolution_clock::now(); \
25  func \
26  auto end = std::chrono::high_resolution_clock::now();\
27  std::chrono::duration<double, std::milli> ms = end - start;\
28  auto time_taken = ms.count();\
29  std::cout<< "Function took " << time_taken <<" ms." << std::endl;\
30  } while (0)
31 
32 #ifdef DEBUG
33 # define DEBUG_PRINT( x, ... ) std::cout << x __VA_ARGS__ << std::endl;
34 #else
35 # define DEBUG_PRINT(x) do {} while (0)
36 #endif
37 
38 #endif // DEBUG_H