[sysprof/wip/visualizers] wip on visualizers prototype



commit 769d7ae5f891d350ad6b960f3043acf12b3a1af2
Author: Christian Hergert <christian hergert me>
Date:   Thu Apr 14 21:37:16 2016 -0700

    wip on visualizers prototype

 lib/Makefile.am                |    6 +
 lib/sp-column-visualizer-row.c |  102 ++++++++++++
 lib/sp-column-visualizer-row.h |   34 ++++
 lib/sp-hostinfo-source.c       |  337 ++++++++++++++++++++++++++++++++++++++++
 lib/sp-hostinfo-source.h       |   35 ++++
 lib/sp-visualizer-row.c        |   41 +++++
 lib/sp-visualizer-row.h        |   52 ++++++
 lib/sysprof-ui.h               |    2 +
 lib/sysprof.h                  |    1 +
 src/resources/theme/shared.css |    2 +
 src/resources/ui/sp-window.ui  |   34 ++++-
 src/sp-window.c                |    4 +
 12 files changed, 649 insertions(+), 1 deletions(-)
---
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 1af68f8..0a4f1d5 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -53,6 +53,7 @@ headers_DATA = \
        sp-elf-symbol-resolver.h \
        sp-error.h \
        sp-gjs-source.h \
+       sp-hostinfo-source.h \
        sp-jitmap-symbol-resolver.h \
        sp-kernel-symbol.h \
        sp-kernel-symbol-resolver.h \
@@ -77,6 +78,7 @@ libsysprof_ API_VERSION@_la_SOURCES = \
        sp-elf-symbol-resolver.c \
        sp-error.c \
        sp-gjs-source.c \
+       sp-hostinfo-source.c \
        sp-jitmap-symbol-resolver.c \
        sp-kernel-symbol.c \
        sp-kernel-symbol-resolver.c \
@@ -130,6 +132,7 @@ uiheadersdir = $(includedir)/sysprof- API_VERSION@
 uiheaders_DATA = \
        sp-callgraph-view.h \
        sp-cell-renderer-percent.h \
+       sp-column-visualizer-row.h \
        sp-empty-state-view.h \
        sp-failed-state-view.h \
        sp-model-filter.h \
@@ -139,6 +142,7 @@ uiheaders_DATA = \
        sp-profiler-menu-button.h \
        sp-recording-state-view.h \
        sp-scrolled-window.h \
+       sp-visualizer-row.h \
        sysprof-ui.h \
        $(NULL)
 
@@ -146,6 +150,7 @@ libsysprof_ui_ API_VERSION@_la_SOURCES = \
        $(uiheaders_DATA) \
        sp-callgraph-view.c \
        sp-cell-renderer-percent.c \
+       sp-column-visualizer-row.c \
        sp-empty-state-view.c \
        sp-failed-state-view.c \
        sp-model-filter.c \
@@ -155,6 +160,7 @@ libsysprof_ui_ API_VERSION@_la_SOURCES = \
        sp-profiler-menu-button.c \
        sp-recording-state-view.c \
        sp-scrolled-window.c \
+       sp-visualizer-row.c \
        $(NULL)
 
 libsysprof_ui_ API_VERSION@_la_CFLAGS = \
