Blowbox 2017
A 3D Game Engine by Riko Ophorst using DirectX 12
memory_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 MemoryStats : public DebugWindow
24  {
25  public:
26  MemoryStats();
27  ~MemoryStats();
28 
30  void RenderMenu() override;
31 
33  void RenderWindow() override;
34 
36  void NewFrame();
37 
38  private:
42 
43  private:
44  bool show_window_;
45 
47  float ram_usage_history_contiguous_[BLOWBOX_PROFILER_HISTORY_MAX_SAMPLE_COUNT];
51  uint64_t ram_average_usage_;
52 
54  float vram_usage_history_contiguous_[BLOWBOX_PROFILER_HISTORY_MAX_SAMPLE_COUNT];
59  };
60 }
float bounds_reset_interval_
The interval at which bounds should be reset.
Definition: memory_stats.h:40
void RenderWindow() override
Renders the actual window for the MemoryStats.
Definition: memory_stats.cc:73
float ram_usage_history_contiguous_[BLOWBOX_PROFILER_HISTORY_MAX_SAMPLE_COUNT]
An array used to contiguously store the RAM usage history.
Definition: memory_stats.h:47
Base class for DebugWindows.
Definition: debug_window.h:8
RingBuffer< uint64_t > vram_usage_history_
A history of how much VRAM was in use.
Definition: memory_stats.h:53
uint64_t ram_usage_history_lower_bound_
The lower bound of the RAM usage (i.e. the fewest RAM that has been in use).
Definition: memory_stats.h:49
Provides an overview of memory statistics.
Definition: memory_stats.h:23
uint64_t ram_usage_history_upper_bound_
The upper bound of the RAM usage (i.e. the most RAM that has been in use).
Definition: memory_stats.h:48
void RenderMenu() override
Renders the menu for the MemoryStats.
Definition: memory_stats.cc:42
uint64_t vram_usage_history_lower_bound_
The lower bound of the VRAM usage (i.e. the fewest VRAM that has been in use).
Definition: memory_stats.h:56
void NewFrame()
Starts a new profiling frame.
Definition: memory_stats.cc:149
bool show_window_
Whether the memory stats window should be shown.
Definition: memory_stats.h:44
eastl::ring_buffer< T > RingBuffer
Typedef for wrapping the EASTL ring_buffer.
Definition: ring_buffer.h:14
float vram_usage_history_contiguous_[BLOWBOX_PROFILER_HISTORY_MAX_SAMPLE_COUNT]
An array used to contiguously store the VRAM usage history.
Definition: memory_stats.h:54
float last_bounds_reset_time_
The last time that bounds got reset in the profiler.
Definition: memory_stats.h:39
uint64_t vram_usage_history_upper_bound_
The upper bound of the VRAM usage (i.e. the most VRAM that has been in use).
Definition: memory_stats.h:55
RingBuffer< uint64_t > ram_usage_history_
A history of how much RAM was in use.
Definition: memory_stats.h:46
uint64_t vram_operating_system_budget_
Stores how much VRAM is still available for allocation on this machine before the application starts ...
Definition: memory_stats.h:57
uint64_t vram_average_usage_
Stores the average amount of VRAM usage based on the current VRAM usage history.
Definition: memory_stats.h:58
uint64_t ram_average_usage_
Stores the average amount of RAM usage based on the current RAM usage history.
Definition: memory_stats.h:51
The main Blowbox namespace.
Definition: image.cc:8
int history_sample_count_
The number of samples that should be kept as history for all history buffers.
Definition: memory_stats.h:41
uint64_t ram_operating_system_budget_
Stores how much RAM is still available for allocation on this machine.
Definition: memory_stats.h:50