r300g: Rudimentary stats, printed on exit.

Whoo!
This commit is contained in:
Corbin Simpson
2010-04-26 07:13:15 -07:00
parent bf98d61708
commit b02f1c86f5
4 changed files with 22 additions and 0 deletions

View File

@@ -41,10 +41,21 @@ static void r300_destroy_context(struct pipe_context* context)
{
struct r300_context* r300 = r300_context(context);
struct r300_query* query, * temp;
struct r300_atom *atom;
util_blitter_destroy(r300->blitter);
draw_destroy(r300->draw);
/* Print stats, if enabled. */
if (SCREEN_DBG_ON(r300->screen, DBG_STATS)) {
fprintf(stderr, "r300: Stats for context %p:\n", r300);
fprintf(stderr, " : Flushes: %llu\n", r300->flush_counter);
foreach(atom, &r300->atom_list) {
fprintf(stderr, " : %s: %llu emits\n",
atom->name, atom->counter);
}
}
/* Free the OQ BO. */
context->screen->resource_destroy(context->screen, r300->oqbo);

View File

@@ -45,6 +45,8 @@ struct r300_atom {
struct r300_atom *prev, *next;
/* Name, for debugging. */
const char* name;
/* Stat counter. */
uint64_t counter;
/* Opaque state. */
void* state;
/* Emit the state to the context. */
@@ -435,6 +437,9 @@ struct r300_context {
/* upload managers */
struct u_upload_mgr *upload_vb;
struct u_upload_mgr *upload_ib;
/* Stat counter. */
uint64_t flush_counter;
};
/* Convenience cast wrapper. */

View File

@@ -157,6 +157,9 @@
DBG(cs_context_copy, DBG_CS, "r300: FLUSH_CS in %s (%s:%d)\n\n", __FUNCTION__, \
__FILE__, __LINE__); \
} \
if (SCREEN_DBG_ON(r300->screen, DBG_STATS)) { \
r300->flush_counter++; \
} \
cs_winsys->flush_cs(cs_winsys); \
} while (0)

View File

@@ -1187,6 +1187,9 @@ void r300_emit_dirty_state(struct r300_context* r300)
foreach(atom, &r300->atom_list) {
if (atom->dirty) {
atom->emit(r300, atom->size, atom->state);
if (SCREEN_DBG_ON(r300->screen, DBG_STATS)) {
atom->counter++;
}
atom->dirty = FALSE;
}
}