[gnome-builder/wip/chergert/sysprof-3: 15/18] sysprof: port to sysprof-3 ABI



commit acab9a8e82bfe77158ab20aff229fabe3727c756
Author: Christian Hergert <chergert redhat com>
Date:   Wed May 8 12:13:50 2019 -0700

    sysprof: port to sysprof-3 ABI

 src/plugins/sysprof/gbp-sysprof-surface.c         | 86 +++++++++++------------
 src/plugins/sysprof/gbp-sysprof-surface.h         |  8 +--
 src/plugins/sysprof/gbp-sysprof-surface.ui        | 12 ++--
 src/plugins/sysprof/gbp-sysprof-workspace-addin.c | 70 +++++++++---------
 src/plugins/sysprof/sysprof-plugin.c              |  2 +-
 5 files changed, 89 insertions(+), 89 deletions(-)
---
diff --git a/src/plugins/sysprof/gbp-sysprof-surface.c b/src/plugins/sysprof/gbp-sysprof-surface.c
index 0f08e38c2..65ffac8ed 100644
--- a/src/plugins/sysprof/gbp-sysprof-surface.c
+++ b/src/plugins/sysprof/gbp-sysprof-surface.c
@@ -30,16 +30,16 @@ struct _GbpSysprofSurface
 {
   IdeSurface            parent_instance;
 
-  SpCaptureReader      *reader;
+  SysprofCaptureReader      *reader;
 
   GtkStack             *stack;
-  SpCallgraphView      *callgraph_view;
+  SysprofCallgraphView      *callgraph_view;
   GtkLabel             *info_bar_label;
   GtkButton            *info_bar_close;
   GtkRevealer          *info_bar_revealer;
-  SpVisualizerView     *visualizers;
-  SpRecordingStateView *recording_view;
-  SpZoomManager        *zoom_manager;
+  SysprofVisualizerView     *visualizers;
+  SysprofRecordingStateView *recording_view;
+  SysprofZoomManager        *zoom_manager;
 };
 
 static void gbp_sysprof_surface_reload (GbpSysprofSurface *self);
@@ -57,10 +57,10 @@ hide_info_bar (GbpSysprofSurface *self,
 
 static void
 gbp_sysprof_surface_selection_changed (GbpSysprofSurface *self,
-                                           SpSelection           *selection)
+                                           SysprofSelection           *selection)
 {
   g_assert (GBP_IS_SYSPROF_SURFACE (self));
-  g_assert (SP_IS_SELECTION (selection));
+  g_assert (SYSPROF_IS_SELECTION (selection));
 
   gbp_sysprof_surface_reload (self);
 }
@@ -70,7 +70,7 @@ gbp_sysprof_surface_finalize (GObject *object)
 {
   GbpSysprofSurface *self = (GbpSysprofSurface *)object;
 
-  g_clear_pointer (&self->reader, sp_capture_reader_unref);
+  g_clear_pointer (&self->reader, sysprof_capture_reader_unref);
 
   G_OBJECT_CLASS (gbp_sysprof_surface_parent_class)->finalize (object);
 }
@@ -93,19 +93,19 @@ gbp_sysprof_surface_class_init (GbpSysprofSurfaceClass *klass)
   gtk_widget_class_bind_template_child (widget_class, GbpSysprofSurface, visualizers);
   gtk_widget_class_bind_template_child (widget_class, GbpSysprofSurface, zoom_manager);
 
