* Status and ETA code
*/
#include <unistd.h>
-#include <fcntl.h>
#include <string.h>
+#ifdef CONFIG_VALGRIND_DEV
+#include <valgrind/drd.h>
+#else
+#define DRD_IGNORE_VAR(x) do { } while (0)
+#endif
#include "fio.h"
#include "lib/pow2.h"
static char __run_str[REAL_MAX_JOBS + 1];
-static char run_str[__THREAD_RUNSTR_SZ(REAL_MAX_JOBS)];
+static char run_str[__THREAD_RUNSTR_SZ(REAL_MAX_JOBS) + 1];
static void update_condensed_str(char *rstr, char *run_str_condensed)
{
static int eta_new_line_init, eta_new_line_pending;
static int linelen_last;
static int eta_good;
- char output[REAL_MAX_JOBS + 512], *p = output;
+ char output[__THREAD_RUNSTR_SZ(REAL_MAX_JOBS) + 512], *p = output;
char eta_str[128];
double perc = 0.0;
if (eta_new_line_pending) {
eta_new_line_pending = 0;
+ linelen_last = 0;
p += sprintf(p, "\n");
}
size_t left;
int l;
int ddir;
+ int linelen;
if ((!je->eta_sec && !eta_good) || je->nr_ramp == je->nr_running ||
je->eta_sec == -1)
if (l >= left)
l = left - 1;
p += l;
- if (l >= 0 && l < linelen_last)
- p += sprintf(p, "%*s", linelen_last - l, "");
- linelen_last = l;
+ linelen = p - output;
+ if (l >= 0 && linelen < linelen_last)
+ p += sprintf(p, "%*s", linelen_last - linelen, "");
+ linelen_last = linelen;
for (ddir = 0; ddir < DDIR_RWDIR_CNT; ddir++) {
free(rate_str[ddir]);
void print_status_init(int thr_number)
{
+ DRD_IGNORE_VAR(__run_str);
__run_str[thr_number] = 'P';
update_condensed_str(__run_str, run_str);
}