cnping

Minimal Graphical Ping Tool
git clone https://git.sinitax.com/cnlohr/cnping
Log | Files | Refs | Submodules | README | LICENSE | sfeed.txt

commit c0eed1d2021fd57693e6502746a7e9e72746dbf7
parent 11f0b2e678557e0e9529eb840de8b78c6bd91229
Author: CNLohr <charles@cnlohr.com>
Date:   Fri, 13 Jul 2018 23:27:11 -0400

Merge pull request #45 from dreua/improve_redraw_load

Improve the system (usually Xorg) load by increasing the wait time be…
Diffstat:
Mcnping.c | 9+++++++--
Mcnping.exe | 0
2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/cnping.c b/cnping.c @@ -559,6 +559,7 @@ int main( int argc, const char ** argv ) double LastFPSTime = OGGetAbsoluteTime(); double LastFrameTime = OGGetAbsoluteTime(); double SecToWait; + double frameperiodseconds; #ifdef WIN32 ShowWindow (GetConsoleWindow(), SW_HIDE); @@ -671,6 +672,9 @@ int main( int argc, const char ** argv ) OGCreateThread( PingListen, 0 ); } + + frameperiodseconds = fmin(.2, fmax(.03, pingperiodseconds)); + while(1) { iframeno++; @@ -712,8 +716,9 @@ int main( int argc, const char ** argv ) LastFPSTime+=1; } - SecToWait = .030 - ( ThisTime - LastFrameTime ); - LastFrameTime += .030; + SecToWait = frameperiodseconds - ( ThisTime - LastFrameTime ); + LastFrameTime += frameperiodseconds; + //printf("iframeno = %d; SecToWait = %f; pingperiodseconds = %f; frameperiodseconds = %f \n", iframeno, SecToWait, pingperiodseconds, frameperiodseconds); if( SecToWait > 0 ) OGUSleep( (int)( SecToWait * 1000000 ) ); } diff --git a/cnping.exe b/cnping.exe Binary files differ.