Ion
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ion::analytics::GpuPerformanceTester Class Reference

GPUPerformanceTester measures basic GPU rendering characteristics. More...

#include "gpuperformance.h"

Collaboration diagram for ion::analytics::GpuPerformanceTester:

Classes

struct  Measurement
 

Public Types

enum  Enables {
  kNoEnables = 0x00,
  kConstants = 0x01,
  kBaseline = 0x02,
  kNoDraw = 0x04,
  kMinimumViewport = 0x08,
  kResource = 0x10,
  kGpuMemory = 0x20,
  kGlTrace = 0x40,
  kAllEnables = 0x7F
}
 Enable/disable five modes of GPU performance measurement: More...
 
enum  ConstantIndices {
  kNodeCount,
  kShapeCount,
  kDrawCount,
  kVertexCount,
  kPrimitiveCount,
  kTriangleCount,
  kLineCount,
  kPointCount,
  kTrianglePercent,
  kLinePercent,
  kPointPercent,
  kVerticesPerShape,
  kPrimitivesPerShape,
  kTrialCount,
  kBindShaderCount,
  kBindTextureCount,
  kSetUniformCount,
  kBufferMemory,
  kFboMemory,
  kTextureMemory,
  kFrameBufferMemory,
  kTotalGpuMemory
}
 Named indices for each entries in the Benchmark returned by RunAllMeasurements() and GetResults(). More...
 
enum  VariableIndices {
  kFramesPerSecond,
  kNodesPerSecond,
  kShapesPerSecond,
  kDrawCallsPerSecond,
  kVerticesPerSecond,
  kPrimitivesPerSecond,
  kPixelsPerSecond,
  kRenderTime,
  kResourceCreation,
  kNoDrawCalls,
  kMinViewport,
  kTransformRate,
  kFillRate,
  kTraversalPercent,
  kTransformPercent,
  kFillPercent
}
 

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_
 

Detailed Description

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:

  • Scene constants — Nodes — Shapes — Draw calls — Vertices — Primitives — Triangles — Lines — Points — Triangle percent (triangles/primitives) — Line percent (lines/primitives) — Point percent (points/primitives) — Vertices/shape — Primitives/shape
  • Number of trials used to compute averages
  • Frames per second: 1 / A
  • Millions of triangles per second for unmodified scene: #triangles / A
  • Millions of pixels per second for umodified scene: #pixels / A
  • Average render time for unmodified scene (A)
  • Resource creation time (D - A)
  • Average render time with draw calls ignored (C)
  • Average render time with minviewport (B)
  • Fill rate: #pixels / (A - B)
  • Transform rate: #triangles / B
  • % of render time spent in traversal and state change: C / A * 100
  • % of render time spent transforming geometry: B / A * 100
  • % of render time spent on fill: (A - B) / A * 100

Definition at line 74 of file gpuperformance.h.

Member Enumeration Documentation

Named indices for each entries in the Benchmark returned by RunAllMeasurements() and GetResults().

Todo:
(user): Reorganize ConstantIndices and VariableIndices enums alphabetically for improved readability. Requires additional changes to Benchmark interface

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.

Enumerator
kNodeCount 
kShapeCount 
kDrawCount 
kVertexCount 
kPrimitiveCount 
kTriangleCount 
kLineCount 
kPointCount 
kTrianglePercent 
kLinePercent 
kPointPercent 
kVerticesPerShape 
kPrimitivesPerShape 
kTrialCount 
kBindShaderCount 
kBindTextureCount 
kSetUniformCount 
kBufferMemory 
kFboMemory 
kTextureMemory 
kFrameBufferMemory 
kTotalGpuMemory 

Definition at line 135 of file gpuperformance.h.

Enable/disable five modes of GPU performance measurement:

  • Scene constants (listed above).
  • Baseline framerate. This is the time to render the scene as originally provided, measured between glFinish calls, with depth buffering disabled.
  • No draw framerate. The scene is rendered with all primitives removed, which results in a timing of the traversal and state change overhead.
  • Minimum viewport framerate. The scene is rendered as provided, but in a 1 pixel viewport. This minimizes the fill time, resulting in a timing of vertex processing (and traversal/state change overhead).
  • Resource creation time. This renderers the scene in a new Renderer instance, incorporating the time to create (duplicate) all the Renderer-related resources.
Enumerator
kNoEnables 
kConstants 
kBaseline 
kNoDraw 
kMinimumViewport 
kResource 
kGpuMemory 
kGlTrace 
kAllEnables 

