projects
/
fio.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fio: make gui status update in timely fashion
[fio.git]
/
eta.c
diff --git
a/eta.c
b/eta.c
index b7f1fd62cffe88e2bdac92c5d325ec8fbfb25a55..0833d3412450a6ddd788369cf2c064f41918ef34 100644
(file)
--- a/
eta.c
+++ b/
eta.c
@@
-7,6
+7,8
@@
#include "fio.h"
#include "fio.h"
+void (*update_thread_status)(char *status_message) = NULL;
+
static char run_str[REAL_MAX_JOBS + 1];
/*
static char run_str[REAL_MAX_JOBS + 1];
/*
@@
-411,17
+413,25
@@
void display_thread_status(struct jobs_eta *je)
}
p += sprintf(p, "\r");
}
p += sprintf(p, "\r");
- printf("%s", output);
- fflush(stdout);
+ if (update_thread_status) {
+ update_thread_status(output);
+ } else {
+ printf("%s", output);
+ fflush(stdout);
+ }
}
void print_thread_status(void)
{
struct jobs_eta *je;
}
void print_thread_status(void)
{
struct jobs_eta *je;
+ size_t size;
- je = malloc(sizeof(*je) + thread_number * sizeof(char));
+ if (!thread_number)
+ return;
- memset(je, 0, sizeof(*je) + thread_number * sizeof(char));
+ size = sizeof(*je) + thread_number * sizeof(char) + 1;
+ je = malloc(size);
+ memset(je, 0, size);
if (calc_thread_status(je, 0))
display_thread_status(je);
if (calc_thread_status(je, 0))
display_thread_status(je);