mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-09 00:00:00 +01:00
adjust histogram memory management function naming scheme
This commit is contained in:
parent
f0db3e7897
commit
e1d7e0487d
4 changed files with 6 additions and 9 deletions
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue