SMS Server Tools 3
 Menu
Basic information:
Additional information:
Support:
Get SMS Server Tools 3:
Additional Options

 Sponsored links

 Search
Custom Search

 Visitor locations
 
 SMS Server Tools 3 Community
Welcome, Guest. The forum is currently read-only, but will open soon. Tue Jul 01, 2025 11:01
SMSTools3 Community » Search Bottom

Page:  1

Keywords:
Mode: All keywords (AND)
hoerup: Or calculate how many small loops are necesarry first and avoid the calls to gettimeofday() --- extras.c.old 2014-02-11 15:18:58.526777555 +0100 +++ extras.c 2014-02-11 15:37:37.188820157 +0100 @@ -1434,20 +1434,23 @@ { struct timeval tv; struct timezone tz; - unsigned long long now; + unsigned long long now,diff; - do - { - gettimeofday(&tv, &tz); - now = (unsigned long long)tv.tv_sec *1000000 +tv.tv_usec; + unsigned long loop_count,i; + int left; + gettimeofday(&tv, &tz); + now = (unsigned long long)tv.tv_sec *1000000 +tv.tv_usec; + diff = target_time - now; + loop_count = (diff /100); + left = (diff % 100); + + for (i=0; i<loop_count; i++) { if (terminate == 1) return 1; - - if (now < target_time) - usleep(100); + usleep(100); } - while (now < target_time); + usleep(left); return 0; }
hoerup: Hi I find the current cpu usage a bit high even though smsd only is idling (not moving any messages)- especially on lower spec'ed computers. After a bit investigation i found that usleep_until() in extras.c only usleeps in intervals of 100 microseconds - which might be a bit too low and sorta creates a pseudo busy loop wait. This small patch lowered CPU consumption quite a bit: diff -u extras.c.old extras.c --- extras.c.old 2014-02-11 15:18:58.526777555 +0100 +++ extras.c 2014-02-11 15:19:46.845312164 +0100 @@ -1445,7 +1445,7 @@ return 1; if (now < target_time) - usleep(100); + usleep(1000); } while (now < target_time);
hoerup: Hi Have you considered switching to a online code hosting site to gain these benefits * Online source repository (easier review) * Possibility of forking and handling patch submissions / pull requests * Bugtracker /hoerup

Page:  1

SMSTools3 Community » Search Top

 
Time in this board is UTC.  

Privacy Policy   SMS Server Tools 3 Copyright © Keijo Kasvi.