gnome-settings-daemon r228 - in trunk: . gnome-settings-daemon
- From: mccann svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-settings-daemon r228 - in trunk: . gnome-settings-daemon
- Date: Mon, 24 Mar 2008 17:24:49 +0000 (GMT)
Author: mccann
Date: Mon Mar 24 17:24:49 2008
New Revision: 228
URL: http://svn.gnome.org/viewvc/gnome-settings-daemon?rev=228&view=rev
Log:
2008-03-24 William Jon McCann <jmccann redhat com>
* configure.ac:
* gnome-settings-daemon/Makefile.am:
* gnome-settings-daemon/gnome-settings-manager.c: (_load_file),
(_load_dir), (_load_all), (gnome_settings_manager_start):
* gnome-settings-daemon/gnome-settings-plugin-info.c:
(gnome_settings_plugin_info_fill_from_file), (load_plugin_module),
(_activate_plugin):
* gnome-settings-daemon/main.c: (bus_register), (main):
Add some profiling code. Must specify --enable-profiling to
configure.
Can now be profiled like so:
strace -ttt -f -o /tmp/logfile.strace gnome-settings-daemon
python plot-timeline.py -o prettygraph.png /tmp/logfile.strace
See: http://www.gnome.org/~federico/news-2006-03.html#09
Modified:
trunk/ChangeLog
trunk/configure.ac
trunk/gnome-settings-daemon/Makefile.am
trunk/gnome-settings-daemon/gnome-settings-manager.c
trunk/gnome-settings-daemon/gnome-settings-plugin-info.c
trunk/gnome-settings-daemon/main.c
Modified: trunk/configure.ac
==============================================================================
--- trunk/configure.ac (original)
+++ trunk/configure.ac Mon Mar 24 17:24:49 2008
@@ -315,6 +315,19 @@
AM_CONDITIONAL(HAVE_ALSA, test x"$have_alsa" = "xyes")
+
+# ---------------------------------------------------------------------------
+# Enable Profiling
+# ---------------------------------------------------------------------------
+AC_ARG_ENABLE(profiling,
+ [AC_HELP_STRING([--enable-profiling],
+ [turn on profiling])],
+ , enable_profiling=yes)
+if test "$enable_profiling" = "yes"; then
+ AC_DEFINE(ENABLE_PROFILING,1,[enable profiling])
+fi
+
+
# ---------------------------------------------------------------------------
# Plugins
# ---------------------------------------------------------------------------
Modified: trunk/gnome-settings-daemon/Makefile.am
==============================================================================
--- trunk/gnome-settings-daemon/Makefile.am (original)
+++ trunk/gnome-settings-daemon/Makefile.am Mon Mar 24 17:24:49 2008
@@ -1,3 +1,5 @@
+NULL =
+
INCLUDES = \
-DDATADIR=\""$(datadir)"\" \
-DGNOME_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \
@@ -5,7 +7,8 @@
-DGNOME_SETTINGS_PLUGINDIR=\""$(plugindir)"\" \
$(WARN_CFLAGS) \
$(DISABLE_DEPRECATED_CFLAGS) \
- $(SETTINGS_DAEMON_CFLAGS)
+ $(SETTINGS_DAEMON_CFLAGS) \
+ $(NULL)
gsddir = $(libexecdir)
@@ -20,7 +23,8 @@
BUILT_SOURCES = \
gnome-settings-manager-glue.h \
- gnome-settings-client.h
+ gnome-settings-client.h \
+ $(NULL)
Dbusapidir = $(includedir)/gnome-settings-daemon-2.0/gnome-settings-daemon
Dbusapi_DATA = gnome-settings-client.h
@@ -34,7 +38,10 @@
gnome-settings-plugin-info.c \
gnome-settings-plugin-info.h \
gnome-settings-module.c \
- gnome-settings-module.h
+ gnome-settings-module.h \
+ gnome-settings-profile.c \
+ gnome-settings-profile.h \
+ $(NULL)
gnome_settings_daemon_CPPFLAGS = \
$(AM_CPPFLAGS)
@@ -50,10 +57,12 @@
EXTRA_DIST = \
$(Dbusapi_DATA) \
- gnome-settings-manager.xml
+ gnome-settings-manager.xml \
+ $(NULL)
CLEANFILES = \
- $(BUILT_SOURCES)
+ $(BUILT_SOURCES) \
+ $(NULL)
# vim: ts=8
Modified: trunk/gnome-settings-daemon/gnome-settings-manager.c
==============================================================================
--- trunk/gnome-settings-daemon/gnome-settings-manager.c (original)
+++ trunk/gnome-settings-daemon/gnome-settings-manager.c Mon Mar 24 17:24:49 2008
@@ -36,6 +36,7 @@
#include "gnome-settings-plugin-info.h"
#include "gnome-settings-manager.h"
#include "gnome-settings-manager-glue.h"
+#include "gnome-settings-profile.h"
#define GSD_MANAGER_DBUS_PATH "/org/gnome/SettingsDaemon"
@@ -155,19 +156,23 @@
GConfClient *client;
int priority;
GError *error;
+ GSList *l;
g_debug ("Loading plugin: %s", filename);
+ gnome_settings_profile_start (NULL);
info = gnome_settings_plugin_info_new_from_file (filename);
if (info == NULL) {
- return;
+ goto out;
}
- if (g_slist_find_custom (manager->priv->plugins,
+ gnome_settings_profile_start ("seeing if already loaded");
+ l = g_slist_find_custom (manager->priv->plugins,
info,
- (GCompareFunc) compare_location)) {
- g_object_unref (info);
- return;
+ (GCompareFunc) compare_location);
+ gnome_settings_profile_end ("seeing if already loaded");
+ if (l != NULL) {
+ goto out;
}
/* list takes ownership of ref */
@@ -178,12 +183,15 @@
g_signal_connect (info, "deactivated",
G_CALLBACK (on_plugin_deactivated), manager);
+ gnome_settings_profile_start ("setting active property");
key_name = g_strdup_printf ("%s/%s/active",
manager->priv->settings_prefix,
gnome_settings_plugin_info_get_location (info));
gnome_settings_plugin_info_set_enabled_key_name (info, key_name);
g_free (key_name);
+ gnome_settings_profile_end ("setting active property");
+ gnome_settings_profile_start ("setting priority property");
key_name = g_strdup_printf ("%s/%s/priority",
manager->priv->settings_prefix,
gnome_settings_plugin_info_get_location (info));
@@ -197,9 +205,16 @@
} else {
g_error_free (error);
}
- g_object_unref (client);
g_free (key_name);
+ g_object_unref (client);
+ gnome_settings_profile_end ("setting priority property");
+
+ out:
+ if (info != NULL) {
+ g_object_unref (info);
+ }
+ gnome_settings_profile_end (NULL);
}
static void
@@ -211,6 +226,7 @@
const char *name;
g_debug ("Loading settings plugins from dir: %s", path);
+ gnome_settings_profile_start (NULL);
error = NULL;
d = g_dir_open (path, 0, &error);
@@ -234,16 +250,21 @@
}
g_dir_close (d);
+
+ gnome_settings_profile_end (NULL);
}
static void
_load_all (GnomeSettingsManager *manager)
{
+ gnome_settings_profile_start (NULL);
+
/* load system plugins */
_load_dir (manager, GNOME_SETTINGS_PLUGINDIR G_DIR_SEPARATOR_S);
manager->priv->plugins = g_slist_sort (manager->priv->plugins, (GCompareFunc) compare_priority);
g_slist_foreach (manager->priv->plugins, (GFunc) maybe_activate_plugin, NULL);
+ gnome_settings_profile_end (NULL);
}
static void
@@ -294,6 +315,8 @@
{
g_debug ("Starting settings manager");
+ gnome_settings_profile_start (NULL);
+
if (!g_module_supported ()) {
g_warning ("gnome-settings-daemon is not able to initialize the plugins.");
g_set_error (error,
@@ -306,6 +329,8 @@
_load_all (manager);
+ gnome_settings_profile_end (NULL);
+
return TRUE;
}
Modified: trunk/gnome-settings-daemon/gnome-settings-plugin-info.c
==============================================================================
--- trunk/gnome-settings-daemon/gnome-settings-plugin-info.c (original)
+++ trunk/gnome-settings-daemon/gnome-settings-plugin-info.c Mon Mar 24 17:24:49 2008
@@ -30,6 +30,7 @@
#include "gnome-settings-plugin-info.h"
#include "gnome-settings-module.h"
#include "gnome-settings-plugin.h"
+#include "gnome-settings-profile.h"
#define GNOME_SETTINGS_PLUGIN_INFO_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GNOME_TYPE_SETTINGS_PLUGIN_INFO, GnomeSettingsPluginInfoPrivate))
@@ -175,6 +176,8 @@
int priority;
gboolean ret;
+ gnome_settings_profile_start (NULL);
+
ret = FALSE;
info->priv->file = g_strdup (filename);
@@ -275,6 +278,8 @@
ret = TRUE;
out:
+ gnome_settings_profile_end (NULL);
+
return ret;
}
@@ -359,8 +364,11 @@
static gboolean
load_plugin_module (GnomeSettingsPluginInfo *info)
{
- char *path;
- char *dirname;
+ char *path;
+ char *dirname;
+ gboolean ret;
+
+ ret = FALSE;
g_return_val_if_fail (info != NULL, FALSE);
g_return_val_if_fail (info->priv->file != NULL, FALSE);
@@ -368,6 +376,8 @@
g_return_val_if_fail (info->priv->plugin == NULL, FALSE);
g_return_val_if_fail (info->priv->available, FALSE);
+ gnome_settings_profile_start (NULL);
+
switch (info->priv->loader) {
case GNOME_SETTINGS_PLUGIN_LOADER_C:
dirname = g_path_get_dirname (info->priv->file);
@@ -395,7 +405,7 @@
"was not able to initialize the Python interpreter.",
info->priv->name);
- return FALSE;
+ goto out;
}
dir = g_path_get_dirname (info->priv->file);
@@ -439,7 +449,7 @@
/* Mark plugin as unavailable and fails */
info->priv->available = FALSE;
- return FALSE;
+ goto out;
}
switch (info->priv->loader) {
@@ -460,8 +470,10 @@
}
g_type_module_unuse (info->priv->module);
-
- return TRUE;
+ ret = TRUE;
+ out:
+ gnome_settings_profile_end (NULL);
+ return ret;
}
static gboolean
@@ -474,8 +486,9 @@
return FALSE;
}
- if (info->priv->plugin == NULL)
+ if (info->priv->plugin == NULL) {
res = load_plugin_module (info);
+ }
if (res) {
gnome_settings_plugin_activate (info->priv->plugin);
Modified: trunk/gnome-settings-daemon/main.c
==============================================================================
--- trunk/gnome-settings-daemon/main.c (original)
+++ trunk/gnome-settings-daemon/main.c Mon Mar 24 17:24:49 2008
@@ -34,6 +34,7 @@
#include <dbus/dbus-glib-lowlevel.h>
#include "gnome-settings-manager.h"
+#include "gnome-settings-profile.h"
#define GSD_DBUS_NAME "org.gnome.SettingsDaemon"
@@ -139,6 +140,8 @@
DBusGProxy *bus_proxy;
gboolean ret;
+ gnome_settings_profile_start (NULL);
+
ret = FALSE;
bus = get_session_bus ();
@@ -163,6 +166,8 @@
ret = TRUE;
out:
+ gnome_settings_profile_end (NULL);
+
return ret;
}
@@ -224,14 +229,18 @@
goto out;
}
+ gnome_settings_profile_start ("gnome_program_init");
program = gnome_program_init (PACKAGE,
VERSION,
LIBGNOME_MODULE,
argc,
argv,
GNOME_PARAM_NONE);
+ gnome_settings_profile_end ("gnome_program_init");
+ gnome_settings_profile_start ("gnome_settings_manager_new");
manager = gnome_settings_manager_new ();
+ gnome_settings_profile_end ("gnome_settings_manager_new");
if (manager == NULL) {
g_warning ("Unable to register object");
goto out;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]