summaryrefslogtreecommitdiffstats
path: root/test/src/timer.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/src/timer.c')
-rw-r--r--test/src/timer.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/test/src/timer.c b/test/src/timer.c
index 82f69d0..1b18633 100644
--- a/test/src/timer.c
+++ b/test/src/timer.c
@@ -1,22 +1,19 @@
#include "test/jemalloc_test.h"
void
-timer_start(timedelta_t *timer)
-{
+timer_start(timedelta_t *timer) {
nstime_init(&timer->t0, 0);
nstime_update(&timer->t0);
}
void
-timer_stop(timedelta_t *timer)
-{
+timer_stop(timedelta_t *timer) {
nstime_copy(&timer->t1, &timer->t0);
nstime_update(&timer->t1);
}
uint64_t
-timer_usec(const timedelta_t *timer)
-{
+timer_usec(const timedelta_t *timer) {
nstime_t delta;
nstime_copy(&delta, &timer->t1);
@@ -25,8 +22,7 @@ timer_usec(const timedelta_t *timer)
}
void
-timer_ratio(timedelta_t *a, timedelta_t *b, char *buf, size_t buflen)
-{
+timer_ratio(timedelta_t *a, timedelta_t *b, char *buf, size_t buflen) {
uint64_t t0 = timer_usec(a);
uint64_t t1 = timer_usec(b);
uint64_t mult;
@@ -36,11 +32,13 @@ timer_ratio(timedelta_t *a, timedelta_t *b, char *buf, size_t buflen)
/* Whole. */
n = malloc_snprintf(&buf[i], buflen-i, "%"FMTu64, t0 / t1);
i += n;
- if (i >= buflen)
+ if (i >= buflen) {
return;
+ }
mult = 1;
- for (j = 0; j < n; j++)
+ for (j = 0; j < n; j++) {
mult *= 10;
+ }
/* Decimal. */
n = malloc_snprintf(&buf[i], buflen-i, ".");