summaryrefslogtreecommitdiffstats
path: root/runtime/map.h
diff options
context:
space:
mode:
authorhunt <hunt>2005-12-07 20:02:04 +0000
committerhunt <hunt>2005-12-07 20:02:04 +0000
commit953c5ad1c72d55e3c017e7975becfa175ccdf7f5 (patch)
tree27b47f177cdf09bf266a60f1bff9113953270ee4 /runtime/map.h
parent872d26246196a87da8551661635cce52c8e5ed3a (diff)
downloadsystemtap-steved-953c5ad1c72d55e3c017e7975becfa175ccdf7f5.tar.gz
systemtap-steved-953c5ad1c72d55e3c017e7975becfa175ccdf7f5.tar.xz
systemtap-steved-953c5ad1c72d55e3c017e7975becfa175ccdf7f5.zip
2005-12-07 Martin Hunt <hunt@redhat.com>
PR1923 * map.h (struct map_root): Remove membuf. (struct pmap): Define. (PMAP): Declare. * map.c (_stp_map_init): Use kmalloc() to allocate individual nodes instead of using vmalloc() to allocate one big chunk. (_stp_map_new): Use kmalloc. (_stp_pmap_new): Use kmalloc. Return a PMAP. (__stp_map_del): New function. Free all the nodes in a map. (_stp_map_del): Call __stp_map_del() then free map struct. (_stp_pmap_del): Takes a PMAP. Calls __stp_map_del() for each cpu. (_stp_pmap_printn_cpu): Change arg to PMAP. (_stp_pmap_agg): Change arg to PMAP. (_stp_pmap_get_agg): Change arg to PMAP. * map-stat.c (_stp_pmap_new_hstat_linear): Use PMAP instead of MAP. Fix allocations. (_stp_pmap_new_hstat_log): Ditto. * pmap-gen.c Fix all functions to take or return PMAPS instead of MAPS. * alloc.c: Remove everything except kmalloc_node(). All runtime code now uses kmalloc() directly.
Diffstat (limited to 'runtime/map.h')
-rw-r--r--runtime/map.h21
1 files changed, 11 insertions, 10 deletions
diff --git a/runtime/map.h b/runtime/map.h
index f414f73b..cc470e19 100644
--- a/runtime/map.h
+++ b/runtime/map.h
@@ -105,9 +105,6 @@ struct map_root {
/* the hash table for this array */
struct hlist_head hashes[HASH_TABLE_SIZE];
- /* pointer to allocated memory space. Used for freeing memory. */
- void *membuf;
-
/* used if this map's nodes contain stats */
struct _Hist hist;
};
@@ -115,6 +112,12 @@ struct map_root {
/** All maps are of this type. */
typedef struct map_root *MAP;
+struct pmap {
+ MAP map; /* per-cpu maps */
+ struct map_root agg; /* aggregation map */
+};
+typedef struct pmap *PMAP;
+
/** Extracts string from key1 union */
#define key1str(ptr) (_stp_key_get_str(ptr,1))
/** Extracts string from key2 union */
@@ -161,7 +164,7 @@ char * _stp_get_str(struct map_node *m);
stat *_stp_get_stat(struct map_node *m);
unsigned int str_hash(const char *key1);
static MAP _stp_map_new(unsigned max_entries, int type, int key_size, int data_size);
-static MAP _stp_pmap_new(unsigned max_entries, int type, int key_size, int data_size);
+static PMAP _stp_pmap_new(unsigned max_entries, int type, int key_size, int data_size);
static int msb64(int64_t x);
static MAP _stp_map_new_hstat_log(unsigned max_entries, int key_size, int buckets);
static MAP _stp_map_new_hstat_linear(unsigned max_entries, int ksize, int start, int stop, int interval);
@@ -174,16 +177,14 @@ void _stp_map_print(MAP map, const char *fmt);
static struct map_node *_new_map_create (MAP map, struct hlist_head *head);
static int _new_map_set_int64 (MAP map, struct map_node *n, int64_t val, int add);
-static int64_t _new_map_get_int64 (MAP map, struct map_node *n);
-static char *_new_map_get_str (MAP map, struct map_node *n);
static int _new_map_set_str (MAP map, struct map_node *n, char *val, int add);
-static stat *_new_map_get_stat (MAP map, struct map_node *n);
-static int _new_map_set_stat (MAP map, struct map_node *n, int64_t val, int add);
static void _new_map_clear_node (struct map_node *);
static void _new_map_del_node (MAP map, struct map_node *n);
-static MAP _stp_pmap_new_hstat_linear (unsigned max_entries, int ksize, int start, int stop, int interval);
-static MAP _stp_pmap_new_hstat_log (unsigned max_entries, int key_size, int buckets);
+static PMAP _stp_pmap_new_hstat_linear (unsigned max_entries, int ksize, int start, int stop, int interval);
+static PMAP _stp_pmap_new_hstat_log (unsigned max_entries, int key_size, int buckets);
static void _stp_add_agg(struct map_node *aptr, struct map_node *ptr);
static struct map_node *_stp_new_agg(MAP agg, struct hlist_head *ahead, struct map_node *ptr);
+static void __stp_map_del(MAP map);
+static int _new_map_set_stat (MAP map, struct map_node *n, int64_t val, int add);
/** @endcond */
#endif /* _MAP_H_ */