Definition at line 97 of file gpuperformance.h.

Todo:
(user) possibly add triangle(primitive) area? a bit expensive...
Enumerator
kFramesPerSecond 
kNodesPerSecond 
kShapesPerSecond 
kDrawCallsPerSecond 
kVerticesPerSecond 
kPrimitivesPerSecond 
kPixelsPerSecond 
kRenderTime 
kResourceCreation 
kNoDrawCalls 
kMinViewport 
kTransformRate 
kFillRate 
kTraversalPercent 
kTransformPercent 
kFillPercent 

Definition at line 162 of file gpuperformance.h.

Constructor & Destructor Documentation

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.

ion::analytics::GpuPerformanceTester::~GpuPerformanceTester ( )
virtual

Definition at line 529 of file gpuperformance.cc.

Member Function Documentation

bool ion::analytics::GpuPerformanceTester::AreModesEnabled ( Enables  enables) const
inline

Returns true if all of the specified modes are currently enabled.

Definition at line 193 of file gpuperformance.h.

Referenced by AccumulateMeasurements(), and GetResults().

ion::analytics::GpuPerformanceTester::FRIEND_TEST ( GPUPerformanceTest  ,
InstanceCopy   
)
protected

Allow test to access private function.

Enables ion::analytics::GpuPerformanceTester::GetEnables ( ) const
inline

Definition at line 191 of file gpuperformance.h.

int ion::analytics::GpuPerformanceTester::GetTrialCount ( ) const
inline

Returns/sets the number of trials used to measure performance.

Definition at line 215 of file gpuperformance.h.

Referenced by GetResults().

NodePtr ion::analytics::GpuPerformanceTester::InstanceCopy ( const gfx::NodePtr scene)
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().

Measurement ion::analytics::GpuPerformanceTester::MeasureBaseline ( const gfx::NodePtr scene,
const gfx::GraphicsManagerPtr graphics_manager,
const gfx::RendererPtr renderer 
)
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().

Measurement ion::analytics::GpuPerformanceTester::MeasureMinViewportSpeed ( const gfx::NodePtr scene,
const gfx::GraphicsManagerPtr graphics_manager,
const gfx::RendererPtr renderer 
)
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().

Measurement ion::analytics::GpuPerformanceTester::MeasurePerformance ( const gfx::NodePtr scene,
const gfx::GraphicsManagerPtr graphics_manager,
const gfx::RendererPtr renderer 
)
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().

Measurement ion::analytics::GpuPerformanceTester::MeasureResourceCreation ( const gfx::NodePtr scene,
const gfx::GraphicsManagerPtr graphics_manager 
)
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().

Measurement ion::analytics::GpuPerformanceTester::MeasureStateChanges ( const gfx::NodePtr scene,
const gfx::GraphicsManagerPtr graphics_manager,
const gfx::RendererPtr renderer 
)
protectedvirtual

Measures performance of state changes, i.e.

traverse scene without actually rendering any geometry.

Todo:
(user): test wether state changes are deferred on any of our test platforms, consider adding trivial geometry draw to insure a meaningful measurement.

Definition at line 1051 of file gpuperformance.cc.

References DCHECK, InstanceCopy(), MeasurePerformance(), and no_draw_calls_.

Referenced by AccumulateMeasurements().

const Benchmark ion::analytics::GpuPerformanceTester::RunAllMeasurements ( const gfx::NodePtr scene,
const gfx::GraphicsManagerPtr graphics_manager,
const gfx::RendererPtr renderer 
)
virtual

Runs full set of basic measurements, returns Benchmark immediately.

Definition at line 1008 of file gpuperformance.cc.

References AccumulateMeasurements(), and GetResults().

void ion::analytics::GpuPerformanceTester::SetEnables ( GpuPerformanceTester::Enables  enables)
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.

void ion::analytics::GpuPerformanceTester::SetTrialCount ( int  number_of_trials)
inline

Definition at line 216 of file gpuperformance.h.

Member Data Documentation

Benchmark::AccumulatedVariable ion::analytics::GpuPerformanceTester::baseline_
protected

Definition at line 288 of file gpuperformance.h.

Referenced by AccumulateMeasurements(), GetResults(), and MeasureBaseline().

Benchmark::AccumulatedVariable ion::analytics::GpuPerformanceTester::baseline_inverse_
protected

Definition at line 289 of file gpuperformance.h.

