journal: provide more detailed uprof instrumentation

This adds more timing around key stages of the journal flushing process.
This commit is contained in:
Robert Bragg 2010-07-26 15:21:18 +01:00
parent 9d4ad1584d
commit d1ac02594f
2 changed files with 67 additions and 12 deletions

View File

@ -196,8 +196,15 @@ _cogl_journal_flush_modelview_and_entries (CoglJournalEntry *batch_start,
int batch_len, int batch_len,
void *data) void *data)
{ {
COGL_STATIC_TIMER (time_flush_modelview_and_entries,
"flush: material+entries", /* parent */
"flush: modelview+entries",
"The time spent flushing modelview + entries",
0 /* no application private data */);
CoglJournalFlushState *state = data; CoglJournalFlushState *state = data;
COGL_TIMER_START (_cogl_uprof_context, time_flush_modelview_and_entries);
if (G_UNLIKELY (cogl_debug_flags & COGL_DEBUG_BATCHING)) if (G_UNLIKELY (cogl_debug_flags & COGL_DEBUG_BATCHING))
g_print ("BATCHING: modelview batch len = %d\n", batch_len); g_print ("BATCHING: modelview batch len = %d\n", batch_len);
@ -279,6 +286,8 @@ _cogl_journal_flush_modelview_and_entries (CoglJournalEntry *batch_start,
} }
state->vertex_offset += (4 * batch_len); state->vertex_offset += (4 * batch_len);
COGL_TIMER_STOP (_cogl_uprof_context, time_flush_modelview_and_entries);
} }
static gboolean static gboolean
@ -311,9 +320,16 @@ _cogl_journal_flush_material_and_entries (CoglJournalEntry *batch_start,
void *data) void *data)
{ {
unsigned long enable_flags = 0; unsigned long enable_flags = 0;
COGL_STATIC_TIMER (time_flush_material_entries,
"flush: texcoords+material+entries", /* parent */
"flush: material+entries",
"The time spent flushing material + entries",
0 /* no application private data */);
_COGL_GET_CONTEXT (ctx, NO_RETVAL); _COGL_GET_CONTEXT (ctx, NO_RETVAL);
COGL_TIMER_START (_cogl_uprof_context, time_flush_material_entries);
if (G_UNLIKELY (cogl_debug_flags & COGL_DEBUG_BATCHING)) if (G_UNLIKELY (cogl_debug_flags & COGL_DEBUG_BATCHING))
g_print ("BATCHING: material batch len = %d\n", batch_len); g_print ("BATCHING: material batch len = %d\n", batch_len);
@ -339,6 +355,8 @@ _cogl_journal_flush_material_and_entries (CoglJournalEntry *batch_start,
} }
else else
_cogl_journal_flush_modelview_and_entries (batch_start, batch_len, data); _cogl_journal_flush_modelview_and_entries (batch_start, batch_len, data);
COGL_TIMER_STOP (_cogl_uprof_context, time_flush_material_entries);
} }
static gboolean static gboolean
@ -369,9 +387,17 @@ _cogl_journal_flush_texcoord_vbo_offsets_and_entries (
{ {
CoglJournalFlushState *state = data; CoglJournalFlushState *state = data;
int i; int i;
COGL_STATIC_TIMER (time_flush_texcoord_material_entries,
"flush: vbo+texcoords+material+entries", /* parent */
"flush: texcoords+material+entries",
"The time spent flushing texcoord offsets + material "
"+ entries",
0 /* no application private data */);
_COGL_GET_CONTEXT (ctx, NO_RETVAL); _COGL_GET_CONTEXT (ctx, NO_RETVAL);
COGL_TIMER_START (_cogl_uprof_context, time_flush_texcoord_material_entries);
for (i = 0; i < batch_start->n_layers; i++) for (i = 0; i < batch_start->n_layers; i++)
{ {
GE (glClientActiveTexture (GL_TEXTURE0 + i)); GE (glClientActiveTexture (GL_TEXTURE0 + i));
@ -400,6 +426,7 @@ _cogl_journal_flush_texcoord_vbo_offsets_and_entries (
compare_entry_materials, compare_entry_materials,
_cogl_journal_flush_material_and_entries, _cogl_journal_flush_material_and_entries,
data); data);
COGL_TIMER_STOP (_cogl_uprof_context, time_flush_texcoord_material_entries);
} }
static gboolean static gboolean
@ -425,9 +452,18 @@ _cogl_journal_flush_vbo_offsets_and_entries (CoglJournalEntry *batch_start,
CoglHandle indices_handle; CoglHandle indices_handle;
CoglVertexBufferIndices *indices; CoglVertexBufferIndices *indices;
#endif #endif
COGL_STATIC_TIMER (time_flush_vbo_texcoord_material_entries,
"Journal Flush", /* parent */
"flush: vbo+texcoords+material+entries",
"The time spent flushing vbo + texcoord offsets + "
"material + entries",
0 /* no application private data */);
_COGL_GET_CONTEXT (ctx, NO_RETVAL); _COGL_GET_CONTEXT (ctx, NO_RETVAL);
COGL_TIMER_START (_cogl_uprof_context,
time_flush_vbo_texcoord_material_entries);
if (G_UNLIKELY (cogl_debug_flags & COGL_DEBUG_BATCHING)) if (G_UNLIKELY (cogl_debug_flags & COGL_DEBUG_BATCHING))
g_print ("BATCHING: vbo offset batch len = %d\n", batch_len); g_print ("BATCHING: vbo offset batch len = %d\n", batch_len);
@ -495,6 +531,9 @@ _cogl_journal_flush_vbo_offsets_and_entries (CoglJournalEntry *batch_start,
state->vbo_offset += (stride * 4 * batch_len); state->vbo_offset += (stride * 4 * batch_len);
if (G_UNLIKELY (cogl_debug_flags & COGL_DEBUG_JOURNAL)) if (G_UNLIKELY (cogl_debug_flags & COGL_DEBUG_JOURNAL))
g_print ("new vbo offset = %lu\n", (unsigned long)state->vbo_offset); g_print ("new vbo offset = %lu\n", (unsigned long)state->vbo_offset);
COGL_TIMER_STOP (_cogl_uprof_context,
time_flush_vbo_texcoord_material_entries);
} }
static gboolean static gboolean

View File

@ -3323,14 +3323,27 @@ _cogl_material_equal (CoglMaterial *material0,
gboolean skip_gl_color) gboolean skip_gl_color)
{ {
unsigned long materials_difference; unsigned long materials_difference;
gboolean ret;
COGL_STATIC_TIMER (material_equal_timer,
"Mainloop", /* parent */
"_cogl_material_equal",
"The time spent comparing cogl materials",
0 /* no application private data */);
COGL_TIMER_START (_cogl_uprof_context, material_equal_timer);
if (material0 == material1) if (material0 == material1)
return TRUE; {
ret = TRUE;
goto done;
}
ret = FALSE;
/* First check non-sparse properties */ /* First check non-sparse properties */
if (material0->real_blend_enable != material1->real_blend_enable) if (material0->real_blend_enable != material1->real_blend_enable)
return FALSE; goto done;
/* Then check sparse properties */ /* Then check sparse properties */
@ -3347,20 +3360,20 @@ _cogl_material_equal (CoglMaterial *material0,
_cogl_material_get_authority (material1, state); _cogl_material_get_authority (material1, state);
if (!cogl_color_equal (&authority0->color, &authority1->color)) if (!cogl_color_equal (&authority0->color, &authority1->color))
return FALSE; goto done;
} }
if (!simple_property_equal (material0, material1, if (!simple_property_equal (material0, material1,
materials_difference, materials_difference,
COGL_MATERIAL_STATE_LIGHTING, COGL_MATERIAL_STATE_LIGHTING,
_cogl_material_lighting_state_equal)) _cogl_material_lighting_state_equal))
return FALSE; goto done;
if (!simple_property_equal (material0, material1, if (!simple_property_equal (material0, material1,
materials_difference, materials_difference,
COGL_MATERIAL_STATE_ALPHA_FUNC, COGL_MATERIAL_STATE_ALPHA_FUNC,
_cogl_material_alpha_state_equal)) _cogl_material_alpha_state_equal))
return FALSE; goto done;
/* We don't need to compare the detailed blending state if we know /* We don't need to compare the detailed blending state if we know
* blending is disabled for both materials. */ * blending is disabled for both materials. */
@ -3374,7 +3387,7 @@ _cogl_material_equal (CoglMaterial *material0,
_cogl_material_get_authority (material1, state); _cogl_material_get_authority (material1, state);
if (!_cogl_material_blend_state_equal (authority0, authority1)) if (!_cogl_material_blend_state_equal (authority0, authority1))
return FALSE; goto done;
} }
/* XXX: we don't need to compare the BLEND_ENABLE state because it's /* XXX: we don't need to compare the BLEND_ENABLE state because it's
@ -3391,33 +3404,36 @@ _cogl_material_equal (CoglMaterial *material0,
materials_difference, materials_difference,
COGL_MATERIAL_STATE_DEPTH, COGL_MATERIAL_STATE_DEPTH,
_cogl_material_depth_state_equal)) _cogl_material_depth_state_equal))
return FALSE; goto done;
if (!simple_property_equal (material0, material1, if (!simple_property_equal (material0, material1,
materials_difference, materials_difference,
COGL_MATERIAL_STATE_FOG, COGL_MATERIAL_STATE_FOG,
_cogl_material_fog_state_equal)) _cogl_material_fog_state_equal))
return FALSE; goto done;
if (!simple_property_equal (material0, material1, if (!simple_property_equal (material0, material1,
materials_difference, materials_difference,
COGL_MATERIAL_STATE_POINT_SIZE, COGL_MATERIAL_STATE_POINT_SIZE,
_cogl_material_point_size_equal)) _cogl_material_point_size_equal))
return FALSE; goto done;
if (!simple_property_equal (material0, material1, if (!simple_property_equal (material0, material1,
materials_difference, materials_difference,
COGL_MATERIAL_STATE_USER_SHADER, COGL_MATERIAL_STATE_USER_SHADER,
_cogl_material_user_shader_equal)) _cogl_material_user_shader_equal))
return FALSE; goto done;
if (!simple_property_equal (material0, material1, if (!simple_property_equal (material0, material1,
materials_difference, materials_difference,
COGL_MATERIAL_STATE_LAYERS, COGL_MATERIAL_STATE_LAYERS,
_cogl_material_layers_equal)) _cogl_material_layers_equal))
return FALSE; goto done;
return TRUE; ret = TRUE;
done:
COGL_TIMER_STOP (_cogl_uprof_context, material_equal_timer);
return ret;
} }
void void