mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 23:14:34 +02:00
change stats to display difference between gap and expected gap
This commit is contained in:
parent
8db66e4322
commit
36f635ed8d
1 changed files with 22 additions and 18 deletions
|
@ -66,21 +66,23 @@ void runSend(const char* addressOption, int port, int gap, int size) {
|
|||
servaddr.sin_port=htons(port);
|
||||
|
||||
const int SAMPLES_FOR_30_SECONDS = 30 * 1000 / gap;
|
||||
MovingMinMaxAvg<quint64> timeGaps(1, SAMPLES_FOR_30_SECONDS); // stats
|
||||
MovingMinMaxAvg<int> timeGaps(1, SAMPLES_FOR_30_SECONDS); // stats
|
||||
|
||||
quint64 last = usecTimestampNow();
|
||||
|
||||
while (true) {
|
||||
|
||||
quint64 now = usecTimestampNow();
|
||||
quint64 actualGap = now - last;
|
||||
int actualGap = now - last;
|
||||
|
||||
|
||||
if (actualGap >= gap) {
|
||||
sendto(sockfd, outputBuffer, size, 0, (struct sockaddr *)&servaddr, sizeof(servaddr));
|
||||
|
||||
timeGaps.update(actualGap);
|
||||
int gapDifferece = actualGap - gap;
|
||||
timeGaps.update(gapDifferece);
|
||||
std::cout << "packet sent gap: " << actualGap << " "
|
||||
<< "gapDifference: " << gapDifferece << " "
|
||||
<< "min: " << timeGaps.getMin() << " "
|
||||
<< "max: " << timeGaps.getMax() << " "
|
||||
<< "avg: " << timeGaps.getAverage() << " "
|
||||
|
@ -111,7 +113,7 @@ void runReceive(const char* addressOption, int port, int gap, int size) {
|
|||
myaddr.sin_port=htons(port);
|
||||
|
||||
const int SAMPLES_FOR_30_SECONDS = 30 * 1000 / gap;
|
||||
MovingMinMaxAvg<quint64> timeGaps(1, SAMPLES_FOR_30_SECONDS); // stats
|
||||
MovingMinMaxAvg<int> timeGaps(1, SAMPLES_FOR_30_SECONDS); // stats
|
||||
|
||||
if (bind(sockfd, (struct sockaddr *)&myaddr, sizeof(myaddr)) < 0) {
|
||||
std::cout << "bind failed\n";
|
||||
|
@ -129,8 +131,10 @@ void runReceive(const char* addressOption, int port, int gap, int size) {
|
|||
} else {
|
||||
quint64 now = usecTimestampNow();
|
||||
int actualGap = now - last;
|
||||
timeGaps.update(actualGap);
|
||||
int gapDifferece = actualGap - gap;
|
||||
timeGaps.update(gapDifferece);
|
||||
std::cout << "packet received gap:" << actualGap << " "
|
||||
<< "gapDifference: " << gapDifferece << " "
|
||||
<< "min: " << timeGaps.getMin() << " "
|
||||
<< "max: " << timeGaps.getMax() << " "
|
||||
<< "avg: " << timeGaps.getAverage() << " "
|
||||
|
|
Loading…
Reference in a new issue