Blowbox 2017
A 3D Game Engine by Riko Ophorst using DirectX 12
frame_stats.h
1 #pragma once
2 
3 #include "core/debug/debug_window.h"
4 #include "util/string.h"
5 #include "util/map.h"
6 #include "util/ring_buffer.h"
7 #include "util/utility.h"
8 #include "util/vector.h"
9 #include "renderer/imgui/imgui.h"
10 
11 #define BLOWBOX_PROFILER_HISTORY_MAX_SAMPLE_COUNT 2000
12 #define BLOWBOX_PROFILER_HISTORY_MIN_SAMPLE_COUNT 2
13 
14 namespace blowbox
15 {
16  class GpuResource;
17 
23  class FrameStats : public DebugWindow
24  {
25  public:
26  FrameStats();
27  ~FrameStats();
28 
30  void RenderMenu() override;
31 
33  void RenderWindow() override;
34 
36  void NewFrame();
37 
38  private:
42 
43  private:
44  bool show_window_;
46  float delta_time_history_contiguous_[BLOWBOX_PROFILER_HISTORY_MAX_SAMPLE_COUNT];
50 
51  float fps_history_contiguous_[BLOWBOX_PROFILER_HISTORY_MAX_SAMPLE_COUNT];
52 
54  };
55 }
float last_bounds_reset_time_
The last time that bounds got reset in the profiler.
Definition: frame_stats.h:39
int history_sample_count_
The number of samples that should be kept as history for all history buffers.
Definition: frame_stats.h:41
Base class for DebugWindows.
Definition: debug_window.h:8
RingBuffer< float > delta_time_history_
A history buffer for all delta times.
Definition: frame_stats.h:45
float average_delta_time_
The average delta time of the delta times inside of the current delta_time_history_.
Definition: frame_stats.h:49
Provides an overview of frame statistics.
Definition: frame_stats.h:23
eastl::ring_buffer< T > RingBuffer
Typedef for wrapping the EASTL ring_buffer.
Definition: ring_buffer.h:14
void RenderWindow() override
Renders the actual window for the Profiler.
Definition: frame_stats.cc:73
float fps_history_contiguous_[BLOWBOX_PROFILER_HISTORY_MAX_SAMPLE_COUNT]
Stores FPS values contiguously in memory.
Definition: frame_stats.h:51
float delta_times_upper_bound_
The upper bound of the delta times (i.e. the highest delta time) that exist in the current delta_time...
Definition: frame_stats.h:47
bool show_window_
Whether the frame stats window should be shown.
Definition: frame_stats.h:44
The main Blowbox namespace.
Definition: image.cc:8
float delta_time_history_contiguous_[BLOWBOX_PROFILER_HISTORY_MAX_SAMPLE_COUNT]
Stores the delta times from the delta_time_history_ contiguously in memory.
Definition: frame_stats.h:46
void RenderMenu() override
Renders the menu for the Profiler.
Definition: frame_stats.cc:42
void NewFrame()
Starts a new profiling frame.
Definition: frame_stats.cc:168
float delta_times_lower_bound_
The lower bound of the delta times (i.e. the lowest delta time) that exist in the current delta_time_...
Definition: frame_stats.h:48
float bounds_reset_interval_
The interval at which bounds should be reset.
Definition: frame_stats.h:40
int view_frame_stats_as_fps_
Whether stats in the frame stats window should be shown as delta time or as FPS.
Definition: frame_stats.h:53