diff options
author | hunt <hunt> | 2007-07-06 18:42:00 +0000 |
---|---|---|
committer | hunt <hunt> | 2007-07-06 18:42:00 +0000 |
commit | 7d291bee3622b18c16d53a359a230306b67203f9 (patch) | |
tree | edf05c50d9803b186f42cee66dd9965ed58c37c8 /runtime/stat.c | |
parent | b0abf39b95d679bb9563f185f2206460b08724b4 (diff) | |
download | systemtap-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.c | 9 |
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); } |