diff --git a/server/include/hist.h b/server/include/hist.h index ecf8eca9e..af26154e2 100644 --- a/server/include/hist.h +++ b/server/include/hist.h @@ -44,10 +44,10 @@ struct hist { }; /** Initialize struct hist with supplied values and allocate memory for buckets. */ -void hist_init(struct hist *h, double start, double end, double resolution); +void hist_create(struct hist *h, double start, double end, double resolution); /** Free the dynamically allocated memory. */ -void hist_free(struct hist *h); +void hist_destroy(struct hist *h); /** Reset all counters and values back to zero. */ void hist_reset(struct hist *h); diff --git a/server/src/hist.c b/server/src/hist.c index cb20c0940..361375c41 100644 --- a/server/src/hist.c +++ b/server/src/hist.c @@ -17,7 +17,7 @@ #define VAL(h, i) ((h)->low + (i) * (h)->resolution) #define INDEX(h, v) round((v - (h)->low) / (h)->resolution) -void hist_init(struct hist *h, double low, double high, double resolution) +void hist_create(struct hist *h, double low, double high, double resolution) { h->low = low; h->high = high; @@ -28,7 +28,7 @@ void hist_init(struct hist *h, double low, double high, double resolution) hist_reset(h); } -void hist_free(struct hist *h) +void hist_destroy(struct hist *h) { free(h->data); } diff --git a/server/src/path.c b/server/src/path.c index c7f226ae9..19f39c6b7 100644 --- a/server/src/path.c +++ b/server/src/path.c @@ -156,8 +156,6 @@ int path_start(struct path *p) info("Starting path: %s", buf); - hist_init(&p->histogram, -HIST_SEQ, +HIST_SEQ, 1); - /* At fixed rate mode, we start another thread for sending */ if (p->rate) pthread_create(&p->sent_tid, NULL, &path_send, (void *) p); @@ -183,7 +181,6 @@ int path_stop(struct path *p) if (p->sent || p->received) { path_stats(p); hist_print(&p->histogram); - hist_free(&p->histogram); } return 0; diff --git a/server/src/test.c b/server/src/test.c index 58fb410cf..18768f6b7 100644 --- a/server/src/test.c +++ b/server/src/test.c @@ -155,7 +155,7 @@ void test_rtt() { double avg = 0; struct hist histogram; - hist_init(&histogram, low, high, res); + hist_create(&histogram, low, high, res); #if 1 /* Print header */ fprintf(stdout, "%17s", "timestamp"); @@ -201,5 +201,5 @@ void test_rtt() { else error("Invalid file descriptor: %u", fd); - hist_free(&histogram); + hist_destroy(&histogram); }