From 0e17516991aaf562aa9d30e77f1140d9371d5fb9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ji=C5=99=C3=AD=20Filipovi=C4=8D?= Date: Mon, 18 Oct 2010 12:52:38 +0000 Subject: [PATCH] - fixed statistics when some full cells are out of queried interval - remove negative values from from-to statistics --- org.glite.lb.server/src/stats.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/org.glite.lb.server/src/stats.c b/org.glite.lb.server/src/stats.c index 96e7080..735b9a7 100644 --- a/org.glite.lb.server/src/stats.c +++ b/org.glite.lb.server/src/stats.c @@ -489,7 +489,7 @@ static int stats_record_duration_fromto( time_t base = to->stateEnterTimes[stats->base_state+1]; time_t final = to->stateEnterTimes[stats->final_state+1]; time_t timedif = final-base; - if (base && final){ /* final should be always not null*/ + if (base && final && (final > base)){ /* final should be always not null*/ a = g->archive; for (i=0; stats->archives[i].interval; i++) { @@ -667,6 +667,8 @@ static int stateRateRequest( glite_common_log(LOG_CATEGORY_LB_SERVER, LOG_PRIORITY_DEBUG, "search %ld in %ld, %ld", *from, afrom, afrom+i); + diff = 0.0f; + // (from, to) is inside (afrom, afrom+i) if (*from >= afrom && *to < afrom+i) { diff = *to - *from; @@ -892,6 +894,8 @@ static int stateDurationFromToRequest( glite_common_log(LOG_CATEGORY_LB_SERVER, LOG_PRIORITY_DEBUG, "search %ld in %ld, %ld", *from, afrom, afrom+i); + diff = 0.0f; + // (from, to) is inside (afrom, afrom+i) if (*from >= afrom && *to < afrom+i) { diff = *to - *from; -- 1.8.2.3