Add ability to write OPS/SEC from cbc-pillowfight to a file
cbc-pillowfight 2> /tmp/stats.txt
or, when writing to terminal required
cbc-pillowfight 2>&1 | tee /tmp/stats.txt
Tested-by: Build Bot
@@ -895,21 +895,22 @@ private:
static void updateOpsPerSecDisplay()
{
-#ifndef WIN32
static time_t start_time = time(NULL);
- static int is_tty = isatty(STDERR_FILENO);
- if (is_tty) {
+ static int is_tty =
+#ifdef WIN32
+ 0;
+#else
+ isatty(STDERR_FILENO);
+#endif
static volatile unsigned long nops = 0;
- if (++nops % 10000 == 0) {
time_t now = time(NULL);
time_t nsecs = now - start_time;
if (!nsecs) { nsecs = 1; }
unsigned long ops_sec = nops / nsecs;
- fprintf(stderr, "OPS/SEC: %10lu\r", ops_sec);
- }
+ if (++nops % 10000 == 0) {
+ fprintf(stderr, "OPS/SEC: %10lu%c", ops_sec, is_tty ? '\r' : '\n');
}
-#endif
}
static void updateStats(InstanceCookie *cookie, lcb_error_t rc)
