summaryrefslogtreecommitdiffstats
path: root/runtime/stat.c
diff options
context:
space:
mode:
authorhunt <hunt>2007-07-06 18:42:00 +0000
committerhunt <hunt>2007-07-06 18:42:00 +0000
commit7d291bee3622b18c16d53a359a230306b67203f9 (patch)
treeedf05c50d9803b186f42cee66dd9965ed58c37c8 /runtime/stat.c
parentb0abf39b95d679bb9563f185f2206460b08724b4 (diff)
downloadsystemtap-steved-7d291bee3622b18c16d53a359a230306b67203f9.tar.gz
systemtap-steved-7d291bee3622b18c16d53a359a230306b67203f9.tar.xz
systemtap-steved-7d291bee3622b18c16d53a359a230306b67203f9.zip
2007-07-06 Martin Hunt <hunt@redhat.com>
* stat-common.c (__stp_stat_add): Fix calculations for linear histogram buckets. * stat.c (_stp_stat_init): Check for interval too small.
Diffstat (limited to 'runtime/stat.c')
-rw-r--r--runtime/stat.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/runtime/stat.c b/runtime/stat.c
index cf224e5e..f4e205aa 100644
--- a/runtime/stat.c
+++ b/runtime/stat.c
@@ -90,9 +90,16 @@ Stat _stp_stat_init (int type, ...)
start = va_arg(ap, int);
stop = va_arg(ap, int);
interval = va_arg(ap, int);
- /* FIXME. check interval != 0 and not too large */
+ 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");
+ return NULL;
+ }
}
va_end (ap);
}