projects
/
archipelago
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
34dbf8a
)
bench: Flush stdout when printing progress results
author
Alex Pyrgiotis
<apyrgio@grnet.gr>
Tue, 23 Apr 2013 12:55:46 +0000
(15:55 +0300)
committer
Alex Pyrgiotis
<apyrgio@grnet.gr>
Tue, 23 Apr 2013 13:39:41 +0000
(16:39 +0300)
xseg/peers/user/bench-utils.c
patch
|
blob
|
history
diff --git
a/xseg/peers/user/bench-utils.c
b/xseg/peers/user/bench-utils.c
index
d3dbb3d
..
64268b5
100644
(file)
--- a/
xseg/peers/user/bench-utils.c
+++ b/
xseg/peers/user/bench-utils.c
@@
-50,7
+50,7
@@
#include <string.h>
#define PRINT_SIG(__who, __sig) \
#include <string.h>
#define PRINT_SIG(__who, __sig) \
- printf("%s (%lu): id %lu, object %lu, offset %lu\n", \
+ fprintf(stdout, "%s (%lu): id %lu, object %lu, offset %lu\n", \
#__who, (uint64_t)(__sig), \
((struct signature *)__sig)->id, \
((struct signature *)__sig)->object, \
#__who, (uint64_t)(__sig), \
((struct signature *)__sig)->id, \
((struct signature *)__sig)->object, \
@@
-291,14
+291,15
@@
void print_io_stats(struct bench *prefs, double elapsed)
iops = __calculate_iops(prefs, elapsed);
__calculate_bw(prefs, iops, &bw);
iops = __calculate_iops(prefs, elapsed);
__calculate_bw(prefs, iops, &bw);
- printf(" ~~~~~~~~~~~~~~~~~~~~~~~~\n");
- printf("Bandwidth: %.3lf %s\n", bw.val, bw.unit);
- printf("IOPS: %.3lf\n", iops);
+ fprintf(stdout, " ~~~~~~~~~~~~~~~~~~~~~~~~\n");
+ fprintf(stdout, "Bandwidth: %.3lf %s\n", bw.val, bw.unit);
+ fprintf(stdout, "IOPS: %.3lf\n", iops);
+ fflush(stdout);
}
void print_stats(struct bench *prefs)
{
}
void print_stats(struct bench *prefs)
{
- printf("\n"
+ fprintf(stdout, "\n"
"Requests total: %10lu\n"
"Requests submitted: %10lu\n"
"Requests received: %10lu\n"
"Requests total: %10lu\n"
"Requests submitted: %10lu\n"
"Requests received: %10lu\n"
@@
-308,8
+309,9
@@
void print_stats(struct bench *prefs)
prefs->status->received,
prefs->status->failed);
if ((prefs->op == X_READ) && (GET_FLAG(VERIFY, prefs->flags) != VERIFY_NO))
prefs->status->received,
prefs->status->failed);
if ((prefs->op == X_READ) && (GET_FLAG(VERIFY, prefs->flags) != VERIFY_NO))
- printf("Requests corrupted: %10lu\n", prefs->status->corrupted);
- printf("\n");
+ fprintf(stdout, "Requests corrupted: %10lu\n", prefs->status->corrupted);
+ fprintf(stdout, "\n");
+ fflush(stdout);
}
void print_remaining(struct bench *prefs)
}
void print_remaining(struct bench *prefs)
@@
-318,9
+320,10
@@
void print_remaining(struct bench *prefs)
remaining = prefs->status->max - prefs->status->received;
if (remaining)
remaining = prefs->status->max - prefs->status->received;
if (remaining)
- printf("Requests remaining: %10lu\n", remaining);
+ fprintf(stdout, "Requests remaining: %10lu\n", remaining);
else
else
- printf("All requests have been served.\n");
+ fprintf(stdout, "All requests have been served.\n");
+ fflush(stdout);
}
void print_res(struct bench *prefs, struct timer *tm, char *type)
}
void print_res(struct bench *prefs, struct timer *tm, char *type)
@@
-331,20
+334,22
@@
void print_res(struct bench *prefs, struct timer *tm, char *type)
sum = __timespec2double(tm->sum);
res = __separate_by_order(sum);
sum = __timespec2double(tm->sum);
res = __separate_by_order(sum);
- printf("\n");
- printf(" %s\n", type);
- printf(" ========================\n");
- printf(" |-s-||-ms-|-us-|-ns-|\n");
- printf("Total time: %3u. %03u %03u %03u\n",
+ fprintf(stdout, "\n");
+ fprintf(stdout, " %s\n", type);
+ fprintf(stdout, " ========================\n");
+ fprintf(stdout, " |-s-||-ms-|-us-|-ns-|\n");
+ fprintf(stdout, "Total time: %3u. %03u %03u %03u\n",
res.s, res.ms, res.us, res.ns);
res.s, res.ms, res.us, res.ns);
+ fflush(stdout);
if (!prefs->status->received)
return;
res = __separate_by_order(sum / prefs->status->received);
if (!prefs->status->received)
return;
res = __separate_by_order(sum / prefs->status->received);
- printf("Mean Time: %3u. %03u %03u %03u\n",
+ fprintf(stdout, "Mean Time: %3u. %03u %03u %03u\n",
res.s, res.ms, res.us, res.ns);
res.s, res.ms, res.us, res.ns);
+ fflush(stdout);
//TODO: Add std
//TODO: Add std
@@
-358,7
+363,7
@@
void print_progress(struct bench *prefs)
if ((prefs->op == X_READ) && (GET_FLAG(VERIFY, prefs->flags) != VERIFY_NO))
lines++;
if ((prefs->op == X_READ) && (GET_FLAG(VERIFY, prefs->flags) != VERIFY_NO))
lines++;
- printf("\033[%dA\033[J", lines);
+ fprintf(stdout, "\033[%dA\033[J", lines);
print_stats(prefs);
}
print_stats(prefs);
}