"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/traffic.c" between
vnstat-2.7.tar.gz and vnstat-2.8.tar.gz

About: vnStat is a console-based network traffic monitor (using the /proc filesystem).

traffic.c  (vnstat-2.7):traffic.c  (vnstat-2.8)
skipping to change at line 259 skipping to change at line 259
snprintf(buffer2, 128, " %*s tx: %s %s", paddin gwidth, " ", gettrafficrate(tx, LIVETIME, ratewidth), getvalue(txtotal, 1, RT_No rmal)); snprintf(buffer2, 128, " %*s tx: %s %s", paddin gwidth, " ", gettrafficrate(tx, LIVETIME, ratewidth), getvalue(txtotal, 1, RT_No rmal));
} }
strcat(buffer, buffer2); strcat(buffer, buffer2);
if (cfg.ostyle != 4 || !debug) { if (cfg.ostyle != 4 || !debug) {
cursortocolumn(1); cursortocolumn(1);
eraseline(); eraseline();
} }
if (cfg.ostyle != 4) { if (cfg.ostyle != 4) {
printf("%s", buffer); printf("%s", buffer);
fflush(stdout);
} else { } else {
printf("%s\n", buffer); printf("%s\n", buffer);
} }
} else { } else {
printf("{\"index\":%" PRIu64 ",", index); printf("{\"index\":%" PRIu64 ",", index);
printf("\"seconds\":%" PRIu64 ",", (uint64_t)time(NULL) - timespent); printf("\"seconds\":%" PRIu64 ",", (uint64_t)time(NULL) - timespent);
printf("\"rx\":{"); printf("\"rx\":{");
printf("\"ratestring\":\"%s\",", gettrafficrate(rx, LIVET IME, 0)); printf("\"ratestring\":\"%s\",", gettrafficrate(rx, LIVET IME, 0));
printf("\"bytespersecond\":%" PRIu64 ",", (uint64_t)(rx / LIVETIME)); printf("\"bytespersecond\":%" PRIu64 ",", (uint64_t)(rx / LIVETIME));
printf("\"packetspersecond\":%" PRIu64 ",", (uint64_t)(rx p / LIVETIME)); printf("\"packetspersecond\":%" PRIu64 ",", (uint64_t)(rx p / LIVETIME));
skipping to change at line 286 skipping to change at line 285
printf("\"ratestring\":\"%s\",", gettrafficrate(tx, LIVET IME, 0)); printf("\"ratestring\":\"%s\",", gettrafficrate(tx, LIVET IME, 0));
printf("\"bytespersecond\":%" PRIu64 ",", (uint64_t)(tx / LIVETIME)); printf("\"bytespersecond\":%" PRIu64 ",", (uint64_t)(tx / LIVETIME));
printf("\"packetspersecond\":%" PRIu64 ",", (uint64_t)(tx p / LIVETIME)); printf("\"packetspersecond\":%" PRIu64 ",", (uint64_t)(tx p / LIVETIME));
printf("\"bytes\":%" PRIu64 ",", tx); printf("\"bytes\":%" PRIu64 ",", tx);
printf("\"packets\":%" PRIu64 ",", txp); printf("\"packets\":%" PRIu64 ",", txp);
printf("\"totalbytes\":%" PRIu64 ",", txtotal); printf("\"totalbytes\":%" PRIu64 ",", txtotal);
printf("\"totalpackets\":%" PRIu64 "", txptotal); printf("\"totalpackets\":%" PRIu64 "", txptotal);
printf("}}\n"); printf("}}\n");
index++; index++;
} }
fflush(stdout);
#ifdef CHECK_VNSTAT #ifdef CHECK_VNSTAT
break; break;
#endif #endif
} }
timespent = (uint64_t)time(NULL) - timespent - timeslept; timespent = (uint64_t)time(NULL) - timespent - timeslept;
#ifdef CHECK_VNSTAT #ifdef CHECK_VNSTAT
timespent = 10; timespent = 10;
#endif #endif
 End of changes. 2 change blocks. 
1 lines changed or deleted 1 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)