mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-22 05:27:20 +00:00
[client] added retard/resync counts for debugging
This commit is contained in:
parent
d09bb1146d
commit
eb52ee9412
@ -194,6 +194,9 @@ int renderThread(void * unused)
|
|||||||
uint64_t fpsStart = 0;
|
uint64_t fpsStart = 0;
|
||||||
uint64_t fpsTime = 0;
|
uint64_t fpsTime = 0;
|
||||||
|
|
||||||
|
unsigned int retardCount = 0;
|
||||||
|
unsigned int resyncCount = 0;
|
||||||
|
|
||||||
#define SYNC_WINDOW 2000
|
#define SYNC_WINDOW 2000
|
||||||
|
|
||||||
while(state.running)
|
while(state.running)
|
||||||
@ -207,6 +210,7 @@ int renderThread(void * unused)
|
|||||||
// we shouldn't have a frame yet, retard the timing a bit
|
// we shouldn't have a frame yet, retard the timing a bit
|
||||||
if (header.dataPos != state.shm->dataPos)
|
if (header.dataPos != state.shm->dataPos)
|
||||||
{
|
{
|
||||||
|
++retardCount;
|
||||||
if (pollDelay >= SYNC_WINDOW / 2)
|
if (pollDelay >= SYNC_WINDOW / 2)
|
||||||
pollDelay -= SYNC_WINDOW / 2;
|
pollDelay -= SYNC_WINDOW / 2;
|
||||||
else
|
else
|
||||||
@ -220,7 +224,14 @@ int renderThread(void * unused)
|
|||||||
// if we timed out, wait for an interrupt or a timeout
|
// if we timed out, wait for an interrupt or a timeout
|
||||||
if (microtime() - loopStart > SYNC_WINDOW)
|
if (microtime() - loopStart > SYNC_WINDOW)
|
||||||
{
|
{
|
||||||
ivshmem_wait_irq(0, 1000000/30);
|
if (ivshmem_wait_irq(0, 1000000/30) == IVSHMEM_WAIT_RESULT_OK)
|
||||||
|
{
|
||||||
|
// might be a spurious interrupt we didn't answer earlier
|
||||||
|
if (header.dataPos == state.shm->dataPos)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
++resyncCount;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -388,9 +399,9 @@ int renderThread(void * unused)
|
|||||||
textTexture = NULL;
|
textTexture = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
char str[32];
|
char str[128];
|
||||||
const float avgFPS = 1000.0f / (((float)fpsTime / frameCount) / 1000.0f);
|
const float avgFPS = 1000.0f / (((float)fpsTime / frameCount) / 1000.0f);
|
||||||
snprintf(str, sizeof(str), "FPS: %8.4f, Sync: %5lu", avgFPS, pollDelay);
|
snprintf(str, sizeof(str), "FPS: %8.4f, Retard: %d, Resync: %d", avgFPS, retardCount, resyncCount);
|
||||||
SDL_Color color = {0xff, 0xff, 0xff};
|
SDL_Color color = {0xff, 0xff, 0xff};
|
||||||
if (!(textSurface = TTF_RenderText_Blended(state.font, str, color)))
|
if (!(textSurface = TTF_RenderText_Blended(state.font, str, color)))
|
||||||
{
|
{
|
||||||
@ -716,7 +727,7 @@ int run()
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
state.font = TTF_OpenFont("/usr/share/fonts/truetype/freefont/FreeMono.ttf", 16);
|
state.font = TTF_OpenFont("/usr/share/fonts/truetype/freefont/FreeMono.ttf", 14);
|
||||||
if (!state.font)
|
if (!state.font)
|
||||||
{
|
{
|
||||||
DEBUG_ERROR("TTL_OpenFont Failed");
|
DEBUG_ERROR("TTL_OpenFont Failed");
|
||||||
|
Loading…
Reference in New Issue
Block a user