]> sourceware.org Git - systemtap.git/commitdiff
2005-12-08 Martin Hunt <hunt@redhat.com>
authorhunt <hunt>
Thu, 8 Dec 2005 18:57:45 +0000 (18:57 +0000)
committerhunt <hunt>
Thu, 8 Dec 2005 18:57:45 +0000 (18:57 +0000)
* map.c (_new_map_create): Only increment map size if a node
was moved off the free list.
(_stp_map_size): New function.
(_stp_pmap_size): New function.

runtime/ChangeLog
runtime/map.c

index 1e0ae77863af5960023932df1ca310b013c473db..ee355cf55807e5a60affa22e0c867b686f508d5d 100644 (file)
@@ -1,3 +1,10 @@
+2005-12-08  Martin Hunt  <hunt@redhat.com>
+
+       * map.c (_new_map_create): Only increment map size if a node
+       was moved off the free list.
+       (_stp_map_size): New function.
+       (_stp_pmap_size): New function. 
+
 2005-12-07  Martin Hunt  <hunt@redhat.com>
         PR1923
        * map.h (struct map_root): Remove membuf.
index fa4150fe0ddb77cc841cc4796dc981577ce9e794..19c02580bb7cd7befe8a8ca0c396828050b2a827 100644 (file)
@@ -926,14 +926,13 @@ static struct map_node *_new_map_create (MAP map, struct hlist_head *head)
                hlist_del_init(&m->hnode);
        } else {
                m = (struct map_node *)map->pool.next;
+               map->num++;
                dbug ("got %lx off pool\n", (long)m);
        }
        list_move_tail(&m->lnode, &map->head);
        
        /* add node to new hash list */
        hlist_add_head(&m->hnode, head);
-
-       map->num++;
        return m;
 }
 
@@ -1000,5 +999,31 @@ static int _new_map_set_stat (MAP map, struct map_node *n, int64_t val, int add)
        return 0;
 }
 
+/** Return the number of elements in a map
+ * This function will return the number of active elements
+ * in a map.
+ * @param map 
+ * @returns an int
+ */
+#define _stp_map_size(map) (map->num)
+
+/** Return the number of elements in a pmap
+ * This function will return the number of active elements
+ * in all the per-cpu maps in a pmap. This is a quick sum and is
+ * not the same as the number of unique elements that would
+ * be in the aggragated map.
+ * @param pmap 
+ * @returns an int
+ */
+int _stp_pmap_size (PMAP pmap)
+{
+       int i, num = 0;
+
+       for_each_cpu(i) {
+               MAP m = per_cpu_ptr (pmap->map, i);
+               num += m->num;
+       }
+       return num;
+}
 #endif /* _MAP_C_ */
 
This page took 0.027259 seconds and 5 git commands to generate.