Referenced by AccumulateMeasurements(), GetResults(), and MeasureBaseline().

Benchmark ion::analytics::GpuPerformanceTester::benchmark_
protected

The finalized benchmark data.

Definition at line 271 of file gpuperformance.h.

size_t ion::analytics::GpuPerformanceTester::buffer_memory_
protected

Definition at line 284 of file gpuperformance.h.

Referenced by AccumulateMeasurements(), and GetResults().

Enables ion::analytics::GpuPerformanceTester::enables_
protected

Enable and disable measurement phases.

Definition at line 268 of file gpuperformance.h.

Referenced by SetEnables().

size_t ion::analytics::GpuPerformanceTester::fbo_memory_
protected

Definition at line 285 of file gpuperformance.h.

Referenced by AccumulateMeasurements(), and GetResults().

size_t ion::analytics::GpuPerformanceTester::framebuffer_memory_
protected

Definition at line 287 of file gpuperformance.h.

Referenced by AccumulateMeasurements(), and GetResults().

uint32 ion::analytics::GpuPerformanceTester::height_
protected
const double ion::analytics::GpuPerformanceTester::kInvalidValue
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.

Benchmark::AccumulatedVariable ion::analytics::GpuPerformanceTester::min_viewport_
protected

Definition at line 292 of file gpuperformance.h.

Referenced by AccumulateMeasurements(), GetResults(), and MeasureMinViewportSpeed().

Benchmark::AccumulatedVariable ion::analytics::GpuPerformanceTester::min_viewport_inverse_
protected

Definition at line 293 of file gpuperformance.h.

Referenced by AccumulateMeasurements(), GetResults(), and MeasureMinViewportSpeed().

Benchmark::AccumulatedVariable ion::analytics::GpuPerformanceTester::no_draw_calls_
protected

Definition at line 291 of file gpuperformance.h.

Referenced by AccumulateMeasurements(), GetResults(), and MeasureStateChanges().

size_t ion::analytics::GpuPerformanceTester::num_bind_shader_
protected

Definition at line 281 of file gpuperformance.h.

Referenced by AccumulateMeasurements(), and GetResults().

size_t ion::analytics::GpuPerformanceTester::num_bind_texture_
protected

Definition at line 282 of file gpuperformance.h.

Referenced by AccumulateMeasurements(), and GetResults().

int ion::analytics::GpuPerformanceTester::num_draws_
protected

Definition at line 276 of file gpuperformance.h.

Referenced by AccumulateMeasurements(), and GetResults().

int ion::analytics::GpuPerformanceTester::num_lines_
protected

Definition at line 279 of file gpuperformance.h.

Referenced by AccumulateMeasurements(), and GetResults().

int ion::analytics::GpuPerformanceTester::num_nodes_
protected

Benchmark data in progress.

Definition at line 274 of file gpuperformance.h.

Referenced by AccumulateMeasurements(), and GetResults().

int ion::analytics::GpuPerformanceTester::num_points_
protected

Definition at line 280 of file gpuperformance.h.

Referenced by AccumulateMeasurements(), and GetResults().

size_t ion::analytics::GpuPerformanceTester::num_set_uniform_
protected

Definition at line 283 of file gpuperformance.h.

Referenced by AccumulateMeasurements(), and GetResults().

int ion::analytics::GpuPerformanceTester::num_shapes_
protected

Definition at line 275 of file gpuperformance.h.

Referenced by AccumulateMeasurements(), and GetResults().

int ion::analytics::GpuPerformanceTester::num_triangles_
protected

Definition at line 278 of file gpuperformance.h.

Referenced by AccumulateMeasurements(), and GetResults().

int ion::analytics::GpuPerformanceTester::num_vertices_
protected

Definition at line 277 of file gpuperformance.h.

Referenced by AccumulateMeasurements(), and GetResults().

uint32 ion::analytics::GpuPerformanceTester::number_of_trials_
protected

Definition at line 263 of file gpuperformance.h.

Referenced by MeasurePerformance().

Benchmark::AccumulatedVariable ion::analytics::GpuPerformanceTester::resource_
protected

Definition at line 290 of file gpuperformance.h.

Referenced by AccumulateMeasurements(), GetResults(), and MeasureResourceCreation().

size_t ion::analytics::GpuPerformanceTester::texture_memory_
protected

Definition at line 286 of file gpuperformance.h.

Referenced by AccumulateMeasurements(), and GetResults().

uint32 ion::analytics::GpuPerformanceTester::width_
protected

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