Skip to content

Instantly share code, notes, and snippets.

@alexcreek
Created April 15, 2014 00:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save alexcreek/10693415 to your computer and use it in GitHub Desktop.
Save alexcreek/10693415 to your computer and use it in GitHub Desktop.
Modifies weighttp's output for easier grepping
diff -rupN /home/alex/source/weighttp/src/weighttp.c weighttp/src/weighttp.c
--- /home/alex/source/weighttp/src/weighttp.c 2014-04-13 14:05:00.359685093 -0400
+++ weighttp/src/weighttp.c 2014-04-14 20:34:59.470388698 -0400
@@ -234,6 +234,7 @@ int main(int argc, char *argv[]) {
uint64_t kbps;
char **headers;
uint8_t headers_num;
+ float full_duration;
printf("weighttp - a lightweight and simple webserver benchmarking tool\n\n");
@@ -406,6 +407,7 @@ int main(int argc, char *argv[]) {
ts_end = ev_time();
duration = ts_end - ts_start;
sec = duration;
+ full_duration = duration;
duration -= sec;
duration = duration * 1000;
millisec = duration;
@@ -413,6 +415,9 @@ int main(int argc, char *argv[]) {
microsec = duration * 1000;
rps = stats.req_done / (ts_end - ts_start);
kbps = stats.bytes_total / (ts_end - ts_start) / 1024;
+
+ printf("\nTotal time: %f\n", full_duration);
+ printf("Requests per sec: %"PRIu64"\n", rps);
printf("\nfinished in %d sec, %d millisec and %d microsec, %"PRIu64" req/s, %"PRIu64" kbyte/s\n", sec, millisec, microsec, rps, kbps);
printf("requests: %"PRIu64" total, %"PRIu64" started, %"PRIu64" done, %"PRIu64" succeeded, %"PRIu64" failed, %"PRIu64" errored\n",
config.req_count, stats.req_started, stats.req_done, stats.req_success, stats.req_failed, stats.req_error
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment