From 3a18979dd18ba8cdd96367d2ad18c456f26c6f20 Mon Sep 17 00:00:00 2001 From: hunt Date: Wed, 12 Sep 2007 18:37:47 +0000 Subject: 2007-09-12 Martin Hunt * map-stat.c (_stp_map_new_hstat_log): Set buckets to HIST_LOG_BUCKETS. (_stp_pmap_new_hstat_log): Ditto. (_stp_map_new_hstat_linear): Call _stp_stat_calc_buckets(). (_stp_pmap_new_hstat_linear): Ditto. * stat.h (STP_MAX_BUCKETS): Define.. (HIST_LOG_BUCKETS): Define. * stat.c (_stp_stat_init): Call _stp_stat_calc_buckets(). * stat-common.c (_stp_stat_calc_buckets): New function. Common bucket calculation and error reporting code. (_stp_bucket_to_val): New function. (_stp_val_to_bucket): Renamed and now handles negative numbers. (_stp_stat_print_histogram): Handle negative values in log histograms. (__stp_stat_add): Cleanup.. * map-gen.c (_stp_map_new): Remove buckets param for HIST_LOG. * pmap-gen.c (_stp_pmap_new): Ditto. --- runtime/map-gen.c | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) (limited to 'runtime/map-gen.c') diff --git a/runtime/map-gen.c b/runtime/map-gen.c index e662e71e..a17f7e34 100644 --- a/runtime/map-gen.c +++ b/runtime/map-gen.c @@ -346,25 +346,20 @@ MAP KEYSYM(_stp_map_new) (unsigned max_entries) } #else /* _stp_map_new_key1_key2...val (num, HIST_LINEAR, start, end, interval) */ -/* _stp_map_new_key1_key2...val (num, HIST_LOG, buckets) */ +/* _stp_map_new_key1_key2...val (num, HIST_LOG) */ MAP KEYSYM(_stp_map_new) (unsigned max_entries, int htype, ...) { - int buckets=0, start=0, stop=0, interval=0; + int start=0, stop=0, interval=0; MAP m; - va_list ap; - if (htype != HIST_NONE) { + if (htype == HIST_LINEAR) { + va_list ap; va_start (ap, htype); - if (htype == HIST_LOG) { - buckets = va_arg(ap, int); - // 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); - } + 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); va_end (ap); } @@ -373,8 +368,7 @@ MAP KEYSYM(_stp_map_new) (unsigned max_entries, int htype, ...) m = _stp_map_new (max_entries, STAT, sizeof(struct KEYSYM(map_node)), 0); break; case HIST_LOG: - m = _stp_map_new_hstat_log (max_entries, sizeof(struct KEYSYM(map_node)), - buckets); + m = _stp_map_new_hstat_log (max_entries, sizeof(struct KEYSYM(map_node))); break; case HIST_LINEAR: m = _stp_map_new_hstat_linear (max_entries, sizeof(struct KEYSYM(map_node)), -- cgit