Drop the UProf dependency

Nobody has been compiling Clutter with profiling enabled in a long time.

UProf itself hasn't been updated in 5 years, and it still depends on
deprecated components like dbus-glib, with no port to GDBus in sight.

The profiling code was moderately useful in the past, but these days
it's probably better to profile Cogl than Clutter itself; timing
information can be extracted by the timestamp on each diagnostic message
that is now available by default in the CLUTTER_NOTE macro, and we can
add ad hoc counters where needed.
This commit is contained in:
Emmanuele Bassi 2015-03-03 17:37:02 +00:00
parent df15f04fc0
commit 253292802c
16 changed files with 4 additions and 810 deletions

View File

@ -60,14 +60,6 @@ GObject-Introspection is available from:
git://git.gnome.org/gobject-introspection
If you want support for profiling Clutter you will also need:
• UProf ≥ @UPROF_REQ_VERSION@
UProf is available from:
git://github.com/rib/UProf.git
RESOURCES
-------------------------------------------------------------------------------
@ -162,10 +154,6 @@ Clutter has additional command line options for the configure script:
Build Clutter with coverage report support, provided by gcov. This
feature only works with the GNU Compiler Suite and gcov installed.
--enable-profile=[no/yes]
Build Clutter with profiling instrumentation. Requires the GNU
C Compiler and the UProf library.
--disable-tests
Disable building the Clutter tests suite.

View File