diff --git a/lib/sp-column-visualizer-row.c b/lib/sp-column-visualizer-row.c
new file mode 100644
index 0000000..f6b1369
--- /dev/null
+++ b/lib/sp-column-visualizer-row.c
@@ -0,0 +1,102 @@
+/* sp-column-visualizer-row.c
+ *
+ * Copyright (C) 2016 Christian Hergert <christian hergert me>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <stdlib.h>
+
+#include "sp-column-visualizer-row.h"
+
+struct _SpColumnVisualizerRow
+{
+  SpVisualizerRow  parent_instance;
+  SpCaptureReader *reader;
+};
+
+G_DEFINE_TYPE (SpColumnVisualizerRow, sp_column_visualizer_row, SP_TYPE_VISUALIZER_ROW)
+
+static gboolean
+sp_column_visualizer_row_draw (GtkWidget *widget,
+                               cairo_t   *cr)
+{
+  GtkAllocation alloc;
+  gboolean ret;
+  gint i;
+
+  g_assert (SP_IS_COLUMN_VISUALIZER_ROW (widget));
+  g_assert (cr != NULL);
+
+  gtk_widget_get_allocation (widget, &alloc);
+
+  ret = GTK_WIDGET_CLASS (sp_column_visualizer_row_parent_class)->draw (widget, cr);
+
+  cairo_save (cr);
+
+#define WIDTH 10
+#define SPACING 6
+
+  for (i = 10; i < alloc.width; i += WIDTH + SPACING)
+    {
+      GdkRectangle rect;
+
+      rect.x = i;
+      rect.y = alloc.height;
+      rect.width = WIDTH;
+      rect.height = -(rand() % alloc.height);
+
+      gdk_cairo_rectangle (cr, &rect);
+    }
+
+  cairo_set_source_rgba (cr, 0, 0, 0, 0.4);
+  cairo_fill (cr);
+
+  cairo_restore (cr);
+
+  return ret;
+}
+
+static void
+sp_column_visualizer_row_set_reader (SpVisualizerRow *row,
+                                     SpCaptureReader *reader)
+{
+  SpColumnVisualizerRow *self = (SpColumnVisualizerRow *)row;
+
+  g_assert (SP_IS_COLUMN_VISUALIZER_ROW (self));
+
+  if (self->reader != reader)
+    {
+      g_clear_pointer (&self->reader, sp_capture_reader_unref);
+      if (reader)
+        self->reader = sp_capture_reader_ref (reader);
+      gtk_widget_queue_draw (GTK_WIDGET (self));
+    }
+}
+
+static void
+sp_column_visualizer_row_class_init (SpColumnVisualizerRowClass *klass)
+{
+  GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+  SpVisualizerRowClass *visualizer_class = SP_VISUALIZER_ROW_CLASS (klass);
+
+  widget_class->draw = sp_column_visualizer_row_draw;
+
+  visualizer_class->set_reader = sp_column_visualizer_row_set_reader;
+}
+
+static void
+sp_column_visualizer_row_init (SpColumnVisualizerRow *self)
+{
+}
diff --git a/lib/sp-column-visualizer-row.h b/lib/sp-column-visualizer-row.h
new file mode 100644
index 0000000..ce08834
--- /dev/null
+++ b/lib/sp-column-visualizer-row.h
@@ -0,0 +1,34 @@
+/* sp-column-visualizer-row.h
+ *
+ * Copyright (C) 2016 Christian Hergert <christian hergert me>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef SP_COLUMN_VISUALIZER_ROW_H
+#define SP_COLUMN_VISUALIZER_ROW_H
+
+#include "sp-visualizer-row.h"
+
+G_BEGIN_DECLS
+
+#define SP_TYPE_COLUMN_VISUALIZER_ROW (sp_column_visualizer_row_get_type())
+
+G_DECLARE_FINAL_TYPE (SpColumnVisualizerRow, sp_column_visualizer_row, SP, COLUMN_VISUALIZER_ROW, 
SpVisualizerRow)
+
+GtkWidget *sp_column_visualizer_row_new (void);
+
+G_END_DECLS
+
+#endif /* SP_COLUMN_VISUALIZER_ROW_H */
diff --git a/lib/sp-hostinfo-source.c b/lib/sp-hostinfo-source.c
new file mode 100644
index 0000000..0850faf
--- /dev/null
+++ b/lib/sp-hostinfo-source.c
@@ -0,0 +1,337 @@
+/* sp-hostinfo-source.c
+ *
+ * Copyright (C) 2016 Christian Hergert <christian hergert me>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <ctype.h>
+#include <stdio.h>
+#include <unistd.h>
+
+#include "sp-hostinfo-source.h"
+
+struct _SpHostinfoSource
+{
+  GObject          parent_instance;
+
+  guint            handler;
+  gint             n_cpu;
+
+  SpCaptureWriter *writer;
+  GArray          *cpu_info;
+};
+
+typedef struct
+{
+  gint    counter_base;
+  gdouble total;
+  gdouble freq;
+  glong   last_user;
+  glong   last_idle;
+  glong   last_system;
+  glong   last_nice;
+  glong   last_iowait;
+  glong   last_irq;
+  glong   last_softirq;
+  glong   last_steal;
+  glong   last_guest;
+  glong   last_guest_nice;
+} CpuInfo;
+
+static void source_iface_init (SpSourceInterface *iface);
+
+G_DEFINE_TYPE_EXTENDED (SpHostinfoSource, sp_hostinfo_source, G_TYPE_OBJECT, 0,
+                        G_IMPLEMENT_INTERFACE (SP_TYPE_SOURCE, source_iface_init))
+
+SpSource *
+sp_hostinfo_source_new (void)
+{
+  return g_object_new (SP_TYPE_HOSTINFO_SOURCE, NULL);
+}
+
+static void
+poll_cpu (SpHostinfoSource *self)
+{
+  gchar cpu[64] = { 0 };
+  glong user;
+  glong sys;
+  glong nice;
+  glong idle;
+  glong iowait;
+  glong irq;
+  glong softirq;
+  glong steal;
+  glong guest;
+  glong guest_nice;
+  glong user_calc;
+  glong system_calc;
+  glong nice_calc;
+  glong idle_calc;
+  glong iowait_calc;
+  glong irq_calc;
+  glong softirq_calc;
+  glong steal_calc;
+  glong guest_calc;
+  glong guest_nice_calc;
+  gchar *buf = NULL;
+  glong total;
+  gchar *line;
+  gint ret;
+  gint id;
+  gint i;
+
+  if (g_file_get_contents("/proc/stat", &buf, NULL, NULL))
+    {
+      line = buf;
+      for (i = 0; buf[i]; i++)
+        {
+          if (buf[i] == '\n') {
+            buf[i] = '\0';
+            if (g_str_has_prefix(line, "cpu"))
+              {
+                if (isdigit(line[3]))
+                  {
+                    CpuInfo *cpu_info;
+
+                    user = nice = sys = idle = id = 0;
+                    ret = sscanf (line, "%s %ld %ld %ld %ld %ld %ld %ld %ld %ld %ld",
+                                  cpu, &user, &nice, &sys, &idle,
+                                  &iowait, &irq, &softirq, &steal, &guest, &guest_nice);
+                    if (ret != 11)
+                      goto next;
+
+                    ret = sscanf(cpu, "cpu%d", &id);
+
+                    if (ret != 1 || id < 0 || id >= self->n_cpu)
+                      goto next;
+
+                    cpu_info = &g_array_index (self->cpu_info, CpuInfo, id);
+
+                    user_calc = user - cpu_info->last_user;
+                    nice_calc = nice - cpu_info->last_nice;
+                    system_calc = sys - cpu_info->last_system;
+                    idle_calc = idle - cpu_info->last_idle;
+                    iowait_calc = iowait - cpu_info->last_iowait;
+                    irq_calc = irq - cpu_info->last_irq;
+                    softirq_calc = softirq - cpu_info->last_softirq;
+                    steal_calc = steal - cpu_info->last_steal;
+                    guest_calc = guest - cpu_info->last_guest;
+                    guest_nice_calc = guest_nice - cpu_info->last_guest_nice;
+
+                    total = user_calc + nice_calc + system_calc + idle_calc + iowait_calc + irq_calc + 
softirq_calc + steal_calc + guest_calc + guest_nice_calc;
+                    cpu_info->total = ((total - idle_calc) / (gdouble)total) * 100.0;
+
+                    cpu_info->last_user = user;
+                    cpu_info->last_nice = nice;
+                    cpu_info->last_idle = idle;
+                    cpu_info->last_system = sys;
+                    cpu_info->last_iowait = iowait;
+                    cpu_info->last_irq = irq;
+                    cpu_info->last_softirq = softirq;
+                    cpu_info->last_steal = steal;
+                    cpu_info->last_guest = guest;
+                    cpu_info->last_guest_nice = guest_nice;
+                  }
+              } else {
+                /* CPU info comes first. Skip further lines. */
+                break;
+              }
+
+          next:
+            line = &buf[i + 1];
+          }
+      }
+  }
+
+  g_free (buf);
+}
+
+static void
+publish_cpu (SpHostinfoSource *self)
+{
+  guint *counter_ids;
+  gint64 *counter_values;
+  gint i;
+
+  counter_ids = alloca (sizeof *counter_ids * self->n_cpu * 2);
+  counter_values = alloca (sizeof *counter_values * self->n_cpu * 2);
+
+  for (i = 0; i < self->n_cpu; i++)
+    {
+      CpuInfo *info = &g_array_index (self->cpu_info, CpuInfo, i);
+      guint *id = &counter_ids[i*2];
+      gint64 *value = &counter_values[i*2];
+
+      *id = info->counter_base;
+      *value = info->total * 100;
+
+      id++;
+      value++;
+
+      *id = info->counter_base + 1;
+      *value = info->freq;;
+    }
+
+  sp_capture_writer_set_counters (self->writer,
+                                  SP_CAPTURE_CURRENT_TIME,
+                                  getpid (),
+                                  -1,
+                                  counter_ids,
+                                  counter_values,
+                                  self->n_cpu * 2);
+}
+
+static gboolean
+collect_hostinfo_cb (gpointer data)
+{
+  SpHostinfoSource *self = data;
+
+  g_assert (SP_IS_HOSTINFO_SOURCE (self));
+
+  poll_cpu (self);
+  publish_cpu (self);
+
+  return G_SOURCE_CONTINUE;
+}
+
+static void
+sp_hostinfo_source_finalize (GObject *object)
+{
+  SpHostinfoSource *self = (SpHostinfoSource *)object;
+
+  if (self->handler)
+    {
+      g_source_remove (self->handler);
+      self->handler = 0;
+    }
+
+  g_clear_pointer (&self->writer, sp_capture_writer_unref);
+  g_clear_pointer (&self->cpu_info, g_array_unref);
+
+  G_OBJECT_CLASS (sp_hostinfo_source_parent_class)->finalize (object);
+}
+
+static void
+sp_hostinfo_source_class_init (SpHostinfoSourceClass *klass)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+  object_class->finalize = sp_hostinfo_source_finalize;
+}
+
+static void
+sp_hostinfo_source_init (SpHostinfoSource *self)
+{
+  self->cpu_info = g_array_new (FALSE, TRUE, sizeof (CpuInfo));
+}
+
+static void
+sp_hostinfo_source_set_writer (SpSource        *source,
+                               SpCaptureWriter *writer)
+{
+  SpHostinfoSource *self = (SpHostinfoSource *)source;
+
+  g_assert (SP_IS_HOSTINFO_SOURCE (self));
+  g_assert (writer != NULL);
+
+  g_clear_pointer (&self->writer, sp_capture_writer_unref);
+  self->writer = sp_capture_writer_ref (writer);
+}
+
+static void
+sp_hostinfo_source_start (SpSource *source)
+{
+  SpHostinfoSource *self = (SpHostinfoSource *)source;
+
+  g_assert (SP_IS_HOSTINFO_SOURCE (self));
+
+  self->handler = g_timeout_add (500, collect_hostinfo_cb, self);
+}
+
+static void
+sp_hostinfo_source_stop (SpSource *source)
+{
+  SpHostinfoSource *self = (SpHostinfoSource *)source;
+
+  g_assert (SP_IS_HOSTINFO_SOURCE (self));
+
+  g_source_remove (self->handler);
+  self->handler = 0;
+
+  sp_source_emit_finished (SP_SOURCE (self));
+}
+
+static void
+sp_hostinfo_source_prepare (SpSource *source)
+{
+  SpHostinfoSource *self = (SpHostinfoSource *)source;
+  SpCaptureCounter *counters;
+  gint i;
+
+  g_assert (SP_IS_HOSTINFO_SOURCE (self));
+
+  self->n_cpu = g_get_num_processors ();
+
+  g_array_set_size (self->cpu_info, 0);
+
+  counters = alloca (sizeof *counters * self->n_cpu * 2);
+
+  for (i = 0; i < self->n_cpu; i++)
+    {
+      SpCaptureCounter *ctr = &counters[i*2];
+      CpuInfo info = { 0 };
+
+      /*
+       * Request 2 counter values.
+       * One for CPU and one for Frequency.
+       */
+      info.counter_base = sp_capture_writer_request_counter (self->writer, 2);
+
+      /*
+       * Define counters for capture file.
+       */
+      g_strlcpy (ctr->category, "CPU Percent", sizeof ctr->category);
+      g_snprintf (ctr->name, sizeof ctr->name, "Total CPU %d", i);
+      g_snprintf (ctr->description, sizeof ctr->description,
+                  "Total CPU usage %d", i);
+
+      ctr++;
+
+      g_strlcpy (ctr->category, "CPU Frequency", sizeof ctr->category);
+      g_snprintf (ctr->name, sizeof ctr->name, "CPU %d", i);
+      g_snprintf (ctr->description, sizeof ctr->description,
+                  "Frequency of CPU %d", i);
+
+      g_array_append_val (self->cpu_info, info);
+    }
+
+  sp_capture_writer_define_counters (self->writer,
+                                     SP_CAPTURE_CURRENT_TIME,
+                                     getpid (),
+                                     -1,
+                                     counters,
+                                     self->n_cpu * 2);
+
+  sp_source_emit_ready (SP_SOURCE (self));
+}
+
+static void
+source_iface_init (SpSourceInterface *iface)
+{
+  iface->set_writer = sp_hostinfo_source_set_writer;
+  iface->prepare = sp_hostinfo_source_prepare;
+  iface->start = sp_hostinfo_source_start;
+  iface->stop = sp_hostinfo_source_stop;
+}
diff --git a/lib/sp-hostinfo-source.h b/lib/sp-hostinfo-source.h
new file mode 100644
index 0000000..873dd11
--- /dev/null
+++ b/lib/sp-hostinfo-source.h
@@ -0,0 +1,35 @@
+/* sp-hostinfo-source.h
+ *
+ * Copyright (C) 2016 Christian Hergert <christian hergert me>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef SP_HOSTINFO_SOURCE_H
+#define SP_HOSTINFO_SOURCE_H
+
+#include "sp-source.h"
+
+G_BEGIN_DECLS
+
+#define SP_TYPE_HOSTINFO_SOURCE (sp_hostinfo_source_get_type())
+
+G_DECLARE_FINAL_TYPE (SpHostinfoSource, sp_hostinfo_source, SP, HOSTINFO_SOURCE, GObject)
+
+SpSource *sp_hostinfo_source_new (void);
+
+G_END_DECLS
+
+#endif /* SP_HOSTINFO_SOURCE_H */
+
diff --git a/lib/sp-visualizer-row.c b/lib/sp-visualizer-row.c
new file mode 100644
index 0000000..c601888
--- /dev/null
+++ b/lib/sp-visualizer-row.c
@@ -0,0 +1,41 @@
+/* sp-visualizer-row.c
+ *
+ * Copyright (C) 2016 Christian Hergert <christian hergert me>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "sp-visualizer-row.h"
+
+G_DEFINE_ABSTRACT_TYPE (SpVisualizerRow, sp_visualizer_row, GTK_TYPE_LIST_BOX_ROW)
+
+static void
+sp_visualizer_row_class_init (SpVisualizerRowClass *klass)
+{
+}
+
+static void
+sp_visualizer_row_init (SpVisualizerRow *self)
+{
+}
+
+void
+sp_visualizer_row_set_reader (SpVisualizerRow *self,
+                              SpCaptureReader *reader)
+{
+  g_return_if_fail (SP_IS_VISUALIZER_ROW (self));
+
+  if (SP_VISUALIZER_ROW_GET_CLASS (self)->set_reader)
+    SP_VISUALIZER_ROW_GET_CLASS (self)->set_reader (self, reader);
+}
diff --git a/lib/sp-visualizer-row.h b/lib/sp-visualizer-row.h
new file mode 100644
index 0000000..137fdd8
--- /dev/null
+++ b/lib/sp-visualizer-row.h
@@ -0,0 +1,52 @@
+/* sp-visualizer-row.h
+ *
+ * Copyright (C) 2016 Christian Hergert <christian hergert me>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef SP_VISUALIZER_ROW_H
+#define SP_VISUALIZER_ROW_H
+
+#include <gtk/gtk.h>
+
+#include "sp-capture-reader.h"
+
+G_BEGIN_DECLS
+
+#define SP_TYPE_VISUALIZER_ROW (sp_visualizer_row_get_type())
+
+G_DECLARE_DERIVABLE_TYPE (SpVisualizerRow, sp_visualizer_row, SP, VISUALIZER_ROW, GtkListBoxRow)
+
+struct _SpVisualizerRowClass
+{
+  GtkListBoxRowClass parent_class;
+
+  /**
+   * SpVisualizerRow::set_reader:
+   *
+   * Sets the reader that the row should use to extract counters.
+   * This reader is private to the row and should be freed when
+   * no longer in use with sp_capture_reader_unref().
+   */
+  void (*set_reader) (SpVisualizerRow *self,
+                      SpCaptureReader *reader);
+};
+
+void sp_visualizer_row_set_reader (SpVisualizerRow *self,
+                                   SpCaptureReader *reader);
+
+G_END_DECLS
+
+#endif /* SP_VISUALIZER_ROW_H */
diff --git a/lib/sysprof-ui.h b/lib/sysprof-ui.h
index 6212ece..569249f 100644
--- a/lib/sysprof-ui.h
+++ b/lib/sysprof-ui.h
@@ -26,6 +26,7 @@ G_BEGIN_DECLS
 #define SYSPROF_INSIDE
 # include "sp-callgraph-view.h"
 # include "sp-cell-renderer-percent.h"
