_clutter_feature_init ();
#ifdef CLUTTER_ENABLE_PROFILE
+ {
+ UProfContext *cogl_context;
+ cogl_context = uprof_find_context ("Cogl");
+ if (cogl_context)
+ uprof_context_link (_clutter_uprof_context, cogl_context);
+ }
+
if (clutter_profile_flags & CLUTTER_PROFILE_PICKING_ONLY)
_clutter_profile_suspend ();
#endif
$(srcdir)/cogl-framebuffer.c \
$(srcdir)/cogl-matrix-mesa.h \
$(srcdir)/cogl-matrix-mesa.c \
+ $(srcdir)/cogl-profile.h \
+ $(srcdir)/cogl-profile.c \
$(NULL)
EXTRA_DIST += $(cogl_winsys_sources)
#include "cogl-material-private.h"
#include "cogl-vertex-buffer-private.h"
#include "cogl-framebuffer-private.h"
+#include "cogl-profile.h"
#include <string.h>
#include <gmodule.h>
(cogl_get_features () & COGL_FEATURE_VBOS) ? FALSE : TRUE;
CoglHandle framebuffer;
CoglMatrixStack *modelview_stack;
+ COGL_STATIC_TIMER (flush_timer,
+ "Mainloop", /* parent */
+ "Journal Flush",
+ "The time spent flushing the Cogl journal",
+ 0 /* no application private data */);
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
if (ctx->journal->len == 0)
return;
+ COGL_TIMER_START (_cogl_uprof_context, flush_timer);
+
if (G_UNLIKELY (cogl_debug_flags & COGL_DEBUG_BATCHING))
g_print ("BATCHING: journal len = %d\n", ctx->journal->len);
g_array_set_size (ctx->journal, 0);
g_array_set_size (ctx->logged_vertices, 0);
+
+ COGL_TIMER_STOP (_cogl_uprof_context, flush_timer);
}
static void
int next_entry;
guint32 disable_layers;
CoglJournalEntry *entry;
+ COGL_STATIC_TIMER (log_timer,
+ "Mainloop", /* parent */
+ "Journal Log",
+ "The time spent logging in the Cogl journal",
+ 0 /* no application private data */);
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
+ COGL_TIMER_START (_cogl_uprof_context, log_timer);
+
if (ctx->logged_vertices->len == 0)
_cogl_journal_init ();
if (G_UNLIKELY (cogl_debug_flags & COGL_DEBUG_DISABLE_BATCHING
|| cogl_debug_flags & COGL_DEBUG_RECTANGLES))
_cogl_journal_flush ();
+
+ COGL_TIMER_STOP (_cogl_uprof_context, log_timer);
}
--- /dev/null
+
+#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
--- /dev/null
+/*
+ * Cogl
+ *
+ * An object oriented GL/GLES Abstraction/Utility Layer
+ *
+ * Copyright (C) 2007,2008,2009 Intel Corporation.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __COGL_PROFILE_H__
+#define __COGL_PROFILE_H__
+
+
+#ifdef COGL_ENABLE_PROFILE
+
+#include <uprof.h>
+
+extern UProfContext *_cogl_uprof_context;
+
+#define COGL_STATIC_TIMER UPROF_STATIC_TIMER
+#define COGL_STATIC_COUNTER UPROF_STATIC_COUNTER
+#define COGL_COUNTER_INC UPROF_COUNTER_INC
+#define COGL_COUNTER_DEC UPROF_COUNTER_DEC
+#define COGL_TIMER_START UPROF_TIMER_START
+#define COGL_TIMER_STOP UPROF_TIMER_STOP
+
+#else
+
+#define COGL_STATIC_TIMER(A,B,C,D,E) extern void _cogl_dummy_decl (void)
+#define COGL_STATIC_COUNTER(A,B,C,D) extern void _cogl_dummy_decl (void)
+#define COGL_COUNTER_INC(A,B) G_STMT_START{ (void)0; }G_STMT_END
+#define COGL_COUNTER_DEC(A,B) G_STMT_START{ (void)0; }G_STMT_END
+#define COGL_TIMER_START(A,B) G_STMT_START{ (void)0; }G_STMT_END
+#define COGL_TIMER_STOP(A,B) G_STMT_START{ (void)0; }G_STMT_END
+
+
+#endif
+
+#endif /* __COGL_PROFILE_H__ */
+
[yes], [
if test "x$GCC" = "xyes"; then
PKG_CHECK_MODULES([PROFILE_DEP], [uprof-0.2])
- CLUTTER_PROFILE_CFLAGS=" -DCLUTTER_ENABLE_PROFILE $PROFILE_DEP_CFLAGS"
+ CLUTTER_PROFILE_CFLAGS=" -DCLUTTER_ENABLE_PROFILE -DCOGL_ENABLE_PROFILE $PROFILE_DEP_CFLAGS"
CLUTTER_PROFILE_LDFLAGS=" $PROFILE_DEP_LIBS"
if test "x$enable_debug" = "xyes"; then
CLUTTER_PROFILE_CFLAGS+=" -DUPROF_DEBUG"