From 0cfc2dae522aa4bf7b22473d21b019b748b2dbe6 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Mon, 4 Feb 2013 17:11:34 -0800 Subject: [PATCH] output difference in time since last send for debug --- socket.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/socket.cpp b/socket.cpp index 9f4fafe893..66fd716ba9 100644 --- a/socket.cpp +++ b/socket.cpp @@ -144,6 +144,7 @@ void *send_buffer_thread(void *args) int sentBytes; int currentFrame = 1; timeval startTime; + timeval lastSend; timeval now; int16_t *clientMix = new int16_t[BUFFER_LENGTH_SAMPLES]; @@ -157,6 +158,8 @@ void *send_buffer_thread(void *args) while (usecTimestamp(&startTime, (currentFrame * BUFFER_SEND_INTERVAL_USECS)) <= usecTimestamp(&now)) { sentBytes = 0; + std::cout << "The difference was " << diffclock(lastSend, now) << "ms.\n"; + int sampleOffset = ((currentFrame - 1) * BUFFER_LENGTH_SAMPLES) % whiteNoiseLength; memcpy(masterMix, whiteNoiseBuffer + sampleOffset, BUFFER_LENGTH_BYTES); @@ -193,6 +196,7 @@ void *send_buffer_thread(void *args) } } + gettimeofday(&lastSend, NULL); currentFrame++; } }