+# include "sp-column-visualizer-row.h"
 # include "sp-empty-state-view.h"
 # include "sp-model-filter.h"
 # include "sp-recording-state-view.h"
@@ -34,6 +35,7 @@ G_BEGIN_DECLS
 # include "sp-process-model-row.h"
 # include "sp-profiler-menu-button.h"
 # include "sp-scrolled-window.h"
+# include "sp-visualizer-row.h"
 #undef SYSPROF_INSIDE
 
 G_END_DECLS
diff --git a/lib/sysprof.h b/lib/sysprof.h
index 0ff7db7..30e17c9 100644
--- a/lib/sysprof.h
+++ b/lib/sysprof.h
@@ -32,6 +32,7 @@ G_BEGIN_DECLS
 # include "sp-elf-symbol-resolver.h"
 # include "sp-error.h"
 # include "sp-gjs-source.h"
+# include "sp-hostinfo-source.h"
 # include "sp-jitmap-symbol-resolver.h"
 # include "sp-kernel-symbol-resolver.h"
 # include "sp-kernel-symbol.h"
diff --git a/src/resources/theme/shared.css b/src/resources/theme/shared.css
index 3d4da45..b7c73f1 100644
--- a/src/resources/theme/shared.css
+++ b/src/resources/theme/shared.css
@@ -1,8 +1,10 @@
+paned list row,
 popover list row {
   padding: 6px 10px 6px 10px;
   border-bottom: 1px solid alpha(@borders, 0.2);
 }
 
