mutter/cogl/cogl-profile.c
Robert Bragg fbad0a75b6 profiling: Adds initial UProf accounting to Cogl
This adds gives Cogl a dedicated UProf context which will be linked together
with Clutter's context during clutter_init_real().

Initial timers cover _cogl_journal_flush and _cogl_journal_log_quad

You can explicitly ask for a report of Cogl statistics by exporting
COGL_PROFILE_OUTPUT_REPORT=1 but since the context is linked with Clutter's
the statisitcs will also be shown in the automatic Clutter reports.
2010-01-08 20:19:50 +00:00

31 lines
621 B
C

#ifdef COGL_ENABLE_PROFILE
#include "cogl-profile.h"
#include <stdlib.h>
UProfContext *_cogl_uprof_context;
static void __attribute__ ((constructor))
cogl_uprof_constructor (void)
{
_cogl_uprof_context = uprof_context_new ("Cogl");
}
static void __attribute__ ((destructor))
cogl_uprof_destructor (void)
{
if (getenv ("COGL_PROFILE_OUTPUT_REPORT"))
{
UProfReport *report = uprof_report_new ("Cogl report");
uprof_report_add_context (report, _cogl_uprof_context);
uprof_report_print (report);
uprof_report_unref (report);
}
uprof_context_unref (_cogl_uprof_context);
}
#endif