@ -40,10 +40,6 @@ If you are building the Introspection data you will also need:
* [GObject-Introspection](http://git.gnome.org/browse/gobject-introspection)
If you want support for profiling Clutter you will also need:
* [UProf](git://github.com/rib/UProf.git)
Resources
---------

View File

@ -30,7 +30,6 @@ AM_CPPFLAGS = \
-I$(top_builddir)/clutter \
$(CLUTTER_DEPRECATED_CFLAGS) \
$(CLUTTER_DEBUG_CFLAGS) \
$(CLUTTER_PROFILE_CFLAGS) \
$(CLUTTER_HIDDEN_VISIBILITY_CFLAGS) \
$(NULL)
@ -240,7 +239,6 @@ source_h_priv = \
clutter-paint-node-private.h \
clutter-paint-volume-private.h \
clutter-private.h \
clutter-profile.h \
clutter-script-private.h \
clutter-settings-private.h \
clutter-stage-manager-private.h \
@ -253,7 +251,6 @@ source_c_priv = \
clutter-easing.c \
clutter-event-translator.c \
clutter-id-pool.c \
clutter-profile.c \
$(NULL)
# deprecated installed headers
@ -844,7 +841,7 @@ clutter_deprecated_HEADERS = $(deprecated_h)
lib_LTLIBRARIES += libclutter-@CLUTTER_API_VERSION@.la
libclutter_@CLUTTER_API_VERSION@_la_LIBADD = $(LIBM) $(CLUTTER_LIBS) $(CLUTTER_PROFILE_LIBS)
libclutter_@CLUTTER_API_VERSION@_la_LIBADD = $(LIBM) $(CLUTTER_LIBS)
libclutter_@CLUTTER_API_VERSION@_la_DEPENDENCIES = $(win32_resources)
libclutter_@CLUTTER_API_VERSION@_la_SOURCES = \

View File

@ -627,7 +627,6 @@
#include "clutter-paint-node-private.h"
#include "clutter-paint-volume-private.h"
#include "clutter-private.h"
#include "clutter-profile.h"
#include "clutter-property-transition.h"
#include "clutter-scriptable.h"
#include "clutter-script-private.h"
@ -3676,16 +3675,6 @@ clutter_actor_paint (ClutterActor *self)
gboolean shader_applied = FALSE;
ClutterStage *stage;
CLUTTER_STATIC_COUNTER (actor_paint_counter,
"Actor real-paint counter",
"Increments each time any actor is painted",
0 /* no application private data */);
CLUTTER_STATIC_COUNTER (actor_pick_counter,
"Actor pick-paint counter",
"Increments each time any actor is painted "
"for picking",
0 /* no application private data */);
g_return_if_fail (CLUTTER_IS_ACTOR (self));
if (CLUTTER_ACTOR_IN_DESTRUCTION (self))
@ -3796,16 +3785,12 @@ clutter_actor_paint (ClutterActor *self)
if (pick_mode == CLUTTER_PICK_NONE)
{
CLUTTER_COUNTER_INC (_clutter_uprof_context, actor_paint_counter);
/* We check whether we need to add the flatten effect before
each paint so that we can avoid having a mechanism for
applications to notify when the value of the
has_overlaps virtual changes. */
add_or_remove_flatten_effect (self);
}
else
CLUTTER_COUNTER_INC (_clutter_uprof_context, actor_pick_counter);
/* We save the current paint volume so that the next time the
* actor queues a redraw we can constrain the redraw to just

View File

@ -49,7 +49,6 @@
#include "clutter-event-private.h"
#include "clutter-marshal.h"
#include "clutter-private.h"
#include "clutter-profile.h"
#include "clutter-stage-manager-private.h"
#include "clutter-stage-private.h"
#include "clutter-stage-window.h"

View File

@ -65,7 +65,6 @@
#include "clutter-main.h"
#include "clutter-master-clock.h"
#include "clutter-private.h"
#include "clutter-profile.h"
#include "clutter-settings-private.h"
#include "clutter-stage-manager.h"
#include "clutter-stage-private.h"
@ -128,9 +127,6 @@ guint clutter_debug_flags = 0;
guint clutter_paint_debug_flags = 0;
guint clutter_pick_debug_flags = 0;
/* profile flags */
guint clutter_profile_flags = 0;
const guint clutter_major_version = CLUTTER_MAJOR_VERSION;
const guint clutter_minor_version = CLUTTER_MINOR_VERSION;
const guint clutter_micro_version = CLUTTER_MICRO_VERSION;
@ -171,13 +167,6 @@ static const GDebugKey clutter_paint_debug_keys[] = {
{ "paint-deform-tiles", CLUTTER_DEBUG_PAINT_DEFORM_TILES },
};
#ifdef CLUTTER_ENABLE_PROFILE
static const GDebugKey clutter_profile_keys[] = {
{"picking-only", CLUTTER_PROFILE_PICKING_ONLY },
{"disable-report", CLUTTER_PROFILE_DISABLE_REPORT }
};
#endif /* CLUTTER_ENABLE_DEBUG */
static void
clutter_threads_impl_lock (void)
{
@ -787,28 +776,6 @@ clutter_main_level (void)
return clutter_main_loop_level;
}
#ifdef CLUTTER_ENABLE_PROFILE
static gint (*prev_poll) (GPollFD *ufds, guint nfsd, gint timeout_) = NULL;
static gint
timed_poll (GPollFD *ufds,
guint nfsd,
gint timeout_)
{
gint ret;
CLUTTER_STATIC_TIMER (poll_timer,
"Mainloop", /* parent */
"Mainloop Idle",
"The time spent idle in poll()",
0 /* no application private data */);
CLUTTER_TIMER_START (uprof_get_mainloop_context (), poll_timer);
ret = prev_poll (ufds, nfsd, timeout_);
CLUTTER_TIMER_STOP (uprof_get_mainloop_context (), poll_timer);
return ret;
}
#endif
/**
* clutter_main:
*
@ -826,14 +793,6 @@ clutter_main (void)
return;
}
#ifdef CLUTTER_ENABLE_PROFILE
if (!prev_poll)
{
prev_poll = g_main_context_get_poll_func (NULL);
g_main_context_set_poll_func (NULL, timed_poll);
}
#endif
clutter_main_loop_level++;
CLUTTER_NOTE (MISC, "Entering main loop level %d", clutter_main_loop_level);
@ -1361,32 +1320,6 @@ clutter_arg_no_debug_cb (const char *key,
}
#endif /* CLUTTER_ENABLE_DEBUG */
#ifdef CLUTTER_ENABLE_PROFILE
static gboolean
clutter_arg_profile_cb (const char *key,
const char *value,
gpointer user_data)
{
clutter_profile_flags |=
g_parse_debug_string (value,
clutter_profile_keys,
G_N_ELEMENTS (clutter_profile_keys));
return TRUE;
}
static gboolean
clutter_arg_no_profile_cb (const char *key,
const char *value,
gpointer user_data)
{
clutter_profile_flags &=
~g_parse_debug_string (value,
clutter_profile_keys,
G_N_ELEMENTS (clutter_profile_keys));
return TRUE;
}
#endif /* CLUTTER_ENABLE_PROFILE */
GQuark
clutter_init_error_quark (void)
{
@ -1399,14 +1332,6 @@ clutter_init_real (GError **error)
ClutterMainContext *ctx;
ClutterBackend *backend;
#ifdef CLUTTER_ENABLE_PROFILE
CLUTTER_STATIC_TIMER (mainloop_timer,
NULL, /* no parent */
"Mainloop",
"The time spent in the clutter mainloop",
0 /* no application private data */);
#endif
/* Note, creates backend if not already existing, though parse args will
* have likely created it
*/
@ -1453,27 +1378,6 @@ clutter_init_real (GError **error)
if (!_clutter_feature_init (error))
return CLUTTER_INIT_ERROR_BACKEND;
#ifdef CLUTTER_ENABLE_PROFILE
/* We need to be absolutely sure that uprof has been initialized
* before calling _clutter_uprof_init. uprof_init (NULL, NULL)
* will be a NOP if it has been initialized but it will also
* mean subsequent parsing of the UProf GOptionGroup will have no
* affect.
*
* Sadly GOptionGroup based library initialization is extremly
* fragile by design because GOptionGroups have no notion of
* dependencies and our post_parse_hook may be called before
* the cogl or uprof groups get parsed.
*/
uprof_init (NULL, NULL);
_clutter_uprof_init ();
CLUTTER_TIMER_START (uprof_get_mainloop_context (), mainloop_timer);
if (clutter_profile_flags & CLUTTER_PROFILE_PICKING_ONLY)
_clutter_profile_suspend ();
#endif
clutter_text_direction = clutter_get_text_direction ();
/* Initiate event collection */
@ -1511,12 +1415,6 @@ static GOptionEntry clutter_args[] = {
{ "clutter-no-debug", 0, 0, G_OPTION_ARG_CALLBACK, clutter_arg_no_debug_cb,
N_("Clutter debugging flags to unset"), "FLAGS" },
#endif /* CLUTTER_ENABLE_DEBUG */
#ifdef CLUTTER_ENABLE_PROFILE
{ "clutter-profile", 0, 0, G_OPTION_ARG_CALLBACK, clutter_arg_profile_cb,
N_("Clutter profiling flags to set"), "FLAGS" },
{ "clutter-no-profile", 0, 0, G_OPTION_ARG_CALLBACK, clutter_arg_no_profile_cb,
N_("Clutter profiling flags to unset"), "FLAGS" },
#endif /* CLUTTER_ENABLE_PROFILE */
{ "clutter-enable-accessibility", 0, 0, G_OPTION_ARG_NONE, &clutter_enable_accessibility,
N_("Enable accessibility"), NULL },
{ NULL, },
@ -1566,18 +1464,6 @@ pre_parse_hook (GOptionContext *context,
}
#endif /* CLUTTER_ENABLE_DEBUG */
#ifdef CLUTTER_ENABLE_PROFILE
env_string = g_getenv ("CLUTTER_PROFILE");
if (env_string != NULL)
{
clutter_profile_flags =
g_parse_debug_string (env_string,
clutter_profile_keys,
G_N_ELEMENTS (clutter_profile_keys));
env_string = NULL;
}
#endif /* CLUTTER_ENABLE_PROFILE */
env_string = g_getenv ("CLUTTER_PICK");
if (env_string != NULL)
{
@ -1831,14 +1717,6 @@ clutter_init_with_args (int *argc,
group = cogl_get_option_group ();
g_option_context_add_group (context, group);
/* Note: That due to the implementation details of glib's goption
* parsing; cogl and uprof will not actually have there arguments
* parsed before the post_parse_hook is called! */
#ifdef CLUTTER_ENABLE_PROFILE
group = uprof_get_option_group ();
g_option_context_add_group (context, group);
#endif
if (entries)
g_option_context_add_main_entries (context, entries, translation_domain);
@ -1872,9 +1750,6 @@ clutter_parse_args (int *argc,
{
GOptionContext *option_context;
GOptionGroup *clutter_group, *cogl_group;
#ifdef CLUTTER_ENABLE_PROFILE
GOptionGroup *uprof_group;
#endif
GError *internal_error = NULL;
gboolean ret = TRUE;
@ -1892,11 +1767,6 @@ clutter_parse_args (int *argc,
cogl_group = cogl_get_option_group ();
g_option_context_add_group (option_context, cogl_group);
#ifdef CLUTTER_ENABLE_PROFILE
uprof_group = uprof_get_option_group ();
g_option_context_add_group (option_context, uprof_group);
#endif
if (!g_option_context_parse (option_context, argc, argv, &internal_error))
{
g_propagate_error (error, internal_error);
@ -3850,11 +3720,6 @@ _clutter_debug_messagev (const char *format,
g_logv (G_LOG_DOMAIN, G_LOG_LEVEL_MESSAGE, fmt, var_args);
#ifdef CLUTTER_ENABLE_PROFILE
if (_clutter_uprof_context != NULL)
uprof_context_vtrace_message (_clutter_uprof_context, format, var_args);
#endif
g_free (fmt);
}

View File

@ -37,7 +37,6 @@
#include "clutter-master-clock-default.h"
#include "clutter-debug.h"
#include "clutter-private.h"
#include "clutter-profile.h"
#include "clutter-stage-manager-private.h"
#include "clutter-stage-private.h"
@ -354,20 +353,10 @@ master_clock_process_events (ClutterMasterClockDefault *master_clock,
gint64 start = g_get_monotonic_time ();
#endif
CLUTTER_STATIC_TIMER (master_event_process,
"Master Clock",
"Event Processing",
"The time spent processing events on all stages",
0);
CLUTTER_TIMER_START (_clutter_uprof_context, master_event_process);
/* Process queued events */
for (l = stages; l != NULL; l = l->next)
_clutter_stage_process_queued_events (l->data);
CLUTTER_TIMER_STOP (_clutter_uprof_context, master_event_process);
#ifdef CLUTTER_ENABLE_DEBUG
if (_clutter_diagnostic_enabled ())
clutter_warn_if_over_budget (master_clock, start, "Event processing");
@ -392,12 +381,6 @@ master_clock_advance_timelines (ClutterMasterClockDefault *master_clock)
gint64 start = g_get_monotonic_time ();
#endif
CLUTTER_STATIC_TIMER (master_timeline_advance,
"Master Clock",
"Timelines Advancement",
"The time spent advancing all timelines",
0);
/* we protect ourselves from timelines being removed during
* the advancement by other timelines by copying the list of
* timelines, taking a reference on them, iterating over the
@ -421,13 +404,9 @@ master_clock_advance_timelines (ClutterMasterClockDefault *master_clock)
timelines = g_slist_copy (master_clock->timelines);
g_slist_foreach (timelines, (GFunc) g_object_ref, NULL);
CLUTTER_TIMER_START (_clutter_uprof_context, master_timeline_advance);
for (l = timelines; l != NULL; l = l->next)
_clutter_timeline_do_tick (l->data, master_clock->cur_tick / 1000);
CLUTTER_TIMER_STOP (_clutter_uprof_context, master_timeline_advance);
g_slist_foreach (timelines, (GFunc) g_object_unref, NULL);
g_slist_free (timelines);
@ -548,14 +527,6 @@ clutter_clock_dispatch (GSource *source,
gboolean stages_updated = FALSE;
GSList *stages;
CLUTTER_STATIC_TIMER (master_dispatch_timer,
"Mainloop",
"Master Clock",
"Master clock dispatch",
0);
CLUTTER_TIMER_START (_clutter_uprof_context, master_dispatch_timer);
CLUTTER_NOTE (SCHEDULER, "Master clock [tick]");
_clutter_threads_acquire_lock ();
@ -603,8 +574,6 @@ clutter_clock_dispatch (GSource *source,
_clutter_threads_release_lock ();
CLUTTER_TIMER_STOP (_clutter_uprof_context, master_dispatch_timer);
return TRUE;
}

View File

@ -1,283 +0,0 @@
#ifdef CLUTTER_ENABLE_PROFILE
#include <stdlib.h>
/* XXX - we need this for g_atexit() */
#define G_DISABLE_DEPRECATION_WARNINGS
#include "clutter-profile.h"
UProfContext *_clutter_uprof_context;
static UProfReport *clutter_uprof_report;
static gboolean searched_for_gl_uprof_context = FALSE;
static UProfContext *gl_uprof_context = NULL;
typedef struct _ClutterUProfReportState
{
gulong n_frames;
float fps;
gulong n_picks;
float msecs_picking;
} ClutterUProfReportState;
static char *
timer_per_frame_cb (UProfReport *report,
UProfTimerResult *timer,
void *user_data)
{
ClutterUProfReportState *state = user_data;
int n_frames = state->n_frames ? state->n_frames : 1;
return g_strdup_printf ("%-10.2f",
uprof_timer_result_get_total_msecs (timer) /
(float)n_frames);
}
static char *
counter_per_frame_cb (UProfReport *report,
UProfCounterResult *counter,
void *user_data)
{
ClutterUProfReportState *state = user_data;
int n_frames = state->n_frames ? state->n_frames : 1;
return g_strdup_printf ("%-5ld",
uprof_counter_result_get_count (counter) /
n_frames);
}
static char *
get_n_frames_cb (UProfReport *report,
const char *statistic,
const char *attribute,
void *user_data)
{
ClutterUProfReportState *state = user_data;
return g_strdup_printf ("%lu", state->n_frames);
}
static char *
get_fps_cb (UProfReport *report,
const char *statistic,
const char *attribute,
void *user_data)
{
ClutterUProfReportState *state = user_data;
return g_strdup_printf ("%5.2f\n", state->fps);
}
static char *
get_n_picks_cb (UProfReport *report,
const char *statistic,
const char *attribute,
void *user_data)
{
ClutterUProfReportState *state = user_data;
return g_strdup_printf ("%lu", state->n_picks);
}
static char *
get_picks_per_frame_cb (UProfReport *report,
const char *statistic,
const char *attribute,
void *user_data)
{
ClutterUProfReportState *state = user_data;
int n_frames = state->n_frames ? state->n_frames : 1;
return g_strdup_printf ("%3.2f",
(float)state->n_picks / (float)n_frames);
}
static char *
get_msecs_per_pick_cb (UProfReport *report,
const char *statistic,
const char *attribute,
void *user_data)
{
ClutterUProfReportState *state = user_data;
int n_picks = state->n_picks ? state->n_picks : 1;
return g_strdup_printf ("%3.2f", state->msecs_picking / (float)n_picks);
}
static gboolean
_clutter_uprof_report_prepare (UProfReport *report,
void **closure_ret,
void *user_data)
{
UProfContext *mainloop_context;
UProfTimerResult *mainloop_timer;
UProfTimerResult *stage_paint_timer;
UProfTimerResult *do_pick_timer;
ClutterUProfReportState *state;
/* NB: uprof provides a shared context for mainloop statistics which allows
* this to work even if the application and not Clutter owns the mainloop.
*
* This is the case when running Mutter for example but because Mutter will
* follow the same convention of using the shared context then we can always
* be sure of where to look for the mainloop results. */
mainloop_context = uprof_get_mainloop_context ();
mainloop_timer = uprof_context_get_timer_result (mainloop_context,
"Mainloop");
/* just bail out if the mainloop timer wasn't hit */
if (!mainloop_timer)
return FALSE;
state = g_new0 (ClutterUProfReportState, 1);
*closure_ret = state;
stage_paint_timer = uprof_context_get_timer_result (_clutter_uprof_context,
"Redrawing");
if (stage_paint_timer)
{
state->n_frames = uprof_timer_result_get_start_count (stage_paint_timer);
uprof_report_add_statistic (report,
"Frames",
"Frame count information");
uprof_report_add_statistic_attribute (report, "Frames",
"Count", "Count",
"The total number of frames",
UPROF_ATTRIBUTE_TYPE_INT,
get_n_frames_cb,
state);
state->fps = (float) state->n_frames
/ (uprof_timer_result_get_total_msecs (mainloop_timer)
/ 1000.0);
uprof_report_add_statistic_attribute (report, "Frames",
"Average FPS", "Average\nFPS",
"The average frames per second",
UPROF_ATTRIBUTE_TYPE_FLOAT,
get_fps_cb,
state);
}
do_pick_timer = uprof_context_get_timer_result (_clutter_uprof_context,
"Picking");
if (do_pick_timer)
{
state->n_picks = uprof_timer_result_get_start_count (do_pick_timer);
state->msecs_picking =
uprof_timer_result_get_total_msecs (do_pick_timer);
uprof_report_add_statistic (report,
"Picks",
"Picking information");
uprof_report_add_statistic_attribute (report, "Picks",
"Count", "Count",
"The total number of picks",
UPROF_ATTRIBUTE_TYPE_INT,
get_n_picks_cb,
state);
uprof_report_add_statistic_attribute (report, "Picks",
"Picks Per Frame",
"Picks\nPer Frame",
"The average number of picks "
"per frame",
UPROF_ATTRIBUTE_TYPE_FLOAT,
get_picks_per_frame_cb,
state);
uprof_report_add_statistic_attribute (report, "Picks",
"Msecs Per Pick",
"Msecs\nPer Pick",
"The average number of "
"milliseconds per pick",
UPROF_ATTRIBUTE_TYPE_FLOAT,
get_msecs_per_pick_cb,
state);
}
uprof_report_add_counters_attribute (clutter_uprof_report,
"Per Frame",
"Per Frame",
"The number of counts per frame",
UPROF_ATTRIBUTE_TYPE_INT,
counter_per_frame_cb,
state);
uprof_report_add_timers_attribute (clutter_uprof_report,
"Per Frame\nmsecs",
"Per Frame",
"The time spent in the timer per frame",
UPROF_ATTRIBUTE_TYPE_FLOAT,
timer_per_frame_cb,
state);
return TRUE;
}
static void
_clutter_uprof_report_done (UProfReport *report, void *closure, void *user_data)
{
g_free (closure);
}
static void
print_exit_report (void)
{
if (!(clutter_profile_flags & CLUTTER_PROFILE_DISABLE_REPORT))
uprof_report_print (clutter_uprof_report);
uprof_report_unref (clutter_uprof_report);
uprof_context_unref (_clutter_uprof_context);
}
void
_clutter_uprof_init (void)
{
UProfContext *cogl_context;
_clutter_uprof_context = uprof_context_new ("Clutter");
uprof_context_link (_clutter_uprof_context, uprof_get_mainloop_context ());
g_atexit (print_exit_report);
cogl_context = uprof_find_context ("Cogl");
if (cogl_context)
uprof_context_link (_clutter_uprof_context, cogl_context);
/* We make the report object up-front so we can use uprof-tool
* to fetch reports at runtime via dbus... */
clutter_uprof_report = uprof_report_new ("Clutter report");
uprof_report_add_context (clutter_uprof_report, _clutter_uprof_context);
uprof_report_set_init_fini_callbacks (clutter_uprof_report,
_clutter_uprof_report_prepare,
_clutter_uprof_report_done,
NULL);
}
void
_clutter_profile_suspend (void)
{
if (G_UNLIKELY (!searched_for_gl_uprof_context))
{
gl_uprof_context = uprof_find_context ("OpenGL");
searched_for_gl_uprof_context = TRUE;
}
if (gl_uprof_context)
uprof_context_suspend (gl_uprof_context);
/* NB: The Cogl context is linked to this so it will also be suspended... */
uprof_context_suspend (_clutter_uprof_context);
}
void
_clutter_profile_resume (void)
{
if (gl_uprof_context)
uprof_context_resume (gl_uprof_context);
/* NB: The Cogl context is linked to this so it will also be resumed... */
uprof_context_resume (_clutter_uprof_context);
}
#endif

View File

@ -1,74 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Copyright (C) 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, see <http://www.gnu.org/licenses/>.
*/
#ifndef __CLUTTER_PROFILE_H__
#define __CLUTTER_PROFILE_H__
#include <glib.h>
G_BEGIN_DECLS
typedef enum {
CLUTTER_PROFILE_PICKING_ONLY = 1 << 0,
CLUTTER_PROFILE_DISABLE_REPORT = 1 << 1
} ClutterProfileFlag;
#ifdef CLUTTER_ENABLE_PROFILE
#include <uprof.h>
extern UProfContext * _clutter_uprof_context;
extern guint clutter_profile_flags;
#define CLUTTER_STATIC_TIMER UPROF_STATIC_TIMER
#define CLUTTER_STATIC_COUNTER UPROF_STATIC_COUNTER
#define CLUTTER_COUNTER_INC UPROF_COUNTER_INC
#define CLUTTER_COUNTER_DEC UPROF_COUNTER_DEC
#define CLUTTER_TIMER_START UPROF_TIMER_START
#define CLUTTER_TIMER_STOP UPROF_TIMER_STOP
void _clutter_uprof_init (void);
void _clutter_profile_suspend (void);
void _clutter_profile_resume (void);
#else /* CLUTTER_ENABLE_PROFILE */
#ifdef __COUNTER__
#define CLUTTER_STATIC_TIMER(A,B,C,D,E) extern void G_PASTE (_clutter_dummy_decl, __COUNTER__) (void)
#define CLUTTER_STATIC_COUNTER(A,B,C,D) extern void G_PASTE (_clutter_dummy_decl, __COUNTER__) (void)
#else
#define CLUTTER_STATIC_TIMER(A,B,C,D,E) extern void G_PASTE (_clutter_dummy_decl, __LINE__) (void)
#define CLUTTER_STATIC_COUNTER(A,B,C,D) extern void G_PASTE (_clutter_dummy_decl, __LINE__) (void)
#endif
#define CLUTTER_COUNTER_INC(A,B) G_STMT_START { } G_STMT_END
#define CLUTTER_COUNTER_DEC(A,B) G_STMT_START { } G_STMT_END
#define CLUTTER_TIMER_START(A,B) G_STMT_START { } G_STMT_END
#define CLUTTER_TIMER_STOP(A,B) G_STMT_START { } G_STMT_END
#define _clutter_uprof_init G_STMT_START { } G_STMT_END
#define _clutter_profile_suspend G_STMT_START { } G_STMT_END
#define _clutter_profile_resume G_STMT_START { } G_STMT_END
#endif /* CLUTTER_ENABLE_PROFILE */
G_END_DECLS
#endif /* _CLUTTER_PROFILE_H_ */

View File

@ -71,7 +71,6 @@
#include "clutter-master-clock.h"
#include "clutter-paint-volume-private.h"
#include "clutter-private.h"
#include "clutter-profile.h"
#include "clutter-stage-manager-private.h"
#include "clutter-stage-private.h"
#include "clutter-version.h" /* For flavour */
@ -705,56 +704,6 @@ clutter_stage_paint (ClutterActor *self)
clutter_actor_paint (child);
}
#if 0
/* the Stage is cleared in clutter_actor_paint_node() */
static void
clutter_stage_paint (ClutterActor *self)
{
ClutterStagePrivate *priv = CLUTTER_STAGE (self)->priv;
CoglBufferBit clear_flags;
ClutterColor bg_color;
CoglColor stage_color;
ClutterActorIter iter;
ClutterActor *child;
guint8 real_alpha;
CLUTTER_STATIC_TIMER (stage_clear_timer,
"Painting actors", /* parent */
"Stage clear",
"The time spent clearing the stage",
0 /* no application private data */);
CLUTTER_NOTE (PAINT, "Initializing stage paint");
/* composite the opacity to the stage color */
clutter_actor_get_background_color (self, &bg_color);
real_alpha = clutter_actor_get_opacity (self)
* bg_color.alpha
/ 255;
clear_flags = COGL_BUFFER_BIT_DEPTH;
if (!STAGE_NO_CLEAR_ON_PAINT (self))
clear_flags |= COGL_BUFFER_BIT_COLOR;
CLUTTER_TIMER_START (_clutter_uprof_context, stage_clear_timer);
/* we use the real alpha to clear the stage if :use-alpha is
* set; the effect depends entirely on the Clutter backend
*/
cogl_color_init_from_4ub (&stage_color,
bg_color.red,
bg_color.green,
bg_color.blue,
priv->use_alpha ? real_alpha : 255);
cogl_color_premultiply (&stage_color);
cogl_clear (&stage_color, clear_flags);
CLUTTER_TIMER_STOP (_clutter_uprof_context, stage_clear_timer);
clutter_actor_iter_init (&iter, self);
while (clutter_actor_iter_next (&iter, &child))
clutter_actor_paint (child);
}
#endif
static void
clutter_stage_pick (ClutterActor *self,
const ClutterColor *color)
@ -1117,11 +1066,6 @@ _clutter_stage_maybe_relayout (ClutterActor *actor)
ClutterStagePrivate *priv = stage->priv;
gfloat natural_width, natural_height;
ClutterActorBox box = { 0, };
CLUTTER_STATIC_TIMER (relayout_timer,
"Mainloop", /* no parent */
"Layouting",
"The time spent reallocating the stage",
0 /* no application private data */);
if (!priv->relayout_pending)
return;
@ -1131,7 +1075,6 @@ _clutter_stage_maybe_relayout (ClutterActor *actor)
{
priv->relayout_pending = FALSE;
CLUTTER_TIMER_START (_clutter_uprof_context, relayout_timer);
CLUTTER_NOTE (ACTOR, "Recomputing layout");
CLUTTER_SET_PRIVATE_FLAGS (stage, CLUTTER_IN_RELAYOUT);
@ -1154,7 +1097,6 @@ _clutter_stage_maybe_relayout (ClutterActor *actor)
&box, CLUTTER_ALLOCATION_NONE);
CLUTTER_UNSET_PRIVATE_FLAGS (stage, CLUTTER_IN_RELAYOUT);
CLUTTER_TIMER_STOP (_clutter_uprof_context, relayout_timer);
}
}
@ -1165,16 +1107,6 @@ clutter_stage_do_redraw (ClutterStage *stage)
ClutterActor *actor = CLUTTER_ACTOR (stage);
ClutterStagePrivate *priv = stage->priv;
CLUTTER_STATIC_COUNTER (redraw_counter,
"clutter_stage_do_redraw counter",
"Increments for each Stage redraw",
0 /* no application private data */);
CLUTTER_STATIC_TIMER (redraw_timer,
"Master Clock", /* parent */
"Redrawing",
"The time spent redrawing everything",
0 /* no application private data */);
if (CLUTTER_ACTOR_IN_DESTRUCTION (stage))
return;
@ -1195,13 +1127,8 @@ clutter_stage_do_redraw (ClutterStage *stage)
_clutter_stage_maybe_setup_viewport (stage);
CLUTTER_COUNTER_INC (_clutter_uprof_context, redraw_counter);
CLUTTER_TIMER_START (_clutter_uprof_context, redraw_timer);
_clutter_stage_window_redraw (priv->impl);
CLUTTER_TIMER_STOP (_clutter_uprof_context, redraw_timer);
if (_clutter_context_get_show_fps ())
{
priv->timer_n_frames += 1;
@ -1462,31 +1389,6 @@ _clutter_stage_do_pick (ClutterStage *stage,
float stage_width, stage_height;
int window_scale;
CLUTTER_STATIC_COUNTER (do_pick_counter,
"_clutter_stage_do_pick counter",
"Increments for each full pick run",
0 /* no application private data */);
CLUTTER_STATIC_TIMER (pick_timer,
"Mainloop", /* parent */
"Picking",
"The time spent picking",
0 /* no application private data */);
CLUTTER_STATIC_TIMER (pick_clear,
"Picking", /* parent */
"Stage clear (pick)",
"The time spent clearing stage for picking",
0 /* no application private data */);
CLUTTER_STATIC_TIMER (pick_paint,
"Picking", /* parent */
"Painting actors (pick mode)",
"The time spent painting actors in pick mode",
0 /* no application private data */);
CLUTTER_STATIC_TIMER (pick_read,
"Picking", /* parent */
"Read Pixels",
"The time spent issuing a read pixels",
0 /* no application private data */);
priv = stage->priv;
if (CLUTTER_ACTOR_IN_DESTRUCTION (stage))
@ -1502,14 +1404,6 @@ _clutter_stage_do_pick (ClutterStage *stage,
if (x < 0 || x >= stage_width || y < 0 || y >= stage_height)
return actor;
#ifdef CLUTTER_ENABLE_PROFILE
if (clutter_profile_flags & CLUTTER_PROFILE_PICKING_ONLY)
_clutter_profile_resume ();
#endif /* CLUTTER_ENABLE_PROFILE */
CLUTTER_COUNTER_INC (_clutter_uprof_context, do_pick_counter);
CLUTTER_TIMER_START (_clutter_uprof_context, pick_timer);
context = _clutter_context_get_default ();
clutter_stage_ensure_current (stage);
window_scale = _clutter_stage_window_get_scale_factor (priv->impl);
@ -1536,10 +1430,8 @@ _clutter_stage_do_pick (ClutterStage *stage,
CLUTTER_NOTE (PICK, "Performing pick at %i,%i", x, y);
CLUTTER_TIMER_START (_clutter_uprof_context, pick_clear);
cogl_color_init_from_4ub (&stage_pick_id, 255, 255, 255, 255);
cogl_clear (&stage_pick_id, COGL_BUFFER_BIT_COLOR | COGL_BUFFER_BIT_DEPTH);
CLUTTER_TIMER_STOP (_clutter_uprof_context, pick_clear);
/* Disable dithering (if any) when doing the painting in pick mode */
dither_enabled_save = cogl_framebuffer_get_dither_enabled (fb);
@ -1548,11 +1440,9 @@ _clutter_stage_do_pick (ClutterStage *stage,
/* Render the entire scence in pick mode - just single colored silhouette's
* are drawn offscreen (as we never swap buffers)
*/
CLUTTER_TIMER_START (_clutter_uprof_context, pick_paint);
context->pick_mode = mode;
_clutter_stage_do_paint (stage, NULL);
context->pick_mode = CLUTTER_PICK_NONE;
CLUTTER_TIMER_STOP (_clutter_uprof_context, pick_paint);
/* Read the color of the screen co-ords pixel. RGBA_8888_PRE is used
even though we don't care about the alpha component because under
@ -1561,12 +1451,10 @@ _clutter_stage_do_pick (ClutterStage *stage,
used. The format is requested as pre-multiplied because Cogl
assumes that all pixels in the framebuffer are premultiplied so
it avoids a conversion. */
CLUTTER_TIMER_START (_clutter_uprof_context, pick_read);
cogl_read_pixels (read_x, read_y, 1, 1,
COGL_READ_PIXELS_COLOR_BUFFER,
COGL_PIXEL_FORMAT_RGBA_8888_PRE,
pixel);
CLUTTER_TIMER_STOP (_clutter_uprof_context, pick_read);
if (G_UNLIKELY (clutter_pick_debug_flags & CLUTTER_DEBUG_DUMP_PICK_BUFFERS))
{
@ -1597,13 +1485,6 @@ _clutter_stage_do_pick (ClutterStage *stage,
retval = _clutter_stage_get_actor_by_pick_id (stage, id_);
}
CLUTTER_TIMER_STOP (_clutter_uprof_context, pick_timer);
#ifdef CLUTTER_ENABLE_PROFILE
if (clutter_profile_flags & CLUTTER_PROFILE_PICKING_ONLY)
_clutter_profile_suspend ();
#endif
return retval;
}

View File

@ -58,7 +58,6 @@
#include "clutter-main.h"
#include "clutter-marshal.h"
#include "clutter-private.h" /* includes <cogl-pango/cogl-pango.h> */
#include "clutter-profile.h"
#include "clutter-property-transition.h"
#include "clutter-text-buffer.h"
#include "clutter-units.h"
@ -488,14 +487,6 @@ clutter_text_create_layout_no_cache (ClutterText *text,
gchar *contents;
gsize contents_len;
CLUTTER_STATIC_TIMER (text_layout_timer,
"Mainloop",
"Text Layout",
"Layout creation",
0);
CLUTTER_TIMER_START (_clutter_uprof_context, text_layout_timer);
layout = clutter_actor_create_pango_layout (CLUTTER_ACTOR (text), NULL);
pango_layout_set_font_description (layout, priv->font_desc);
@ -581,8 +572,6 @@ clutter_text_create_layout_no_cache (ClutterText *text,
g_free (contents);
CLUTTER_TIMER_STOP (_clutter_uprof_context, text_layout_timer);
return layout;
}
@ -716,15 +705,6 @@ clutter_text_create_layout (ClutterText *text,
PangoEllipsizeMode ellipsize = PANGO_ELLIPSIZE_NONE;
int i;
CLUTTER_STATIC_COUNTER (text_cache_hit_counter,
"Text layout cache hit counter",
"Increments for each layout cache hit",
0);
CLUTTER_STATIC_COUNTER (text_cache_miss_counter,
"Text layout cache miss counter",
"Increments for each layout cache miss",
0);
/* First determine the width, height, and ellipsize mode that
* we need for the layout. The ellipsize mode depends on
* allocation_width/allocation_size as follows:
@ -819,9 +799,6 @@ clutter_text_create_layout (ClutterText *text,
allocation_width,
allocation_height);
CLUTTER_COUNTER_INC (_clutter_uprof_context,
text_cache_hit_counter);
return priv->cached_layouts[i].layout;
}
@ -853,9 +830,6 @@ clutter_text_create_layout (ClutterText *text,
allocation_width,
allocation_height);
CLUTTER_COUNTER_INC (_clutter_uprof_context,
text_cache_hit_counter);
return priv->cached_layouts[i].layout;
}
}
@ -873,8 +847,6 @@ clutter_text_create_layout (ClutterText *text,
allocation_width,
allocation_height);
CLUTTER_COUNTER_INC (_clutter_uprof_context, text_cache_miss_counter);
/* If we make it here then we didn't have a cached version so we
need to recreate the layout */
if (oldest_cache->layout)

View File

@ -44,7 +44,6 @@
#include "clutter-feature.h"
#include "clutter-main.h"
#include "clutter-private.h"
#include "clutter-profile.h"
#include "clutter-stage-private.h"
static void clutter_stage_window_iface_init (ClutterStageWindowIface *iface);
@ -409,29 +408,11 @@ clutter_stage_cogl_redraw (ClutterStageWindow *stage_window)
gboolean force_swap;
int window_scale;
CLUTTER_STATIC_TIMER (painting_timer,
"Redrawing", /* parent */
"Painting actors",
"The time spent painting actors",
0 /* no application private data */);
CLUTTER_STATIC_TIMER (swapbuffers_timer,
"Redrawing", /* parent */
"SwapBuffers",
"The time spent blocked by SwapBuffers",
0 /* no application private data */);
CLUTTER_STATIC_TIMER (blit_sub_buffer_timer,
"Redrawing", /* parent */
"blit_sub_buffer",
"The time spent in blit_sub_buffer",
0 /* no application private data */);
wrapper = CLUTTER_ACTOR (stage_cogl->wrapper);
if (!stage_cogl->onscreen)
return;
CLUTTER_TIMER_START (_clutter_uprof_context, painting_timer);
can_blit_sub_buffer =
cogl_clutter_winsys_has_feature (COGL_WINSYS_FEATURE_SWAP_REGION);
@ -610,8 +591,6 @@ clutter_stage_cogl_redraw (ClutterStageWindow *stage_window)
cogl_object_unref (prim);
}
CLUTTER_TIMER_STOP (_clutter_uprof_context, painting_timer);
/* push on the screen */
if (use_clipped_redraw && !force_swap)
{
@ -640,11 +619,7 @@ clutter_stage_cogl_redraw (ClutterStageWindow *stage_window)
copy_area[0], copy_area[1], copy_area[2], copy_area[3]);
CLUTTER_TIMER_START (_clutter_uprof_context, blit_sub_buffer_timer);
cogl_onscreen_swap_region (stage_cogl->onscreen, copy_area, 1);
CLUTTER_TIMER_STOP (_clutter_uprof_context, blit_sub_buffer_timer);
}
else
{
@ -657,9 +632,7 @@ clutter_stage_cogl_redraw (ClutterStageWindow *stage_window)
if (clutter_feature_available (CLUTTER_FEATURE_SWAP_EVENTS))
stage_cogl->pending_swaps++;
CLUTTER_TIMER_START (_clutter_uprof_context, swapbuffers_timer);
cogl_onscreen_swap_buffers (stage_cogl->onscreen);
CLUTTER_TIMER_STOP (_clutter_uprof_context, swapbuffers_timer);
}
/* reset the redraw clipping for the next paint... */

View File

@ -40,7 +40,6 @@
#include "clutter-stage-gdk.h"
#include "clutter-debug.h"
#include "clutter-private.h"
#include "clutter-profile.h"
#include "clutter-stage-manager-private.h"
#include "clutter-stage-private.h"
@ -139,19 +138,9 @@ master_clock_process_stage_events (ClutterMasterClockGdk *master_clock,
gint64 start = g_get_monotonic_time ();
#endif
CLUTTER_STATIC_TIMER (master_event_process,
"Master Clock",
"Event Processing",
"The time spent processing events on all stages",
0);
CLUTTER_TIMER_START (_clutter_uprof_context, master_event_process);
/* Process queued events */
_clutter_stage_process_queued_events (stage);
CLUTTER_TIMER_STOP (_clutter_uprof_context, master_event_process);
#ifdef CLUTTER_ENABLE_DEBUG
if (_clutter_diagnostic_enabled ())
clutter_warn_if_over_budget (master_clock, start, "Event processing");
@ -176,12 +165,6 @@ master_clock_advance_timelines (ClutterMasterClockGdk *master_clock)
gint64 start = g_get_monotonic_time ();
#endif
CLUTTER_STATIC_TIMER (master_timeline_advance,
"Master Clock",
"Timelines Advancement",
"The time spent advancing all timelines",
0);
/* we protect ourselves from timelines being removed during
* the advancement by other timelines by copying the list of
* timelines, taking a reference on them, iterating over the
@ -205,13 +188,9 @@ master_clock_advance_timelines (ClutterMasterClockGdk *master_clock)
timelines = g_slist_copy (master_clock->timelines);
g_slist_foreach (timelines, (GFunc) g_object_ref, NULL);
CLUTTER_TIMER_START (_clutter_uprof_context, master_timeline_advance);
for (l = timelines; l != NULL; l = l->next)
_clutter_timeline_do_tick (l->data, master_clock->cur_tick / 1000);
CLUTTER_TIMER_STOP (_clutter_uprof_context, master_timeline_advance);
g_slist_foreach (timelines, (GFunc) g_object_unref, NULL);
g_slist_free (timelines);
@ -257,14 +236,6 @@ clutter_master_clock_gdk_update (GdkFrameClock *frame_clock,
{
ClutterStage *stage;
CLUTTER_STATIC_TIMER (master_dispatch_timer,
"Mainloop",
"Master Clock",
"Master clock dispatch",
0);
CLUTTER_TIMER_START (_clutter_uprof_context, master_dispatch_timer);
CLUTTER_NOTE (SCHEDULER, "Master clock [tick]");
_clutter_threads_acquire_lock ();
@ -301,8 +272,6 @@ clutter_master_clock_gdk_update (GdkFrameClock *frame_clock,
master_clock->prev_tick = master_clock->cur_tick;
_clutter_threads_release_lock ();
CLUTTER_TIMER_STOP (_clutter_uprof_context, master_dispatch_timer);
}
static void

View File

@ -143,7 +143,6 @@ m4_define([atk_req_version], [2.5.3])
m4_define([cairo_req_version], [1.14.0])
m4_define([pango_req_version], [1.30])
m4_define([gi_req_version], [1.39.0])
m4_define([uprof_req_version], [0.3])
m4_define([gtk_doc_req_version], [1.20])
m4_define([xcomposite_req_version], [0.4])
m4_define([gdk_req_version], [3.3.18])
@ -157,7 +156,6 @@ AC_SUBST([ATK_REQ_VERSION], [atk_req_version])
AC_SUBST([CAIRO_REQ_VERSION], [cairo_req_version])
AC_SUBST([PANGO_REQ_VERSION], [pango_req_version])
AC_SUBST([GI_REQ_VERSION], [gi_req_version])
AC_SUBST([UPROF_REQ_VERSION], [uprof_req_version])
AC_SUBST([GTK_DOC_REQ_VERSION], [gtk_doc_req_version])
AC_SUBST([XCOMPOSITE_REQ_VERSION], [xcomposite_req_version])
AC_SUBST([GDK_REQ_VERSION], [gdk_req_version])
@ -930,44 +928,6 @@ AS_CASE([$enable_deprecated],
AC_SUBST([CLUTTER_DEPRECATED_CFLAGS])
dnl === Profiling =============================================================
m4_define([profile_default], [no])
AC_ARG_ENABLE(profile,
AS_HELP_STRING([--enable-profile=@<:@no/yes@:>@],
[Turn on profiling support. yes; All profiling probe points are compiled in and may be runtime enabled. no; No profiling support will built into clutter. @<:@default=no@:>@]),
[],
[enable_profile=profile_default])
AS_CASE([$enable_profile],
[yes],
[
AS_IF([test "x$GCC" = "xyes"],
[
PKG_CHECK_MODULES([PROFILE_DEP], [uprof-0.3])
CLUTTER_PROFILE_CFLAGS="-DCLUTTER_ENABLE_PROFILE $PROFILE_DEP_CFLAGS"
CLUTTER_PROFILE_LDFLAGS="$PROFILE_DEP_LIBS"
AS_IF([test "x$enable_debug" = "xyes"], [CLUTTER_PROFILE_CFLAGS+=" -DUPROF_DEBUG"])
],
[
AC_MSG_ERROR([--enable-profile is currently only supported if using GCC])
])
],
[no],
[
CLUTTER_PROFILE_CFLAGS=""
CLUTTER_PROFILE_LDFLAGS=""
],
[*], [AC_MSG_ERROR([Invalid value for --enable-profile])]
)
AM_CONDITIONAL(PROFILE, test "x$enable_profile" != "xno")
AC_SUBST(CLUTTER_PROFILE_CFLAGS)
AC_SUBST(CLUTTER_PROFILE_LDFLAGS)
dnl === Enable strict compiler flags ==========================================
# use strict compiler flags only when building from git; the rules for
@ -1043,8 +1003,8 @@ AS_IF([test "x$CLUTTER_BASE_PC_FILES_PRIVATE" = "x" && test "x$BACKEND_PC_FILES_
AC_SUBST(CLUTTER_REQUIRES)
AC_SUBST(CLUTTER_REQUIRES_PRIVATE)
CLUTTER_CFLAGS="$FLAVOUR_CFLAGS $CLUTTER_DEPS_CFLAGS $CLUTTER_DEPS_PRIVATE_CFLAGS $CLUTTER_PROFILE_CFLAGS $GLIB_CFLAGS"
CLUTTER_LIBS="$FLAVOUR_LIBS $CLUTTER_DEPS_LIBS $CLUTTER_DEPS_PRIVATE_LIBS $CLUTTER_PROFILE_LDFLAGS $GLIB_LIBS"
CLUTTER_CFLAGS="$FLAVOUR_CFLAGS $CLUTTER_DEPS_CFLAGS $CLUTTER_DEPS_PRIVATE_CFLAGS $GLIB_CFLAGS"
CLUTTER_LIBS="$FLAVOUR_LIBS $CLUTTER_DEPS_LIBS $CLUTTER_DEPS_PRIVATE_LIBS $GLIB_LIBS"
AC_SUBST(CLUTTER_CFLAGS)
AC_SUBST(CLUTTER_LIBS)
@ -1272,7 +1232,6 @@ echo ""
echo " • Compiler options:"
echo " Clutter debug level: ${enable_debug}"
echo " Compiler flags: ${CFLAGS} ${MAINTAINER_CFLAGS}"
echo " Profiling enabled: ${enable_profile}"
echo " Enable coverage tests: ${use_gcov}"
echo " Enable deprecated symbols: ${enable_deprecated}"

View File

@ -93,7 +93,6 @@ IGNORE_HFILES = \
clutter-paint-node-private.h \
clutter-paint-volume-private.h \
clutter-private.h \
clutter-profile.h \
clutter-script-private.h \
clutter-settings-private.h \
clutter-stage-manager-private.h \

View File

@ -9,8 +9,7 @@ AM_CPPFLAGS = \
-I$(top_builddir) \
-DCOGL_DISABLE_DEPRECATION_WARNINGS \
$(CLUTTER_DEPRECATED_CFLAGS) \
$(CLUTTER_DEBUG_CFLAGS) \
$(CLUTTER_PROFILE_CFLAGS)
$(CLUTTER_DEBUG_CFLAGS)
# Basic actor API
actor_tests = \