#include "../flist.h"
+#include "compiler/compiler.h"
+
static int bs = 4096;
static int max_us = 10000;
static char *file;
#define PLAT_NR (PLAT_GROUP_NR * PLAT_VAL)
#define PLAT_LIST_MAX 20
+#ifndef NDEBUG
+#define CHECK_ZERO_OR_ABORT(code) assert(code)
+#else
+#define CHECK_ZERO_OR_ABORT(code) \
+ do { \
+ if (fio_unlikely((code) != 0)) { \
+ log_err("failed checking code %i != 0", (code)); \
+ abort(); \
+ } \
+ } while (0)
+#endif
+
struct stats {
unsigned int plat[PLAT_NR];
unsigned int nr_samples;
return ret;
}
-static struct work_item *find_seq(struct writer_thread *w, unsigned int seq)
+static struct work_item *find_seq(struct writer_thread *w, int seq)
{
struct work_item *work;
struct flist_head *entry;
clock_gettime(CLOCK_MONOTONIC, &s);
ret = write(STDOUT_FILENO, work->buf, work->buf_size);
+ if (ret < 0)
+ return (int)ret;
clock_gettime(CLOCK_MONOTONIC, &e);
assert(ret == work->buf_size);
{
struct writer_thread *wt = data;
struct work_item *work;
- unsigned int seq = 1;
+ int seq = 1;
work = NULL;
- while (!wt->thread.exit || !flist_empty(&wt->list)) {
+ while (!(seq < 0) && (!wt->thread.exit || !flist_empty(&wt->list))) {
pthread_mutex_lock(&wt->thread.lock);
if (work)
int ret;
ret = pthread_condattr_init(&cattr);
- assert(ret == 0);
+ CHECK_ZERO_OR_ABORT(ret);
#ifdef CONFIG_PTHREAD_CONDATTR_SETCLOCK
ret = pthread_condattr_setclock(&cattr, CLOCK_MONOTONIC);
- assert(ret == 0);
+ CHECK_ZERO_OR_ABORT(ret);
#endif
pthread_cond_init(&thread->cond, &cattr);
pthread_cond_init(&thread->done_cond, &cattr);
bytes = 0;
ret = pthread_condattr_init(&cattr);
- assert(ret == 0);
+ CHECK_ZERO_OR_ABORT(ret);
#ifdef CONFIG_PTHREAD_CONDATTR_SETCLOCK
ret = pthread_condattr_setclock(&cattr, CLOCK_MONOTONIC);
- assert(ret == 0);
+ CHECK_ZERO_OR_ABORT(ret);
#endif
clock_gettime(CLOCK_MONOTONIC, &s);