- fixed statistics when some full cells are out of queried interval
authorJiří Filipovič <fila@ics.muni.cz>
Mon, 18 Oct 2010 12:52:38 +0000 (12:52 +0000)
committerJiří Filipovič <fila@ics.muni.cz>
Mon, 18 Oct 2010 12:52:38 +0000 (12:52 +0000)
- remove negative values from from-to statistics

org.glite.lb.server/src/stats.c

index 96e7080..735b9a7 100644 (file)
@@ -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;