summaryrefslogtreecommitdiffstats
path: root/runtime/map.c
diff options
context:
space:
mode:
authorhunt <hunt>2005-11-10 21:22:35 +0000
committerhunt <hunt>2005-11-10 21:22:35 +0000
commit8d948813b76c1cbeb91379c3a701b95114266243 (patch)
treef3ff657e3a4697ed9ea7eeef82e4ee4e0a45a8fb /runtime/map.c
parentc4f0340669f6c859bfd66e277f235bac457d65d1 (diff)
downloadsystemtap-steved-8d948813b76c1cbeb91379c3a701b95114266243.tar.gz
systemtap-steved-8d948813b76c1cbeb91379c3a701b95114266243.tar.xz
systemtap-steved-8d948813b76c1cbeb91379c3a701b95114266243.zip
2005-11-10 Martin Hunt <hunt@redhat.com>
* map.c: Doc updates. * pmap-gen.c: Change a bunch of generated function names to avoid conflicts with maps with the same key and value types.
Diffstat (limited to 'runtime/map.c')
-rw-r--r--runtime/map.c32
1 files changed, 21 insertions, 11 deletions
diff --git a/runtime/map.c b/runtime/map.c
index 76f8b87b..f962bfe5 100644
--- a/runtime/map.c
+++ b/runtime/map.c
@@ -795,7 +795,16 @@ static void _stp_add_agg(struct map_node *aptr, struct map_node *ptr)
}
}
-void _stp_pmap_agg (MAP map)
+/** Aggregate per-cpu maps.
+ * This function aggregates the per-cpu maps into an aggregated
+ * map. A pointer to that aggregated map is returned.
+ *
+ * A write lock must be held on the map during this function.
+ *
+ * @param map A pointer to a pmap.
+ * @returns a pointer to an aggregated map.
+ */
+MAP _stp_pmap_agg (MAP map)
{
int i, hash;
MAP m, agg;
@@ -810,7 +819,6 @@ void _stp_pmap_agg (MAP map)
_stp_map_clear (agg);
for_each_cpu(i) {
- dbug("cpu %d\n", i);
m = per_cpu_ptr (map, i);
/* walk the hash chains. */
for (hash = 0; hash < HASH_TABLE_SIZE; hash++) {
@@ -833,18 +841,20 @@ void _stp_pmap_agg (MAP map)
}
}
}
+ return agg;
}
-#define AGG_PMAP(map) (_stp_percpu_dptr(map))
-
-void _stp_pmap_printn(MAP map, int n, const char *fmt)
-{
- MAP m = _stp_percpu_dptr(map);
- _stp_pmap_agg(map);
- _stp_map_printn (m, n, fmt);
-}
-#define _stp_pmap_print(map,fmt) _stp_pmap_printn(map,0,fmt)
+/** Get the aggregation map for a pmap.
+ * This function returns a pointer to the aggregation map.
+ * It does not do any aggregation.
+ * @param map A pointer to a pmap.
+ * @returns a pointer to an aggregated map.
+ * @sa _stp_pmap_agg()
+ */
+#define _stp_pmap_get_agg(map) (_stp_percpu_dptr(map))
+#define _stp_pmap_printn(map,n,fmt) _stp_map_printn (_stp_pmap_agg(map), n, fmt)
+#define _stp_pmap_print(map,fmt) _stp_map_printn(_stp_pmap_agg(map),0,fmt)
static void _new_map_clear_node (struct map_node *m)
{