[gnome-builder/wip/chergert/visualizers] wip: start adding visualizer support



commit d1994bc6e482b1da45170800fb09fceaf0b8855f
Author: Christian Hergert <chergert redhat com>
Date:   Sun Oct 9 13:40:33 2016 -0700

    wip: start adding visualizer support

 plugins/sysprof/gbp-sysprof-perspective.c     |   13 ++++++---
 plugins/sysprof/gbp-sysprof-perspective.ui    |   35 ++++++++++++++++++++++++-
 plugins/sysprof/gbp-sysprof-workbench-addin.c |    4 +++
 plugins/sysprof/sysprof.gresource.xml         |    1 +
 plugins/sysprof/theme/shared.css              |   13 +++++++++
 5 files changed, 61 insertions(+), 5 deletions(-)
---
diff --git a/plugins/sysprof/gbp-sysprof-perspective.c b/plugins/sysprof/gbp-sysprof-perspective.c
index f596003..ca5fd49 100644
--- a/plugins/sysprof/gbp-sysprof-perspective.c
+++ b/plugins/sysprof/gbp-sysprof-perspective.c
@@ -26,9 +26,10 @@
 
 struct _GbpSysprofPerspective
 {
-  GtkBin           parent_instance;
+  GtkBin            parent_instance;
 
-  SpCallgraphView *callgraph_view;
+  SpCallgraphView  *callgraph_view;
+  SpVisualizerView *visualizers;
 };
 
 static void perspective_iface_init (IdePerspectiveInterface *iface);
@@ -43,8 +44,12 @@ gbp_sysprof_perspective_class_init (GbpSysprofPerspectiveClass *klass)
 
   gtk_widget_class_set_template_from_resource (widget_class, 
"/org/gnome/builder/plugins/sysprof-plugin/gbp-sysprof-perspective.ui");
   gtk_widget_class_bind_template_child (widget_class, GbpSysprofPerspective, callgraph_view);
+  gtk_widget_class_bind_template_child (widget_class, GbpSysprofPerspective, visualizers);
 
   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_VISUALIZER_VIEW);
 }
 
 static void
@@ -129,8 +134,8 @@ gbp_sysprof_perspective_set_reader (GbpSysprofPerspective *self,
     }
 
   profile = sp_callgraph_profile_new ();
-
   sp_profile_set_reader (profile, reader);
-
   sp_profile_generate (profile, NULL, generate_cb, g_object_ref (self));
+
+  sp_visualizer_view_set_reader (self->visualizers, reader);
 }
diff --git a/plugins/sysprof/gbp-sysprof-perspective.ui b/plugins/sysprof/gbp-sysprof-perspective.ui
index 253f51b..0fcfdac 100644
--- a/plugins/sysprof/gbp-sysprof-perspective.ui
+++ b/plugins/sysprof/gbp-sysprof-perspective.ui
@@ -3,11 +3,44 @@
   <template class="GbpSysprofPerspective" parent="GtkBin">
     <child>
       <object class="GtkStack">
+        <property name="homogeneous">false</property>
         <property name="visible">true</property>
         <child>
-          <object class="SpCallgraphView" id="callgraph_view">
+          <object class="SpEmptyStateView">
             <property name="visible">true</property>
           </object>
+          <packing>
+            <property name="name">empty</property>
+          </packing>
+        </child>
+        <child>
+          <object class="PnlMultiPaned">
+            <property name="visible">true</property>
+            <child>
+              <object class="SpVisualizerView" id="visualizers">
+                <property name="visible">true</property>
+                <child type="visualizer">
+                  <object class="SpCpuVisualizerRow" id="cpu_visualizer">
+                    <property name="title" translatable="yes">CPU</property>
+                    <property name="height-request">75</property>
+                    <property name="selectable">false</property>
+                    <property name="y-lower">0.0</property>
+                    <property name="y-upper">100.0</property>
+                    <property name="visible">true</property>
+                  </object>
+                </child>
+              </object>
+            </child>
+            <child>
+              <object class="SpCallgraphView" id="callgraph_view">
+                <property name="vexpand">true</property>
+                <property name="visible">true</property>
+              </object>
+            </child>
+          </object>
+          <packing>
+            <property name="name">results</property>
+          </packing>
         </child>
       </object>
     </child>
diff --git a/plugins/sysprof/gbp-sysprof-workbench-addin.c b/plugins/sysprof/gbp-sysprof-workbench-addin.c
index 4fd0dab..8f338e0 100644
--- a/plugins/sysprof/gbp-sysprof-workbench-addin.c
+++ b/plugins/sysprof/gbp-sysprof-workbench-addin.c
@@ -112,6 +112,7 @@ profiler_run_handler (IdeRunManager *run_manager,
   GbpSysprofWorkbenchAddin *self = user_data;
   g_autoptr(SpSource) proc_source = NULL;
   g_autoptr(SpSource) perf_source = NULL;
+  g_autoptr(SpSource) hostinfo_source = NULL;
 
   g_assert (GBP_IS_SYSPROF_WORKBENCH_ADDIN (self));
   g_assert (IDE_IS_RUNNER (runner));
@@ -134,6 +135,9 @@ profiler_run_handler (IdeRunManager *run_manager,
   perf_source = sp_perf_source_new ();
   sp_profiler_add_source (self->profiler, perf_source);
 
+  hostinfo_source = sp_hostinfo_source_new ();
+  sp_profiler_add_source (self->profiler, hostinfo_source);
+
   /*
    * TODO:
    *
diff --git a/plugins/sysprof/sysprof.gresource.xml b/plugins/sysprof/sysprof.gresource.xml
index 2695fd8..d6175b9 100644
--- a/plugins/sysprof/sysprof.gresource.xml
+++ b/plugins/sysprof/sysprof.gresource.xml
@@ -2,6 +2,7 @@
 <gresources>
   <gresource prefix="/org/gnome/builder/plugins/sysprof-plugin">
     <file>gtk/menus.ui</file>
+    <file>theme/shared.css</file>
     <file>gbp-sysprof-perspective.ui</file>
   </gresource>
 </gresources>
diff --git a/plugins/sysprof/theme/shared.css b/plugins/sysprof/theme/shared.css
new file mode 100644
index 0000000..74a58a7
--- /dev/null
+++ b/plugins/sysprof/theme/shared.css
@@ -0,0 +1,13 @@
+visualizers list {
+  background: @theme_bg_color;
+}
+
+visualizers list row:backdrop,
+visualizers list row:last-child {
+  border-bottom: none;
+}
+
+ticks {
+  color: alpha(@theme_fg_color, 0.4);
+}
+


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