[gnome-software] trivial: Add some more profiling to the flatpak plugin



commit 6f6708e8e2a234642095ac1a296126974d64284c
Author: Richard Hughes <richard hughsie com>
Date:   Wed Sep 28 09:41:31 2016 +0100

    trivial: Add some more profiling to the flatpak plugin

 src/plugins/gs-flatpak.c |   45 ++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 38 insertions(+), 7 deletions(-)
---
diff --git a/src/plugins/gs-flatpak.c b/src/plugins/gs-flatpak.c
index ccf0f5b..17e0307 100644
--- a/src/plugins/gs-flatpak.c
+++ b/src/plugins/gs-flatpak.c
@@ -301,8 +301,14 @@ gs_flatpak_rescan_appstream_store (GsFlatpak *self,
                                   GError **error)
 {
        guint i;
+       g_autoptr(AsProfileTask) ptask = NULL;
        g_autoptr(GPtrArray) xremotes = NULL;
 
+       /* profile */
+       ptask = as_profile_start_literal (gs_plugin_get_profile (self->plugin),
+                                         "flatpak::rescan-appstream");
+       g_assert (ptask != NULL);
+
        /* remove all components */
        as_store_remove_all (self->store);
 
@@ -382,6 +388,25 @@ gs_flatpak_setup (GsFlatpak *self, GCancellable *cancellable, GError **error)
 }
 
 static gboolean
+gs_flatpak_refresh_appstream_remote (GsFlatpak *self,
+                                    const gchar *remote_name,
+                                    GCancellable *cancellable,
+                                    GError **error)
+{
+       g_autoptr(AsProfileTask) ptask = NULL;
+       ptask = as_profile_start (gs_plugin_get_profile (self->plugin),
+                                 "flatpak::refresh-appstream{%s}",
+                                 remote_name);
+       g_assert (ptask != NULL);
+       return flatpak_installation_update_appstream_sync (self->installation,
+                                                          remote_name,
+                                                          NULL, /* arch */
+                                                          NULL, /* out_changed */
+                                                          cancellable,
+                                                          error);
+}
+
+static gboolean
 gs_flatpak_refresh_appstream (GsFlatpak *self, guint cache_age,
                              GsPluginRefreshFlags flags,
                              GCancellable *cancellable, GError **error)
@@ -389,9 +414,17 @@ gs_flatpak_refresh_appstream (GsFlatpak *self, guint cache_age,
        gboolean ret;
        gboolean something_changed = FALSE;
        guint i;
+       g_autoptr(AsProfileTask) ptask = NULL;
        g_autoptr(GPtrArray) xremotes = NULL;
 
-       xremotes = flatpak_installation_list_remotes (self->installation, cancellable,
+       /* profile */
+       ptask = as_profile_start_literal (gs_plugin_get_profile (self->plugin),
+                                         "flatpak::refresh-appstream");
+       g_assert (ptask != NULL);
+
+       /* get remotes */
+       xremotes = flatpak_installation_list_remotes (self->installation,
+                                                     cancellable,
                                                      error);
        if (xremotes == NULL) {
                gs_plugin_flatpak_error_convert (error);
@@ -430,12 +463,10 @@ gs_flatpak_refresh_appstream (GsFlatpak *self, guint cache_age,
                /* download new data */
                g_debug ("%s is %u seconds old, so downloading new data",
                         remote_name, tmp);
-               ret = flatpak_installation_update_appstream_sync (self->installation,
-                                                                 remote_name,
-                                                                 NULL, /* arch */
-                                                                 NULL, /* out_changed */
-                                                                 cancellable,
-                                                                 &error_local);
+               ret = gs_flatpak_refresh_appstream_remote (self,
+                                                          remote_name,
+                                                          cancellable,
+                                                          &error_local);
                if (!ret) {
                        if (g_error_matches (error_local,
                                             G_IO_ERROR,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]