summaryrefslogtreecommitdiffstats
path: root/runtime/stat.c
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/stat.c')
-rw-r--r--runtime/stat.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/runtime/stat.c b/runtime/stat.c
index f4e205aa..3df1d063 100644
--- a/runtime/stat.c
+++ b/runtime/stat.c
@@ -85,21 +85,15 @@ Stat _stp_stat_init (int type, ...)
va_start (ap, type);
if (type == HIST_LOG) {
- buckets = va_arg(ap, int);
+ buckets = HIST_LOG_BUCKETS;
} else {
start = va_arg(ap, int);
stop = va_arg(ap, int);
interval = va_arg(ap, int);
- if (interval == 0) {
- _stp_warn("histogram: interval cannot be zero.\n");
- return NULL;
- }
- buckets = (stop - start) / interval;
- if ((stop - start) % interval) buckets++;
- if (buckets > 128) {
- _stp_warn("histogram: Interval is too small. Maximum buckets is 128.\n");
+
+ buckets = _stp_stat_calc_buckets(stop, start, interval);
+ if (!buckets)
return NULL;
- }
}
va_end (ap);
}