Permalink
Browse files

- make report interval relative to the window size

- remove some newlines in logs
  • Loading branch information...
jordansissel committed Feb 18, 2013
1 parent c1ce8e5 commit 5aed161780091a8429271f20481bf392e3634335
Showing with 7 additions and 6 deletions.
  1. +7 −6 emitter.c
View
@@ -54,8 +54,9 @@ void *emitter(void *arg) {
config->ssl_ca_path);
}
- long count = 0;
- long bytes = 0;
+ unsigned long count = 0;
+ unsigned long bytes = 0;
+ unsigned long report_interval = config->window_size * 4;
zmq_pollitem_t items[1];
@@ -113,16 +114,16 @@ void *emitter(void *arg) {
zmq_msg_close(&message);
- if (count == 10000) {
+ if (count == report_interval) {
struct timespec now;
clock_gettime(CLOCK_MONOTONIC, &now);
double s = (start.tv_sec + 0.0) + (start.tv_nsec / 1000000000.0);
double n = (now.tv_sec + 0.0) + (now.tv_nsec / 1000000000.0);
- flog(stdout, "Rate: %f (bytes: %f)\n", (count + 0.0) / (n - s), (bytes + 0.0) / (n - s));
+ flog(stdout, "Rate: %f (bytes: %f)", (count + 0.0) / (n - s), (bytes + 0.0) / (n - s));
struct rusage rusage;
rc = getrusage(RUSAGE_SELF, &rusage);
- insist(rc == 0, "getrusage failed: %s\n", strerror(errno));
- flog(stdout, "cpu user/system: %d.%06d / %d.%06d\n",
+ insist(rc == 0, "getrusage failed: %s", strerror(errno));
+ flog(stdout, "cpu user/system: %d.%06d / %d.%06dn",
(int)rusage.ru_utime.tv_sec, (int)rusage.ru_utime.tv_usec,
(int)rusage.ru_stime.tv_sec, (int)rusage.ru_stime.tv_usec);
clock_gettime(CLOCK_MONOTONIC, &start);

0 comments on commit 5aed161

Please sign in to comment.