-  g_type_ensure (SP_TYPE_CALLGRAPH_VIEW);
-  g_type_ensure (SP_TYPE_CPU_VISUALIZER_ROW);
-  g_type_ensure (SP_TYPE_EMPTY_STATE_VIEW);
-  g_type_ensure (SP_TYPE_FAILED_STATE_VIEW);
-  g_type_ensure (SP_TYPE_RECORDING_STATE_VIEW);
-  g_type_ensure (SP_TYPE_VISUALIZER_VIEW);
+  g_type_ensure (SYSPROF_TYPE_CALLGRAPH_VIEW);
+  g_type_ensure (SYSPROF_TYPE_CPU_VISUALIZER_ROW);
+  g_type_ensure (SYSPROF_TYPE_EMPTY_STATE_VIEW);
+  g_type_ensure (SYSPROF_TYPE_FAILED_STATE_VIEW);
+  g_type_ensure (SYSPROF_TYPE_RECORDING_STATE_VIEW);
+  g_type_ensure (SYSPROF_TYPE_VISUALIZER_VIEW);
 }
 
 static void
 gbp_sysprof_surface_init (GbpSysprofSurface *self)
 {
   DzlShortcutController *controller;
-  SpSelection *selection;
+  SysprofSelection *selection;
 
   gtk_widget_init_template (GTK_WIDGET (self));
 
@@ -126,7 +126,7 @@ gbp_sysprof_surface_init (GbpSysprofSurface *self)
                            self,
                            G_CONNECT_SWAPPED);
 
