[sysprof] callgraph: add accessor to determine number of functions



commit ceeb29b0e65ff5230699797d3205d52c9a29c8a8
Author: Christian Hergert <christian hergert me>
Date:   Fri Apr 15 18:11:02 2016 -0700

    callgraph: add accessor to determine number of functions
    
    We can use this to notify the user that not enough samples where collected
    to build a callgraph. This can happen when all the samples collected are
    ignored (due to being in ignored kernel space address ranges for example).

 lib/sp-callgraph-view.c |   15 +++++++++++++++
 lib/sp-callgraph-view.h |   11 ++++++-----
 2 files changed, 21 insertions(+), 5 deletions(-)
---
diff --git a/lib/sp-callgraph-view.c b/lib/sp-callgraph-view.c
index d689412..02cc17b 100644
--- a/lib/sp-callgraph-view.c
+++ b/lib/sp-callgraph-view.c
@@ -1001,3 +1001,18 @@ sp_callgraph_view_screenshot (SpCallgraphView *self)
 
   return g_string_free (str, FALSE);
 }
+
+guint
+sp_callgraph_view_get_n_functions (SpCallgraphView *self)
+{
+  SpCallgraphViewPrivate *priv = sp_callgraph_view_get_instance_private (self);
+  GtkTreeModel *model;
+  guint ret = 0;
+
+  g_return_val_if_fail (SP_IS_CALLGRAPH_VIEW (self), 0);
+
+  if (NULL != (model = gtk_tree_view_get_model (priv->functions_view)))
+    ret = gtk_tree_model_iter_n_children (model, NULL);
+
+  return ret;
+}
diff --git a/lib/sp-callgraph-view.h b/lib/sp-callgraph-view.h
index a90e9b2..40495ee 100644
--- a/lib/sp-callgraph-view.h
+++ b/lib/sp-callgraph-view.h
@@ -38,11 +38,12 @@ struct _SpCallgraphViewClass
   gpointer padding[8];
 };
 
-GtkWidget          *sp_callgraph_view_new         (void);
-SpCallgraphProfile *sp_callgraph_view_get_profile (SpCallgraphView    *self);
-void                sp_callgraph_view_set_profile (SpCallgraphView    *self,
-                                                   SpCallgraphProfile *profile);
-gchar              *sp_callgraph_view_screenshot  (SpCallgraphView    *self);
+GtkWidget          *sp_callgraph_view_new             (void);
+SpCallgraphProfile *sp_callgraph_view_get_profile     (SpCallgraphView    *self);
+void                sp_callgraph_view_set_profile     (SpCallgraphView    *self,
+                                                       SpCallgraphProfile *profile);
+gchar              *sp_callgraph_view_screenshot      (SpCallgraphView    *self);
+guint               sp_callgraph_view_get_n_functions (SpCallgraphView    *self);
 
 G_END_DECLS
 


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