X-Git-Url: https://git.sesse.net/?p=cubemap;a=blobdiff_plain;f=input_stats.cpp;h=6bd1529450a3e3ce08af839faf3c36eda70cdbc6;hp=92a6718c4cc8cc987b1753fc5b90123a08ff7131;hb=b05c2965d3d5bfc4f24f17a27716a69ddf03a3cc;hpb=023de2890fe7300d8940e66ae73b48262e86976c diff --git a/input_stats.cpp b/input_stats.cpp index 92a6718..6bd1529 100644 --- a/input_stats.cpp +++ b/input_stats.cpp @@ -5,6 +5,7 @@ #include #include #include +#include #include #include "input.h" @@ -51,16 +52,21 @@ void InputStatsThread::do_work() now = time(NULL); for (size_t i = 0; i < inputs.size(); ++i) { InputStats stats = inputs[i]->get_stats(); + fprintf(fp, "%s %llu %llu", stats.url.c_str(), + (long long unsigned)(stats.bytes_received), + (long long unsigned)(stats.data_bytes_received)); if (stats.connect_time == -1) { - fprintf(fp, "%s %llu %llu -\n", stats.url.c_str(), - (long long unsigned)(stats.bytes_received), - (long long unsigned)(stats.data_bytes_received)); + fprintf(fp, " -"); } else { - fprintf(fp, "%s %llu %llu %d\n", stats.url.c_str(), - (long long unsigned)(stats.bytes_received), - (long long unsigned)(stats.data_bytes_received), - int(now - stats.connect_time)); + fprintf(fp, " %d", int(now - stats.connect_time)); } + fprintf(fp, " %llu", (long long unsigned)(stats.metadata_bytes_received)); + if (!isfinite(stats.latency_sec)) { + fprintf(fp, " -"); + } else { + fprintf(fp, " %.6f", stats.latency_sec); + } + fprintf(fp, "\n"); } if (fclose(fp) == EOF) { log_perror("fclose");