summaryrefslogtreecommitdiffstats
path: root/runtime/stat-common.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-common.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-common.c')
-rw-r--r--runtime/stat-common.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/runtime/stat-common.c b/runtime/stat-common.c
index 48f8218a..9ca045c9 100644
--- a/runtime/stat-common.c
+++ b/runtime/stat-common.c
@@ -237,10 +237,9 @@ static void __stp_stat_add (Hist st, stat *sd, int64_t val)
sd->histogram[n]++;
break;
case HIST_LINEAR:
- if (val < st->start)
- val = st->start;
- else
- val -= st->start;
+ val -= st->start;
+ if (val < 0)
+ val = 0;
do_div (val, st->interval);
if (val >= st->buckets)
val = st->buckets - 1;