+__attribute__ ((unused))
+void inspect_obv(struct object_vars *obv)
+{
+ XSEGLOG2(&lc, D, "Struct object vars:\n"
+ "\tname: %s (%d),\n"
+ "\tprefix: %s (%d),\n"
+ "\tseed: %lu (%d),\n"
+ "\tobjnum: %lu (%d)",
+ obv->name, obv->namelen, obv->prefix, obv->prefixlen,
+ obv->seed, obv->seedlen,
+ obv->objnum, obv->objnumlen);
+}
+
+uint64_t __get_object(struct bench *prefs, uint64_t new)
+{
+ if (prefs->ts > 0)
+ new = new / (prefs->os / prefs->bs);
+ return new;
+}
+
+/******************************\
+ * Static miscellaneous tools *
+\******************************/
+static inline uint64_t __get_object_from_name(struct object_vars *obv,
+ char *name)
+{
+ /* In case of --objname switch */
+ if (obv->name[0])
+ return 0;
+
+ /* Keep only the object number */
+ return atol(name + obv->namelen - obv->objnumlen);
+}
+
+static inline int __snap_to_bound8(uint64_t space)
+{
+ return space > 8 ? 8 : space;
+}
+
+static inline double __timespec2double(struct timespec num)
+{
+ return (double) (num.tv_sec * pow(10, 9) + num.tv_nsec);
+}
+
+static inline void __write_sig(struct bench_lfsr *sg, uint64_t *d, uint64_t s,
+ int pos)
+{
+ uint64_t i;
+ uint64_t last_val;
+ uint64_t space_left;
+
+ /* Write random numbers (based on global_id) every 24 bytes */
+ /* TODO: Should we use memcpy? */
+ for (i = pos; i < (s / 8) - (3 - pos); i += 3)
+ *(d + i) = lfsr_next(sg);
+
+ /* special care for last chunk */
+ last_val = lfsr_next(sg);
+ space_left = s - (i * 8);
+ memcpy(d + i, &last_val, __snap_to_bound8(space_left));
+}
+
+static inline int __read_sig(struct bench_lfsr *sg, uint64_t *d, uint64_t s,
+ int pos)
+{
+ uint64_t i;
+ uint64_t last_val;
+ uint64_t space_left;
+
+ /* TODO: Should we use memcmp? */
+ for (i = pos; i < (s / 8) - (3 - pos); i += 3) {
+ if (*(d + i) != lfsr_next(sg))
+ return 1;
+ }
+ /* special care for last chunk */
+ last_val = lfsr_next(sg);
+ space_left = s - (i * 8);
+ if (memcmp(d + i, &last_val, __snap_to_bound8(space_left)))
+ return 1;
+
+ return 0;
+}
+
+/*
+ * Seperates a double number in seconds, msec, usec, nsec
+ * Expects a number in nanoseconds (e.g. a number from timespec2double)
+ */
+static struct tm_result __separate_by_order(double num)
+{
+ struct tm_result res;
+
+ //The format we expect is the following:
+ //
+ // |-s-|-ms-|-us-|-ns|
+ //num = 123 456 789 012 . 000000000000
+ res.s = num / pow(10,9);
+ num = fmod(num, pow(10,9));
+ res.ms = num / pow(10,6);
+ num = fmod(num, pow(10,6));
+ res.us = num / 1000;
+ res.ns = fmod(num, 1000);
+
+ return res;
+}
+
+static void __calculate_bw(struct bench *prefs, double iops, struct bw *bw)
+{
+ bw->val = iops * prefs->bs;
+ strcpy(bw->unit, "B/s");
+
+ if (bw->val < 1024)
+ return;
+
+ bw->val = bw->val / 1024;
+ strcpy(bw->unit, "KB/s");
+
+ if (bw->val < 1024)
+ return;
+
+ bw->val = bw->val / 1024;
+ strcpy(bw->unit, "MB/s");
+
+ if (bw->val < 1024)
+ return;
+
+ bw->val = bw->val / 1024;
+ strcpy(bw->unit, "GB/s");
+}
+
+static double __calculate_iops(struct bench *prefs, double elapsed_ns)
+{
+ /* elapsed_ns is in nanoseconds, so we convert it to seconds */
+ double elapsed = elapsed_ns / pow(10,9);
+ return (prefs->status->received / elapsed);
+}
+
+/******************************\
+ * Argument-parsing functions *
+\******************************/
+