Ion
|
GPUPerformanceTester measures basic GPU rendering characteristics. More...
#include "gpuperformance.h"
Classes | |
struct | Measurement |
Public Member Functions | |
GpuPerformanceTester (uint32 width, uint32 height) | |
Width and height should be the OpenGL render window dimensions. More... | |
virtual | ~GpuPerformanceTester () |
void | SetEnables (Enables enables) |
Enable only modes indicated by enables bitmask (effectively clearing the bitmask and setting the indicated enable bits). More... | |
Enables | GetEnables () const |
bool | AreModesEnabled (Enables enables) const |
Returns true if all of the specified modes are currently enabled. More... | |
virtual const Benchmark | RunAllMeasurements (const gfx::NodePtr &scene, const gfx::GraphicsManagerPtr &graphics_manager, const gfx::RendererPtr &renderer) |
Runs full set of basic measurements, returns Benchmark immediately. More... | |
virtual void | AccumulateMeasurements (const gfx::NodePtr &scene, const gfx::GraphicsManagerPtr &graphics_manager, const gfx::RendererPtr &renderer) |
Keeps running totals for the full set of basic measurements for all scene nodes passed to it until GetResults() is called. More... | |
virtual const Benchmark | GetResults () |
Finalizes accumulated measurements, returns benchmark data, and resets accumulation totals. More... | |
int | GetTrialCount () const |
Returns/sets the number of trials used to measure performance. More... | |
void | SetTrialCount (int number_of_trials) |
Static Public Attributes | |
static const double | kInvalidValue |
This is used for values that with no meaning & should not be printed. More... | |
Protected Member Functions | |
virtual Measurement | MeasurePerformance (const gfx::NodePtr &scene, const gfx::GraphicsManagerPtr &graphics_manager, const gfx::RendererPtr &renderer) |
Returns the average (avg) time and standard deviation (stddev) for rendering a scene some number of trials. More... | |
virtual Measurement | MeasureBaseline (const gfx::NodePtr &scene, const gfx::GraphicsManagerPtr &graphics_manager, const gfx::RendererPtr &renderer) |
Returns the avg and stddev time to render unmodified scene. More... | |
virtual Measurement | MeasureMinViewportSpeed (const gfx::NodePtr &scene, const gfx::GraphicsManagerPtr &graphics_manager, const gfx::RendererPtr &renderer) |
Returns the avg and stddev time to render scene with a minimal viewport, i.e. More... | |
virtual Measurement | MeasureStateChanges (const gfx::NodePtr &scene, const gfx::GraphicsManagerPtr &graphics_manager, const gfx::RendererPtr &renderer) |
Measures performance of state changes, i.e. More... | |
virtual Measurement | MeasureResourceCreation (const gfx::NodePtr &scene, const gfx::GraphicsManagerPtr &graphics_manager) |
Measures render performance WITH resource creation time by creating a new Renderer. More... | |
FRIEND_TEST (GPUPerformanceTest, InstanceCopy) | |
Allow test to access private function. More... | |
Static Protected Member Functions | |
static gfx::NodePtr | InstanceCopy (const gfx::NodePtr &scene) |
Copy scene in preparation for modifying the nodes for various measurements. More... | |
Protected Attributes | |
uint32 | number_of_trials_ |
uint32 | width_ |
uint32 | height_ |
Enables | enables_ |
Enable and disable measurement phases. More... | |
Benchmark | benchmark_ |
The finalized benchmark data. More... | |
int | num_nodes_ |
Benchmark data in progress. More... | |
int | num_shapes_ |
int | num_draws_ |
int | num_vertices_ |
int | num_triangles_ |
int | num_lines_ |
int | num_points_ |
size_t | num_bind_shader_ |
size_t | num_bind_texture_ |
size_t | num_set_uniform_ |
size_t | buffer_memory_ |
size_t | fbo_memory_ |
size_t | texture_memory_ |
size_t | framebuffer_memory_ |
Benchmark::AccumulatedVariable | baseline_ |
Benchmark::AccumulatedVariable | baseline_inverse_ |
Benchmark::AccumulatedVariable | resource_ |
Benchmark::AccumulatedVariable | no_draw_calls_ |
Benchmark::AccumulatedVariable | min_viewport_ |
Benchmark::AccumulatedVariable | min_viewport_inverse_ |
GPUPerformanceTester measures basic GPU rendering characteristics.
The member function RunAllMeasurements measures the following performance timings: A) Average render time for the unmodified scene B) Average render time with viewport set to 1 pixel (minviewport) C) Average render time with draw calls ignored (traversal & state change) D) Render time including resource creation; uses a new ion::gfx::Renderer
From these measurements and their standard deviations the following quantities are reported:
Definition at line 74 of file gpuperformance.h.
Named indices for each entries in the Benchmark returned by RunAllMeasurements() and GetResults().
These names (minus 'k', plus spaces between words) should correspond to the id string in the Constant/Variable descriptor. Example: (enum) kPrimitiveCount -> (token) Primitive Count.
Definition at line 135 of file gpuperformance.h.
Enable/disable five modes of GPU performance measurement:
Enumerator | |
---|---|
kNoEnables | |
kConstants | |
kBaseline | |
kNoDraw | |
kMinimumViewport | |
kResource | |
kGpuMemory | |
kGlTrace | |
kAllEnables |
Definition at line 97 of file gpuperformance.h.
Definition at line 162 of file gpuperformance.h.
ion::analytics::GpuPerformanceTester::GpuPerformanceTester | ( | uint32 | width, |
uint32 | height | ||
) |
Width and height should be the OpenGL render window dimensions.
Definition at line 499 of file gpuperformance.cc.
|
virtual |
Definition at line 529 of file gpuperformance.cc.
|
virtual |
Keeps running totals for the full set of basic measurements for all scene nodes passed to it until GetResults() is called.
Definition at line 531 of file gpuperformance.cc.
References AreModesEnabled(), baseline_, baseline_inverse_, buffer_memory_, fbo_memory_, framebuffer_memory_, GL_ALPHA_BITS, GL_BLUE_BITS, GL_DEPTH_BITS, GL_GREEN_BITS, GL_RED_BITS, GL_STENCIL_BITS, height_, kBaseline, kConstants, kGlTrace, kGpuMemory, kMinimumViewport, kNoDraw, kResource, MeasureBaseline(), MeasureMinViewportSpeed(), MeasureResourceCreation(), MeasureStateChanges(), min_viewport_, min_viewport_inverse_, no_draw_calls_, num_bind_shader_, num_bind_texture_, num_draws_, num_lines_, num_nodes_, num_points_, num_set_uniform_, num_shapes_, num_triangles_, num_vertices_, resource_, texture_memory_, and width_.
Referenced by RunAllMeasurements().
Returns true if all of the specified modes are currently enabled.
Definition at line 193 of file gpuperformance.h.
Referenced by AccumulateMeasurements(), and GetResults().
|
protected |
Allow test to access private function.
|
inline |
Definition at line 191 of file gpuperformance.h.
|
virtual |
Finalizes accumulated measurements, returns benchmark data, and resets accumulation totals.
Definition at line 639 of file gpuperformance.cc.
References ion::analytics::Benchmark::AddAccumulatedVariable(), ion::analytics::Benchmark::AddConstant(), AreModesEnabled(), baseline_, baseline_inverse_, buffer_memory_, fbo_memory_, framebuffer_memory_, GetTrialCount(), height_, kConstants, ion::analytics::Benchmark::AccumulatedVariable::maximum, ion::analytics::Benchmark::AccumulatedVariable::mean, min_viewport_, min_viewport_inverse_, ion::analytics::Benchmark::AccumulatedVariable::minimum, no_draw_calls_, num_bind_shader_, num_bind_texture_, num_draws_, num_lines_, num_nodes_, num_points_, num_set_uniform_, num_shapes_, num_triangles_, num_vertices_, resource_, ion::analytics::Benchmark::AccumulatedVariable::standard_deviation, texture_memory_, and width_.
Referenced by RunAllMeasurements().
|
inline |
Returns/sets the number of trials used to measure performance.
Definition at line 215 of file gpuperformance.h.
Referenced by GetResults().
|
staticprotected |
Copy scene in preparation for modifying the nodes for various measurements.
InstanceCopy creates a copy of a scene graph with shared geometry, copied state table, and copied uniforms.
Definition at line 462 of file gpuperformance.cc.
References DCHECK.
Referenced by MeasureBaseline(), MeasureMinViewportSpeed(), and MeasureStateChanges().
|
protectedvirtual |
Returns the avg and stddev time to render unmodified scene.
Definition at line 1016 of file gpuperformance.cc.
References baseline_, baseline_inverse_, DCHECK, height_, InstanceCopy(), MeasurePerformance(), and width_.
Referenced by AccumulateMeasurements().
|
protectedvirtual |
Returns the avg and stddev time to render scene with a minimal viewport, i.e.
render time no fill, just measure traversal and transform/vertex-program performance.
Definition at line 1031 of file gpuperformance.cc.
References DCHECK, InstanceCopy(), MeasurePerformance(), min_viewport_, and min_viewport_inverse_.
Referenced by AccumulateMeasurements().
|
protectedvirtual |
Returns the average (avg) time and standard deviation (stddev) for rendering a scene some number of trials.
Definition at line 1064 of file gpuperformance.cc.
References DCHECK, DCHECK_GE, ion::port::Timer::GetInS(), height_, number_of_trials_, and width_.
Referenced by MeasureBaseline(), MeasureMinViewportSpeed(), and MeasureStateChanges().
|
protectedvirtual |
Measures render performance WITH resource creation time by creating a new Renderer.
This should force the reallocation and update of all OpenGL resources (attribute buffers, shaders, textures, etc...)
Definition at line 1123 of file gpuperformance.cc.
References ion::port::Timer::GetInS(), height_, ion::port::Timer::Reset(), resource_, and width_.
Referenced by AccumulateMeasurements().
|
protectedvirtual |
Measures performance of state changes, i.e.
traverse scene without actually rendering any geometry.
Definition at line 1051 of file gpuperformance.cc.
References DCHECK, InstanceCopy(), MeasurePerformance(), and no_draw_calls_.
Referenced by AccumulateMeasurements().
|
virtual |
Runs full set of basic measurements, returns Benchmark immediately.
Definition at line 1008 of file gpuperformance.cc.
References AccumulateMeasurements(), and GetResults().
|
inline |
Enable only modes indicated by enables bitmask (effectively clearing the bitmask and setting the indicated enable bits).
Enable(kNoEnables) disables all. Enable(kConstants | kBaseline) enables first two modes. By default, all phases are enabled.
Definition at line 306 of file gpuperformance.h.
References enables_, kGpuMemory, kResource, LOG, and ion::port::WARNING.
|
inline |
Definition at line 216 of file gpuperformance.h.
|
protected |
Definition at line 288 of file gpuperformance.h.
Referenced by AccumulateMeasurements(), GetResults(), and MeasureBaseline().
|
protected |
Definition at line 289 of file gpuperformance.h.
Referenced by AccumulateMeasurements(), GetResults(), and MeasureBaseline().
|
protected |
The finalized benchmark data.
Definition at line 271 of file gpuperformance.h.
|
protected |
Definition at line 284 of file gpuperformance.h.
Referenced by AccumulateMeasurements(), and GetResults().
|
protected |
Enable and disable measurement phases.
Definition at line 268 of file gpuperformance.h.
Referenced by SetEnables().
|
protected |
Definition at line 285 of file gpuperformance.h.
Referenced by AccumulateMeasurements(), and GetResults().
|
protected |
Definition at line 287 of file gpuperformance.h.
Referenced by AccumulateMeasurements(), and GetResults().
|
protected |
Definition at line 265 of file gpuperformance.h.
Referenced by AccumulateMeasurements(), GetResults(), MeasureBaseline(), MeasurePerformance(), and MeasureResourceCreation().
|
static |
This is used for values that with no meaning & should not be printed.
For example, when there is no standard deviation for a value and/or the min and max values are the same as the value itself.
Definition at line 79 of file gpuperformance.h.
|
protected |
Definition at line 292 of file gpuperformance.h.
Referenced by AccumulateMeasurements(), GetResults(), and MeasureMinViewportSpeed().
|
protected |
Definition at line 293 of file gpuperformance.h.
Referenced by AccumulateMeasurements(), GetResults(), and MeasureMinViewportSpeed().
|
protected |
Definition at line 291 of file gpuperformance.h.
Referenced by AccumulateMeasurements(), GetResults(), and MeasureStateChanges().
|
protected |
Definition at line 281 of file gpuperformance.h.
Referenced by AccumulateMeasurements(), and GetResults().
|
protected |
Definition at line 282 of file gpuperformance.h.
Referenced by AccumulateMeasurements(), and GetResults().
|
protected |
Definition at line 276 of file gpuperformance.h.
Referenced by AccumulateMeasurements(), and GetResults().
|
protected |
Definition at line 279 of file gpuperformance.h.
Referenced by AccumulateMeasurements(), and GetResults().
|
protected |
Benchmark data in progress.
Definition at line 274 of file gpuperformance.h.
Referenced by AccumulateMeasurements(), and GetResults().
|
protected |
Definition at line 280 of file gpuperformance.h.
Referenced by AccumulateMeasurements(), and GetResults().
|
protected |
Definition at line 283 of file gpuperformance.h.
Referenced by AccumulateMeasurements(), and GetResults().
|
protected |
Definition at line 275 of file gpuperformance.h.
Referenced by AccumulateMeasurements(), and GetResults().
|
protected |
Definition at line 278 of file gpuperformance.h.
Referenced by AccumulateMeasurements(), and GetResults().
|
protected |
Definition at line 277 of file gpuperformance.h.
Referenced by AccumulateMeasurements(), and GetResults().
|
protected |
Definition at line 263 of file gpuperformance.h.
Referenced by MeasurePerformance().
|
protected |
Definition at line 290 of file gpuperformance.h.
Referenced by AccumulateMeasurements(), GetResults(), and MeasureResourceCreation().
|
protected |
Definition at line 286 of file gpuperformance.h.
Referenced by AccumulateMeasurements(), and GetResults().
|
protected |
Definition at line 264 of file gpuperformance.h.
Referenced by AccumulateMeasurements(), GetResults(), MeasureBaseline(), MeasurePerformance(), and MeasureResourceCreation().