Blowbox 2017
A 3D Game Engine by Riko Ophorst using DirectX 12
Classes | Public Member Functions | Protected Member Functions | Private Attributes | List of all members
blowbox::PerformanceProfiler Class Reference

#include <performance_profiler.h>

Classes

struct  CompareProfilerBlockSingleFrame
 
class  ProfilerBlock
 
struct  ProfilerBlockData
 
struct  ProfilerBlockFrameData
 
struct  ProfilerBlockTime
 

Public Member Functions

void RenderMenu () override
 
void RenderWindow () override
 
void NewFrame ()
 
void CatchNextFrame ()
 

Protected Member Functions

void AddProfilerBlock (ProfilerBlock &profiler_block)
 
String ConvertBlockTypeToString (ProfilerBlockType type)
 

Private Attributes

float last_bounds_reset_time_
 
float bounds_reset_interval_
 
int history_sample_count_
 
bool show_window_
 
bool catch_frame_
 
bool catch_next_frame_
 
Vector< ProfilerBlockcollected_profiler_blocks_single_frame_
 
Map< String, ProfilerBlockFrameDatacondensed_profiler_block_times_
 
Vector< ProfilerBlockFrameDataprofiler_blocks_single_frame_
 
Map< String, ProfilerBlockDataprofiler_blocks_ [ProfilerBlockType_COUNT]
 
float contiguous_block_times [BLOWBOX_PROFILER_HISTORY_MAX_SAMPLE_COUNT]
 
ImGuiTextFilter profiler_block_filters_ [ProfilerBlockType_COUNT]
 

Detailed Description

The main profiler in Blowbox.

This class is here in Blowbox to let you profile your code. You can start profiling a new block of code by calling stack-allocating a PerformanceProfiler::ProfilerBlock. Once the ProfilerBlock has expired, it automatically notifies the main Profiler. See the PerformanceProfiler::ProfilerBlock for a more detailed explanation.

Inheritance diagram for blowbox::PerformanceProfiler:
blowbox::DebugWindow

Member Function Documentation

void blowbox::PerformanceProfiler::AddProfilerBlock ( ProfilerBlock profiler_block)
protected

Adds a PerformanceProfiler::ProfilerBlock to the profiler. The profiler will automatically figure out how to handle it.

Parameters
[in]profiler_blockThe block that needs to be added.
void blowbox::PerformanceProfiler::CatchNextFrame ( )

Makes the profiler collect the next frame's data.

String blowbox::PerformanceProfiler::ConvertBlockTypeToString ( ProfilerBlockType  type)
protected

Converts a ProfilerBlockType to a String.

Parameters
[in]typeThe type that should be converted.
void blowbox::PerformanceProfiler::NewFrame ( )

Starts a new profiling frame.

void blowbox::PerformanceProfiler::RenderMenu ( )
overridevirtual

Renders the menu for the Profiler.

Implements blowbox::DebugWindow.

void blowbox::PerformanceProfiler::RenderWindow ( )
overridevirtual

Renders the actual window for the Profiler.

Implements blowbox::DebugWindow.

Member Data Documentation

float blowbox::PerformanceProfiler::bounds_reset_interval_
private

The interval at which bounds should be reset.

bool blowbox::PerformanceProfiler::catch_frame_
private

Whether all ProfilerBlocks in the current frames are being caught for frame analysis.

bool blowbox::PerformanceProfiler::catch_next_frame_
private

Whether the next frame should be made ready for data collection.

Vector<ProfilerBlock> blowbox::PerformanceProfiler::collected_profiler_blocks_single_frame_
private

All PerformanceProfiler::ProfilerBlocks that are collected when catch_frame_ is on, are stored in this array.

Map<String, ProfilerBlockFrameData> blowbox::PerformanceProfiler::condensed_profiler_block_times_
private

This map helps in removing duplicates from the collected_profiler_blocks_single_frame_ array.

float blowbox::PerformanceProfiler::contiguous_block_times[BLOWBOX_PROFILER_HISTORY_MAX_SAMPLE_COUNT]
private

An array that gets re-used for every type of block time that needs to be stored contiguously (requirement for ImGui::PlotHistogram())

int blowbox::PerformanceProfiler::history_sample_count_
private

The number of samples that should be kept as history for all history buffers.

float blowbox::PerformanceProfiler::last_bounds_reset_time_
private

The last time that bounds got reset in the profiler.

ImGuiTextFilter blowbox::PerformanceProfiler::profiler_block_filters_[ProfilerBlockType_COUNT]
private

An array of text filters for filtering out profiler blocks from the individual ProfilerBlock views.

Map<String, ProfilerBlockData> blowbox::PerformanceProfiler::profiler_blocks_[ProfilerBlockType_COUNT]
private

This is an array of maps that's used to categorize all the different PerformanceProfiler::ProfilerBlocks by storing their data in a map.

Vector<ProfilerBlockFrameData> blowbox::PerformanceProfiler::profiler_blocks_single_frame_
private

An array of ProfilerBlockFrameData's that spans an entire frame.

bool blowbox::PerformanceProfiler::show_window_
private

Whether the profiler window should be shown.


The documentation for this class was generated from the following files: