TurtleBrains  0.3.5
High quality, portable, C++ framework for rapid 2D game development.
tb_performance_timer.hpp
1 
9 #ifndef TurtleBrains_PerformanceTimer_hpp
10 #define TurtleBrains_PerformanceTimer_hpp
11 
12 #include <turtle_brains/core/tb_configuration.hpp>
13 #if defined(tb_with_development_kit)
14 
15 #include <turtle_brains/core/tb_string.hpp>
16 
17 #include <chrono>
18 
19 namespace TurtleBrains
20 {
21  namespace Development //requires Core and System
22  {
23  void BeginPerformanceTracking(const tbCore::tbString& sessionName, const tbCore::tbString& filepath = "timing.json");
24  void EndPerformanceTracking();
25 
26 
30  class ScopedTimer
31  {
32  public:
36  explicit ScopedTimer(const tbCore::tbString& timerName);
37 
41  ~ScopedTimer(void);
42 
43 
44  private:
45  const tbCore::tbString mTimerName;
46  std::chrono::steady_clock::time_point mStartTime;
47  };
48 
49  }; /* namespace Development */
50 }; /* namespace TurtleBrains */
51 
52 namespace tbDevelopment = TurtleBrains::Development;
53 
54 #define tb_make_unique_name_helper_0(name, line) name##line
55 #define tb_make_unique_name_helper(name, line) tb_make_unique_name_helper_0(name, line)
56 #define tb_make_unique_name(name) tb_make_unique_name_helper(name, __LINE__)
57 
58 #define tb_scoped_timer(name) TurtleBrains::Development::ScopedTimer tb_make_unique_name(tbPerfTimer)(name);
59 #define tb_function_timer() TurtleBrains::Development::ScopedTimer tb_make_unique_name(tbPerfTimer)(__FUNCTION__);
60 
61 #else /* tb_without_development_kit */
62 
63 #define tb_scoped_timer(name) ;
64 #define tb_function_timer() ;
65 
66 #endif /* tb_with_development_kit */
67 
68 
69 #endif /* TurtleBrains_PerformanceTimer_hpp */
Contains some functionality to aid in easier / faster game development or other profiling tools...
Here is some information about the primary namespace.
Definition: tb_application_dialog.hpp:21
std::string tbString
Definition: tb_string.hpp:335