[gnome-software] Add some profiling to show AppStream loading
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] Add some profiling to show AppStream loading
- Date: Wed, 2 Oct 2013 08:55:06 +0000 (UTC)
commit 467166700ab21a1550aa0f0980631356619bd329
Author: Richard Hughes <richard hughsie com>
Date: Wed Oct 2 09:52:09 2013 +0100
Add some profiling to show AppStream loading
We do several things with the AppStream info at startup, and they all look like
they take a long time. In reality it's three threads all waiting for the XML to
be parsed, and the requests only take a very small time indeed.
src/gs-plugin-loader.c | 2 ++
src/plugins/gs-plugin-appstream.c | 8 ++++++++
2 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/src/gs-plugin-loader.c b/src/gs-plugin-loader.c
index c3fb460..6a48677 100644
--- a/src/gs-plugin-loader.c
+++ b/src/gs-plugin-loader.c
@@ -2044,6 +2044,7 @@ gs_plugin_loader_setup (GsPluginLoader *plugin_loader, GError **error)
g_return_val_if_fail (plugin_loader->priv->location != NULL, FALSE);
/* search in the plugin directory for plugins */
+ gs_profile_start (plugin_loader->priv->profile, "GsPlugin::setup");
dir = g_dir_open (plugin_loader->priv->location, 0, error);
if (dir == NULL) {
ret = FALSE;
@@ -2072,6 +2073,7 @@ gs_plugin_loader_setup (GsPluginLoader *plugin_loader, GError **error)
/* run the plugins */
gs_plugin_loader_run (plugin_loader, "gs_plugin_initialize");
out:
+ gs_profile_stop (plugin_loader->priv->profile, "GsPlugin::setup");
if (dir != NULL)
g_dir_close (dir);
return ret;
diff --git a/src/plugins/gs-plugin-appstream.c b/src/plugins/gs-plugin-appstream.c
index 1709909..b51c5c8 100644
--- a/src/plugins/gs-plugin-appstream.c
+++ b/src/plugins/gs-plugin-appstream.c
@@ -247,6 +247,7 @@ gs_plugin_startup (GsPlugin *plugin, GError **error)
guint size;
/* Parse the XML */
+ gs_profile_start (plugin->profile, "appstream::startup");
ret = gs_plugin_parse_xml (plugin, error);
if (!ret)
goto out;
@@ -260,6 +261,7 @@ gs_plugin_startup (GsPlugin *plugin, GError **error)
goto out;
}
out:
+ gs_profile_stop (plugin->profile, "appstream::startup");
return ret;
}
@@ -493,6 +495,7 @@ gs_plugin_refine (GsPlugin *plugin,
goto out;
}
+ gs_profile_start_full (plugin->profile, "appstream::refine");
for (l = list; l != NULL; l = l->next) {
app = GS_APP (l->data);
ret = gs_plugin_refine_from_id (plugin, app, error);
@@ -502,6 +505,7 @@ gs_plugin_refine (GsPlugin *plugin,
if (!ret)
goto out;
}
+ gs_profile_stop_full (plugin->profile, "appstream::refine");
/* sucess */
ret = TRUE;
@@ -537,6 +541,7 @@ gs_plugin_add_category_apps (GsPlugin *plugin,
}
/* get the two search terms */
+ gs_profile_start_full (plugin->profile, "appstream::add-category-apps");
search_id1 = gs_category_get_id (category);
parent = gs_category_get_parent (category);
if (parent != NULL)
@@ -566,6 +571,7 @@ gs_plugin_add_category_apps (GsPlugin *plugin,
goto out;
gs_plugin_add_app (list, app);
}
+ gs_profile_stop_full (plugin->profile, "appstream::add-category-apps");
out:
return ret;
}
@@ -640,6 +646,7 @@ gs_plugin_add_categories (GsPlugin *plugin,
}
/* find out how many packages are in each category */
+ gs_profile_start_full (plugin->profile, "appstream::add-categories");
for (l = *list; l != NULL; l = l->next) {
parent = GS_CATEGORY (l->data);
children = gs_category_get_subcategories (parent);
@@ -672,6 +679,7 @@ gs_plugin_add_categories (GsPlugin *plugin,
}
g_list_free (children);
}
+ gs_profile_stop_full (plugin->profile, "appstream::add-categories");
out:
return ret;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]