diff options
author | hunt <hunt> | 2005-07-01 19:21:02 +0000 |
---|---|---|
committer | hunt <hunt> | 2005-07-01 19:21:02 +0000 |
commit | 9a45e491a7365db5178c4b6c33804ce3fc07ffe0 (patch) | |
tree | c1124725acd64bcf997f2d3035bcfb335bd6858e | |
parent | 5c826f9de142a9d4558e0b3aefab9c90d70c8c54 (diff) | |
download | systemtap-steved-9a45e491a7365db5178c4b6c33804ce3fc07ffe0.tar.gz systemtap-steved-9a45e491a7365db5178c4b6c33804ce3fc07ffe0.tar.xz systemtap-steved-9a45e491a7365db5178c4b6c33804ce3fc07ffe0.zip |
2005-07-01 Martin Hunt <hunt@redhat.com>
* map.c (_stp_map_new): Call _stp_error() on a bad map type.
Comment out dbug()s.
* map-stat.c (_stp_map_new_hstat_log): Call _stp_warn().
(_stp_map_new_hstat_linear): Ditto.
* map-int.c: Comment out dbug()s.
* map-str.c: Comment out dbug()s.
* map-keys.c: Use _stp_warn(). Comment out dbug()s.
-rw-r--r-- | runtime/ChangeLog | 12 | ||||
-rw-r--r-- | runtime/map-int.c | 14 | ||||
-rw-r--r-- | runtime/map-keys.c | 25 | ||||
-rw-r--r-- | runtime/map-stat.c | 14 | ||||
-rw-r--r-- | runtime/map-str.c | 4 | ||||
-rw-r--r-- | runtime/map.c | 19 |
6 files changed, 60 insertions, 28 deletions
diff --git a/runtime/ChangeLog b/runtime/ChangeLog index 540e9239..61338c35 100644 --- a/runtime/ChangeLog +++ b/runtime/ChangeLog @@ -1,5 +1,17 @@ 2005-07-01 Martin Hunt <hunt@redhat.com> + * map.c (_stp_map_new): Call _stp_error() on a bad map type. + Comment out dbug()s. + + * map-stat.c (_stp_map_new_hstat_log): Call _stp_warn(). + (_stp_map_new_hstat_linear): Ditto. + + * map-int.c: Comment out dbug()s. + + * map-str.c: Comment out dbug()s. + + * map-keys.c: Use _stp_warn(). Comment out dbug()s. + * alloc.c (_stp_alloc): Call _stp_error(). (_stp_valloc): Ditto. diff --git a/runtime/map-int.c b/runtime/map-int.c index fd362eb8..cf6363c6 100644 --- a/runtime/map-int.c +++ b/runtime/map-int.c @@ -1,4 +1,12 @@ -/* -*- linux-c -*- */ +/* -*- linux-c -*- + * map functions to handle integer values + * Copyright (C) 2005 Red Hat Inc. + * + * This file is part of systemtap, and is free software. You can + * redistribute it and/or modify it under the terms of the GNU General + * Public License (GPL); either version 2, or (at your option) any + * later version. + */ /** @file map-int.c * @brief Map functions to set and get int64s @@ -20,7 +28,7 @@ void __stp_map_set_int64 (MAP map, int64_t val, int add) return; /* set the value */ - dbug ("m=%lx offset=%lx\n", (long)m, (long)map->data_offset); + //dbug ("m=%lx offset=%lx\n", (long)m, (long)map->data_offset); *(int64_t *)((long)m + map->data_offset) = val; } else { if (map->key == NULL) @@ -66,7 +74,7 @@ int64_t _stp_map_get_int64 (MAP map) struct map_node *m; if (map == NULL || map->create || map->key == NULL) return 0; - dbug ("key %lx\n", (long)map->key); + //dbug ("key %lx\n", (long)map->key); m = (struct map_node *)map->key; return *(int64_t *)((long)m + map->data_offset); } diff --git a/runtime/map-keys.c b/runtime/map-keys.c index 1dd78f30..898e50a6 100644 --- a/runtime/map-keys.c +++ b/runtime/map-keys.c @@ -1,4 +1,13 @@ -/* -*- linux-c -*- */ +/* -*- linux-c -*- + * map functions to handle keys + * Copyright (C) 2005 Red Hat Inc. + * + * This file is part of systemtap, and is free software. You can + * redistribute it and/or modify it under the terms of the GNU General + * Public License (GPL); either version 2, or (at your option) any + * later version. + */ + /** @file map-keys.c * @brief Map functions to set and get keys * This file is a template designed to be included as many times as @@ -168,7 +177,7 @@ static key_data KEYSYM(map_get_key) (struct map_node *mn, int n, int *type) key_data ptr; struct KEYSYM(map_node) *m = (struct KEYSYM(map_node) *)mn; - dbug ("m=%lx\n", (long)m); + // dbug ("m=%lx\n", (long)m); if (n > KEY_ARITY || n < 1) { if (type) *type = END; @@ -285,7 +294,7 @@ MAP KEYSYM(_stp_map_new) (unsigned max_entries, int valtype, ...) MAP m; htype = valtype >> 8; - dbug ("htype=%d\n", htype); + // dbug ("htype=%d\n", htype); if (htype != HIST_NONE) { va_list ap; @@ -293,12 +302,12 @@ MAP KEYSYM(_stp_map_new) (unsigned max_entries, int valtype, ...) if (htype == HIST_LOG) { buckets = va_arg(ap, int); - dbug ("buckets=%d\n", buckets); + // dbug ("buckets=%d\n", buckets); } else { start = va_arg(ap, int); stop = va_arg(ap, int); interval = va_arg(ap, int); - dbug ("start=%d stop=%d interval=%d\n", start, stop, interval); + // dbug ("start=%d stop=%d interval=%d\n", start, stop, interval); } va_end (ap); } @@ -318,7 +327,7 @@ MAP KEYSYM(_stp_map_new) (unsigned max_entries, int valtype, ...) break; #endif default: - dbug ("ERROR: unknown histogram type %d\n", htype); + _stp_warn ("Unknown histogram type %d\n", htype); m = NULL; } @@ -361,13 +370,11 @@ void KEYSYM(_stp_map_key) (MAP map, ALLKEYSD(key)) #endif ) { map->key = (struct map_node *)n; - dbug ("saving key %lx\n", (long)map->key); + // dbug ("saving key %lx\n", (long)map->key); map->create = 0; return; } } - - dbug ("key not found\n"); map->c_key[0] = (key_data)key1; #if KEY_ARITY > 1 map->c_key[1] = (key_data)key2; diff --git a/runtime/map-stat.c b/runtime/map-stat.c index a98f8b87..ea76d654 100644 --- a/runtime/map-stat.c +++ b/runtime/map-stat.c @@ -1,4 +1,12 @@ -/* -*- linux-c -*- */ +/* -*- linux-c -*- + * map functions to handle statistics + * Copyright (C) 2005 Red Hat Inc. + * + * This file is part of systemtap, and is free software. You can + * redistribute it and/or modify it under the terms of the GNU General + * Public License (GPL); either version 2, or (at your option) any + * later version. + */ /** @file map-stat.c * @brief Map functions to set and get stats @@ -48,7 +56,7 @@ static MAP _stp_map_new_hstat_log (unsigned max_entries, int key_size, int bucke m->hist_type = HIST_LOG; m->hist_buckets = buckets; if (buckets < 1 || buckets > 64) { - dbug ("histogram: Bad number of buckets. Must be between 1 and 64\n"); + _stp_warn("histogram: Bad number of buckets. Must be between 1 and 64\n"); m->hist_type = HIST_NONE; return m; } @@ -74,7 +82,7 @@ static MAP _stp_map_new_hstat_linear (unsigned max_entries, int ksize, int start m->hist_int = interval; m->hist_buckets = buckets; if (m->hist_buckets <= 0) { - dbug ("histogram: bad stop, start and/or interval\n"); + _stp_warn("histogram: bad stop, start and/or interval\n"); m->hist_type = HIST_NONE; return m; } diff --git a/runtime/map-str.c b/runtime/map-str.c index 344feeb6..e5e5b5e4 100644 --- a/runtime/map-str.c +++ b/runtime/map-str.c @@ -36,7 +36,7 @@ void __stp_map_set_str (MAP map, char *val, int add) return; /* set the value */ - dbug ("m=%lx offset=%lx\n", (long)m, (long)map->data_offset); + //dbug ("m=%lx offset=%lx\n", (long)m, (long)map->data_offset); str_copy((void *)((long)m + map->data_offset), val); } else { if (map->key == NULL) @@ -94,7 +94,7 @@ char *_stp_map_get_str (MAP map) struct map_node *m; if (map == NULL || map->create || map->key == NULL) return 0; - dbug ("key %lx\n", (long)map->key); + //dbug ("key %lx\n", (long)map->key); m = (struct map_node *)map->key; return (char *)((long)m + map->data_offset); } diff --git a/runtime/map.c b/runtime/map.c index 9d9b1fa2..179f5098 100644 --- a/runtime/map.c +++ b/runtime/map.c @@ -149,7 +149,7 @@ static MAP _stp_map_new(unsigned max_entries, int type, int key_size, int data_s m->maxnum = max_entries; m->type = type; if (type >= END) { - dbug ("map_new: unknown type %d\n", type); + _stp_error("map_new: unknown type %d\n", type); return NULL; } if (max_entries) { @@ -172,7 +172,7 @@ static MAP _stp_map_new(unsigned max_entries, int type, int key_size, int data_s for (i = max_entries - 1; i >= 0; i--) { e = i * size + tmp; - dbug ("e=%lx\n", (long)e); + //dbug ("e=%lx\n", (long)e); list_add(e, &m->pool); ((struct map_node *)e)->map = m; } @@ -193,7 +193,7 @@ void _stp_map_key_del(MAP map) { struct map_node *m; - dbug ("create=%d key=%lx\n", map->create, (long)map->key); + //dbug("create=%d key=%lx\n", map->create, (long)map->key); if (map == NULL) return; @@ -233,7 +233,7 @@ struct map_node *_stp_map_start(MAP map) if (map == NULL) return NULL; - dbug ("%lx\n", (long)map->head.next); + //dbug ("%lx\n", (long)map->head.next); if (list_empty(&map->head)) return NULL; @@ -256,9 +256,6 @@ struct map_node *_stp_map_iter(MAP map, struct map_node *m) if (map == NULL) return NULL; - dbug ("%lx next=%lx prev=%lx map->head.next=%lx\n", (long)m, - (long)m->lnode.next, (long)m->lnode.prev, (long)map->head.next); - if (m->lnode.next == &map->head) return NULL; @@ -280,7 +277,7 @@ void _stp_map_del(MAP map) static int print_keytype (char *fmt, int type, key_data *kd) { - dbug ("*fmt = %c\n", *fmt); + //dbug ("*fmt = %c\n", *fmt); switch (type) { case STRING: if (*fmt != 's') @@ -363,7 +360,7 @@ void _stp_map_print (MAP map, const char *fmt) struct map_node *ptr; int type, num; key_data kd; - dbug ("print map %lx fmt=%s\n", (long)map, fmt); + //dbug ("print map %lx fmt=%s\n", (long)map, fmt); foreach (map, ptr) { char *f = (char *)fmt; @@ -397,10 +394,10 @@ static struct map_node *__stp_map_create (MAP map) } m = (struct map_node *)map->head.next; hlist_del_init(&m->hnode); - dbug ("got %lx off head\n", (long)m); + //dbug ("got %lx off head\n", (long)m); } else { m = (struct map_node *)map->pool.next; - dbug ("got %lx off pool\n", (long)m); + //dbug ("got %lx off pool\n", (long)m); } list_move_tail(&m->lnode, &map->head); |