+paned list row:last-child,
 popover list row:last-child {
   border-bottom: none;
 }
diff --git a/src/resources/ui/sp-window.ui b/src/resources/ui/sp-window.ui
index 298c464..20af795 100644
--- a/src/resources/ui/sp-window.ui
+++ b/src/resources/ui/sp-window.ui
@@ -159,8 +159,40 @@
               </packing>
             </child>
             <child>
-              <object class="SpCallgraphView" id="callgraph_view">
+              <object class="GtkPaned">
+                <property name="orientation">vertical</property>
                 <property name="visible">true</property>
+                <child>
+                  <object class="SpScrolledWindow">
+                    <property name="min-content-height">75</property>
+                    <property name="max-content-height">225</property>
+                    <property name="visible">true</property>
+                    <child>
+                      <object class="GtkListBox" id="visuals_list_box">
+                        <property name="visible">true</property>
+                        <child>
+                          <object class="SpColumnVisualizerRow">
+                            <property name="height-request">75</property>
+                            <property name="selectable">false</property>
+                            <property name="visible">true</property>
+                          </object>
+                        </child>
+                        <child>
+                          <object class="SpColumnVisualizerRow">
+                            <property name="height-request">75</property>
+                            <property name="selectable">false</property>
+                            <property name="visible">true</property>
+                          </object>
+                        </child>
+                      </object>
+                    </child>
+                  </object>
+                </child>
+                <child>
+                  <object class="SpCallgraphView" id="callgraph_view">
+                    <property name="visible">true</property>
+                  </object>
+                </child>
               </object>
               <packing>
                 <property name="name">browsing</property>
diff --git a/src/sp-window.c b/src/sp-window.c
index 36c0e8f..cd6dbca 100644
--- a/src/sp-window.c
+++ b/src/sp-window.c
@@ -356,6 +356,7 @@ static void
 sp_window_add_sources (SpWindow   *window,
                        SpProfiler *profiler)
 {
+  g_autoptr(SpSource) host_source = NULL;
   g_autoptr(SpSource) proc_source = NULL;
   g_autoptr(SpSource) perf_source = NULL;
 
@@ -367,6 +368,9 @@ sp_window_add_sources (SpWindow   *window,
 
   perf_source = sp_perf_source_new ();
   sp_profiler_add_source (profiler, perf_source);
+
+  host_source = sp_hostinfo_source_new ();
+  sp_profiler_add_source (profiler, host_source);
 }
 
 static void


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