-  selection = sp_visualizer_view_get_selection (self->visualizers);
+  selection = sysprof_visualizer_view_get_selection (self->visualizers);
 
   g_signal_connect_object (selection,
                            "changed",
@@ -140,27 +140,27 @@ generate_cb (GObject      *object,
              GAsyncResult *result,
              gpointer      user_data)
 {
-  SpCallgraphProfile *profile = (SpCallgraphProfile *)object;
+  SysprofCallgraphProfile *profile = (SysprofCallgraphProfile *)object;
   g_autoptr(GbpSysprofSurface) self = user_data;
   g_autoptr(GError) error = NULL;
 
-  g_assert (SP_IS_CALLGRAPH_PROFILE (profile));
+  g_assert (SYSPROF_IS_CALLGRAPH_PROFILE (profile));
   g_assert (GBP_IS_SYSPROF_SURFACE (self));
 
-  if (!sp_profile_generate_finish (SP_PROFILE (profile), result, &error))
+  if (!sysprof_profile_generate_finish (SYSPROF_PROFILE (profile), result, &error))
     {
       g_warning ("Failed to generate profile: %s", error->message);
       return;
     }
 
-  sp_callgraph_view_set_profile (self->callgraph_view, profile);
+  sysprof_callgraph_view_set_profile (self->callgraph_view, profile);
 }
 
 static void
 gbp_sysprof_surface_reload (GbpSysprofSurface *self)
 {
-  SpSelection *selection;
-  g_autoptr(SpProfile) profile = NULL;
+  SysprofSelection *selection;
+  g_autoptr(SysprofProfile) profile = NULL;
 
   g_assert (GBP_IS_SYSPROF_SURFACE (self));
 
@@ -171,49 +171,49 @@ gbp_sysprof_surface_reload (GbpSysprofSurface *self)
   if (g_strcmp0 (gtk_stack_get_visible_child_name (self->stack), "failed") == 0)
     return;
 
-  selection = sp_visualizer_view_get_selection (self->visualizers);
-  profile = sp_callgraph_profile_new_with_selection (selection);
+  selection = sysprof_visualizer_view_get_selection (self->visualizers);
+  profile = sysprof_callgraph_profile_new_with_selection (selection);
 
-  sp_profile_set_reader (profile, self->reader);
-  sp_profile_generate (profile, NULL, generate_cb, g_object_ref (self));
+  sysprof_profile_set_reader (profile, self->reader);
+  sysprof_profile_generate (profile, NULL, generate_cb, g_object_ref (self));
 
-  sp_visualizer_view_set_reader (self->visualizers, self->reader);
+  sysprof_visualizer_view_set_reader (self->visualizers, self->reader);
 
   gtk_stack_set_visible_child_name (self->stack, "results");
 }
 
-SpCaptureReader *
+SysprofCaptureReader *
 gbp_sysprof_surface_get_reader (GbpSysprofSurface *self)
 {
   g_return_val_if_fail (GBP_IS_SYSPROF_SURFACE (self), NULL);
 
-  return sp_visualizer_view_get_reader (self->visualizers);
+  return sysprof_visualizer_view_get_reader (self->visualizers);
 }
 
 void
 gbp_sysprof_surface_set_reader (GbpSysprofSurface *self,
-                                    SpCaptureReader       *reader)
+                                    SysprofCaptureReader       *reader)
 {
   g_assert (GBP_IS_SYSPROF_SURFACE (self));
 
   if (reader != self->reader)
     {
-      SpSelection *selection;
+      SysprofSelection *selection;
 
       if (self->reader != NULL)
         {
-          g_clear_pointer (&self->reader, sp_capture_reader_unref);
-          sp_callgraph_view_set_profile (self->callgraph_view, NULL);
-          sp_visualizer_view_set_reader (self->visualizers, NULL);
+          g_clear_pointer (&self->reader, sysprof_capture_reader_unref);
+          sysprof_callgraph_view_set_profile (self->callgraph_view, NULL);
+          sysprof_visualizer_view_set_reader (self->visualizers, NULL);
           gtk_stack_set_visible_child_name (self->stack, "empty");
         }
 
-      selection = sp_visualizer_view_get_selection (self->visualizers);
-      sp_selection_unselect_all (selection);
+      selection = sysprof_visualizer_view_get_selection (self->visualizers);
+      sysprof_selection_unselect_all (selection);
 
       if (reader != NULL)
         {
-          self->reader = sp_capture_reader_ref (reader);
+          self->reader = sysprof_capture_reader_ref (reader);
           gbp_sysprof_surface_reload (self);
         }
     }
@@ -222,13 +222,13 @@ gbp_sysprof_surface_set_reader (GbpSysprofSurface *self,
 static void
 gbp_sysprof_surface_profiler_failed (GbpSysprofSurface *self,
                                          const GError          *error,
-                                         SpProfiler            *profiler)
+                                         SysprofProfiler            *profiler)
 {
   IDE_ENTRY;
 
   g_assert (GBP_IS_SYSPROF_SURFACE (self));
   g_assert (error != NULL);
-  g_assert (SP_IS_PROFILER (profiler));
+  g_assert (SYSPROF_IS_PROFILER (profiler));
 
   gtk_stack_set_visible_child_name (self->stack, "failed");
 
@@ -240,12 +240,12 @@ gbp_sysprof_surface_profiler_failed (GbpSysprofSurface *self,
 
 void
 gbp_sysprof_surface_set_profiler (GbpSysprofSurface *self,
-                                      SpProfiler            *profiler)
+                                      SysprofProfiler            *profiler)
 {
   g_return_if_fail (GBP_IS_SYSPROF_SURFACE (self));
-  g_return_if_fail (!profiler || SP_IS_PROFILER (profiler));
+  g_return_if_fail (!profiler || SYSPROF_IS_PROFILER (profiler));
 
-  sp_recording_state_view_set_profiler (self->recording_view, profiler);
+  sysprof_recording_state_view_set_profiler (self->recording_view, profiler);
 
   if (profiler != NULL)
     {
@@ -263,7 +263,7 @@ gbp_sysprof_surface_set_profiler (GbpSysprofSurface *self,
     }
 }
 
-SpZoomManager *
+SysprofZoomManager *
 gbp_sysprof_surface_get_zoom_manager (GbpSysprofSurface *self)
 {
   g_return_val_if_fail (GBP_IS_SYSPROF_SURFACE (self), NULL);
diff --git a/src/plugins/sysprof/gbp-sysprof-surface.h b/src/plugins/sysprof/gbp-sysprof-surface.h
index 4ed48180a..1137dd4a4 100644
--- a/src/plugins/sysprof/gbp-sysprof-surface.h
+++ b/src/plugins/sysprof/gbp-sysprof-surface.h
@@ -29,11 +29,11 @@ G_BEGIN_DECLS
 
 G_DECLARE_FINAL_TYPE (GbpSysprofSurface, gbp_sysprof_surface, GBP, SYSPROF_SURFACE, IdeSurface)
 
-SpZoomManager   *gbp_sysprof_surface_get_zoom_manager (GbpSysprofSurface *self);
+SysprofZoomManager   *gbp_sysprof_surface_get_zoom_manager (GbpSysprofSurface *self);
 void             gbp_sysprof_surface_set_profiler     (GbpSysprofSurface *self,
-                                                       SpProfiler        *profiler);
-SpCaptureReader *gbp_sysprof_surface_get_reader       (GbpSysprofSurface *self);
+                                                       SysprofProfiler        *profiler);
+SysprofCaptureReader *gbp_sysprof_surface_get_reader       (GbpSysprofSurface *self);
 void             gbp_sysprof_surface_set_reader       (GbpSysprofSurface *self,
-                                                       SpCaptureReader   *reader);
+                                                       SysprofCaptureReader   *reader);
 
 G_END_DECLS
diff --git a/src/plugins/sysprof/gbp-sysprof-surface.ui b/src/plugins/sysprof/gbp-sysprof-surface.ui
index bc2fcbe5c..83598a9b8 100644
--- a/src/plugins/sysprof/gbp-sysprof-surface.ui
+++ b/src/plugins/sysprof/gbp-sysprof-surface.ui
@@ -45,7 +45,7 @@
             <property name="homogeneous">false</property>
             <property name="visible">true</property>
             <child>
-              <object class="SpEmptyStateView">
+              <object class="SysprofEmptyStateView">
                 <property name="subtitle" translatable="yes" comments="the action:// link is used to run the 
project">Select &lt;a href="action://run-manager.run-with-handler::profiler"&gt;Run with profiler&lt;/a&gt; 
from the run menu to begin</property>
                 <property name="visible">true</property>
               </object>
@@ -54,7 +54,7 @@
               </packing>
             </child>
             <child>
-              <object class="SpRecordingStateView" id="recording_view">
+              <object class="SysprofRecordingStateView" id="recording_view">
                 <property name="visible">true</property>
               </object>
               <packing>
@@ -62,7 +62,7 @@
               </packing>
             </child>
             <child>
-              <object class="SpFailedStateView" id="failed_view">
+              <object class="SysprofFailedStateView" id="failed_view">
                 <property name="visible">true</property>
               </object>
               <packing>
@@ -73,13 +73,13 @@
               <object class="DzlMultiPaned">
                 <property name="visible">true</property>
                 <child>
-                  <object class="SpVisualizerView" id="visualizers">
+                  <object class="SysprofVisualizerView" id="visualizers">
                     <property name="visible">true</property>
                     <property name="zoom-manager">zoom_manager</property>
                   </object>
                 </child>
                 <child>
-                  <object class="SpCallgraphView" id="callgraph_view">
+                  <object class="SysprofCallgraphView" id="callgraph_view">
                     <property name="vexpand">true</property>
                     <property name="visible">true</property>
                   </object>
@@ -94,6 +94,6 @@
       </object>
     </child>
   </template>
-  <object class="SpZoomManager" id="zoom_manager">
+  <object class="SysprofZoomManager" id="zoom_manager">
   </object>
 </interface>
diff --git a/src/plugins/sysprof/gbp-sysprof-workspace-addin.c 
b/src/plugins/sysprof/gbp-sysprof-workspace-addin.c
index dbd515518..85e2df6c4 100644
--- a/src/plugins/sysprof/gbp-sysprof-workspace-addin.c
+++ b/src/plugins/sysprof/gbp-sysprof-workspace-addin.c
@@ -29,7 +29,7 @@ struct _GbpSysprofWorkspaceAddin
   GObject                parent_instance;
 
   GSimpleActionGroup    *actions;
-  SpProfiler            *profiler;
+  SysprofProfiler            *profiler;
 
   GbpSysprofSurface     *surface;
   IdeWorkspace          *workspace;
@@ -64,17 +64,17 @@ gbp_sysprof_workspace_addin_update_controls (GbpSysprofWorkspaceAddin *self)
 
 static void
 profiler_stopped (GbpSysprofWorkspaceAddin *self,
-                  SpProfiler               *profiler)
+                  SysprofProfiler               *profiler)
 {
-  g_autoptr(SpCaptureReader) reader = NULL;
+  g_autoptr(SysprofCaptureReader) reader = NULL;
   g_autoptr(GError) error = NULL;
-  SpCaptureWriter *writer;
+  SysprofCaptureWriter *writer;
 
   IDE_ENTRY;
 
   g_assert (IDE_IS_MAIN_THREAD ());
   g_assert (GBP_IS_SYSPROF_WORKSPACE_ADDIN (self));
-  g_assert (SP_IS_PROFILER (profiler));
+  g_assert (SYSPROF_IS_PROFILER (profiler));
 
   if (self->profiler != profiler)
     IDE_EXIT;
@@ -82,8 +82,8 @@ profiler_stopped (GbpSysprofWorkspaceAddin *self,
   if (self->workspace == NULL)
     IDE_EXIT;
 
-  writer = sp_profiler_get_writer (profiler);
-  reader = sp_capture_writer_create_reader (writer, &error);
+  writer = sysprof_profiler_get_writer (profiler);
+  reader = sysprof_capture_writer_create_reader (writer, &error);
 
   if (reader == NULL)
     {
@@ -113,7 +113,7 @@ profiler_child_spawned (GbpSysprofWorkspaceAddin *self,
   g_assert (identifier != NULL);
   g_assert (IDE_IS_RUNNER (runner));
 
-  if (!SP_IS_PROFILER (self->profiler))
+  if (!SYSPROF_IS_PROFILER (self->profiler))
     return;
 
 #ifdef G_OS_UNIX
@@ -128,8 +128,8 @@ profiler_child_spawned (GbpSysprofWorkspaceAddin *self,
 
   IDE_TRACE_MSG ("Adding pid %s to profiler", identifier);
 
-  sp_profiler_add_pid (self->profiler, pid);
-  sp_profiler_start (self->profiler);
+  sysprof_profiler_add_pid (self->profiler, pid);
+  sysprof_profiler_start (self->profiler);
 }
 
 static gchar *
@@ -165,10 +165,10 @@ profiler_run_handler (IdeRunManager *run_manager,
                       gpointer       user_data)
 {
   GbpSysprofWorkspaceAddin *self = user_data;
-  g_autoptr(SpSource) proc_source = NULL;
-  g_autoptr(SpSource) perf_source = NULL;
-  g_autoptr(SpSource) hostinfo_source = NULL;
-  g_autoptr(SpSource) memory_source = NULL;
+  g_autoptr(SysprofSource) proc_source = NULL;
+  g_autoptr(SysprofSource) perf_source = NULL;
+  g_autoptr(SysprofSource) hostinfo_source = NULL;
+  g_autoptr(SysprofSource) memory_source = NULL;
   IdeContext *context;
 
   g_assert (IDE_IS_MAIN_THREAD ());
@@ -176,10 +176,10 @@ profiler_run_handler (IdeRunManager *run_manager,
   g_assert (IDE_IS_RUNNER (runner));
   g_assert (IDE_IS_RUN_MANAGER (run_manager));
 
-  if (SP_IS_PROFILER (self->profiler))
+  if (SYSPROF_IS_PROFILER (self->profiler))
     {
-      if (sp_profiler_get_is_running (self->profiler))
-        sp_profiler_stop (self->profiler);
+      if (sysprof_profiler_get_is_running (self->profiler))
+        sysprof_profiler_stop (self->profiler);
       g_clear_object (&self->profiler);
     }
 
@@ -211,11 +211,11 @@ profiler_run_handler (IdeRunManager *run_manager,
         g_autofree gchar *path = get_runtime_sysroot (context, dirs[i]);
 
         if (path != NULL)
-          sp_symbol_dirs_add (path);
+          sysprof_symbol_dirs_add (path);
       }
   }
 
-  self->profiler = sp_local_profiler_new ();
+  self->profiler = sysprof_local_profiler_new ();
 
   g_signal_connect_object (self->profiler,
                            "stopped",
@@ -231,19 +231,19 @@ profiler_run_handler (IdeRunManager *run_manager,
    * Longer term we either need a way to follow-children and/or limit to a
    * cgroup/process-group.
    */
-  sp_profiler_set_whole_system (SP_PROFILER (self->profiler), TRUE);
+  sysprof_profiler_set_whole_system (SYSPROF_PROFILER (self->profiler), TRUE);
 
-  proc_source = sp_proc_source_new ();
-  sp_profiler_add_source (self->profiler, proc_source);
+  proc_source = sysprof_proc_source_new ();
+  sysprof_profiler_add_source (self->profiler, proc_source);
 
-  perf_source = sp_perf_source_new ();
-  sp_profiler_add_source (self->profiler, perf_source);
+  perf_source = sysprof_perf_source_new ();
+  sysprof_profiler_add_source (self->profiler, perf_source);
 
-  hostinfo_source = sp_hostinfo_source_new ();
-  sp_profiler_add_source (self->profiler, hostinfo_source);
+  hostinfo_source = sysprof_hostinfo_source_new ();
+  sysprof_profiler_add_source (self->profiler, hostinfo_source);
 
-  memory_source = sp_memory_source_new ();
-  sp_profiler_add_source (self->profiler, memory_source);
+  memory_source = sysprof_memory_source_new ();
+  sysprof_profiler_add_source (self->profiler, memory_source);
 
   /*
    * TODO:
@@ -279,7 +279,7 @@ gbp_sysprof_workspace_addin_open_cb (GObject      *object,
                                      gpointer      user_data)
 {
   GbpSysprofWorkspaceAddin *self = (GbpSysprofWorkspaceAddin *)object;
-  g_autoptr(SpCaptureReader) reader = NULL;
+  g_autoptr(SysprofCaptureReader) reader = NULL;
   g_autoptr(GError) error = NULL;
 
   g_assert (GBP_IS_SYSPROF_WORKSPACE_ADDIN (self));
@@ -309,7 +309,7 @@ gbp_sysprof_workspace_addin_open_worker (IdeTask      *task,
 {
   g_autofree gchar *path = NULL;
   g_autoptr(GError) error = NULL;
-  SpCaptureReader *reader;
+  SysprofCaptureReader *reader;
   GFile *file = task_data;
 
   g_assert (IDE_IS_TASK (task));
@@ -319,10 +319,10 @@ gbp_sysprof_workspace_addin_open_worker (IdeTask      *task,
 
   path = g_file_get_path (file);
 
-  if (!(reader = sp_capture_reader_new (path, &error)))
+  if (!(reader = sysprof_capture_reader_new (path, &error)))
     ide_task_return_error (task, g_steal_pointer (&error));
   else
-    ide_task_return_pointer (task, reader, sp_capture_reader_unref);
+    ide_task_return_pointer (task, reader, sysprof_capture_reader_unref);
 }
 
 static void
@@ -449,8 +449,8 @@ run_manager_stopped (GbpSysprofWorkspaceAddin *self,
   g_assert (GBP_IS_SYSPROF_WORKSPACE_ADDIN (self));
   g_assert (IDE_IS_RUN_MANAGER (run_manager));
 
-  if (self->profiler != NULL && sp_profiler_get_is_running (self->profiler))
-    sp_profiler_stop (self->profiler);
+  if (self->profiler != NULL && sysprof_profiler_get_is_running (self->profiler))
+    sysprof_profiler_stop (self->profiler);
 }
 
 static gboolean
@@ -469,7 +469,7 @@ gbp_sysprof_workspace_addin_load (IdeWorkspaceAddin *addin,
                                   IdeWorkspace      *workspace)
 {
   GbpSysprofWorkspaceAddin *self = (GbpSysprofWorkspaceAddin *)addin;
-  SpZoomManager *zoom_manager;
+  SysprofZoomManager *zoom_manager;
   IdeRunManager *run_manager;
   IdeHeaderBar *header;
   IdeContext *context;
diff --git a/src/plugins/sysprof/sysprof-plugin.c b/src/plugins/sysprof/sysprof-plugin.c
index 5654cc39a..f403d1cde 100644
--- a/src/plugins/sysprof/sysprof-plugin.c
+++ b/src/plugins/sysprof/sysprof-plugin.c
@@ -31,7 +31,7 @@
 _IDE_EXTERN void
 _gbp_sysprof_register_types (PeasObjectModule *module)
 {
-  sp_clock_init ();
+  sysprof_clock_init ();
 
   peas_object_module_register_extension_type (module,
                                               IDE_TYPE_WORKSPACE_ADDIN,


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