diff options
Diffstat (limited to 'src/histogram.c')
-rw-r--r-- | src/histogram.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/src/histogram.c b/src/histogram.c index 3a9b82c..f00ffc7 100644 --- a/src/histogram.c +++ b/src/histogram.c @@ -47,17 +47,20 @@ */ #include "headers.h" #include "histogram.h" +#include "Locale.h" +#include "util.h" #ifdef HAVE_THREAD_DEBUG // needed for thread_debug #include "Thread.h" #endif struct histogram *histogram_init(unsigned int bincount, unsigned int binwidth, float offset, float units,\ - double ci_lower, double ci_upper, unsigned int id, char *name) { + double ci_lower, double ci_upper, unsigned int id, char *name, bool Omit) { struct histogram *this = (struct histogram *) malloc(sizeof(struct histogram)); if (!this) { fprintf(stderr,"Malloc failure in histogram init\n"); return(NULL); } + this->Omit = Omit; if (!bincount) bincount = 1000; this->mybins = (unsigned int *) malloc(sizeof(unsigned int) * bincount); @@ -196,7 +199,7 @@ void histogram_print(struct histogram *h, double start, double end) { histogram_clear(h->prev); } if (!h->prev) { - h->prev = histogram_init(h->bincount, h->binwidth, h->offset, h->units, h->ci_lower, h->ci_upper, h->id, h->myname); + h->prev = histogram_init(h->bincount, h->binwidth, h->offset, h->units, h->ci_lower, h->ci_upper, h->id, h->myname, h->Omit); } int n = 0, ix, delta, lowerci, upperci, outliercnt, fence_lower, fence_upper, upper3stdev; int running=0; @@ -258,12 +261,18 @@ void histogram_print(struct histogram *h, double start, double end) { fprintf(stdout, "%s (%.2f/%.2f/99.7%%=%d/%d/%d,Outliers=%d,obl/obu=%d/%d)", \ h->outbuf, h->ci_lower, h->ci_upper, lowerci, upperci, upper3stdev, outliercnt, oob_l, oob_u); if (!h->final && (h->maxval > 0) && ((h->maxts.tv_sec > 0) || h->maxts.tv_usec > 0)) { - fprintf(stdout, " (%0.3f ms/%ld.%ld)\n", (h->maxval * 1e3), (long) h->maxts.tv_sec, (long) h->maxts.tv_usec); + fprintf(stdout, " (%0.3f ms/%ld.%ld)", (h->maxval * 1e3), (long) h->maxts.tv_sec, (long) h->maxts.tv_usec); + if (TimeDifference(h->prev->maxts, h->maxts) > 0) { + fprintf(stdout, "(clock_err)"); + } h->maxbin = -1; h->maxval = 0; + h->prev->maxts.tv_sec = 0; + h->prev->maxts.tv_usec = 0; + h->maxts.tv_sec = 0; + h->maxts.tv_usec = 0; } else if (h->final && (h->fmaxval > 0) && ((h->maxts.tv_sec > 0) || h->maxts.tv_usec > 0)) { - fprintf(stdout, " (%0.3f ms/%ld.%ld)\n", (h->fmaxval * 1e3), (long) h->fmaxts.tv_sec, (long) h->fmaxts.tv_usec); - } else { - fprintf(stdout, "\n"); + fprintf(stdout, " (%0.3f ms/%ld.%ld)", (h->fmaxval * 1e3), (long) h->fmaxts.tv_sec, (long) h->fmaxts.tv_usec); } + fprintf(stdout, "%s\n", (h->Omit ? report_omitted : "")); } |