Details
-
Type:
Improvement
-
Status:
Closed
-
Priority:
Minor
-
Resolution: Fixed
-
Affects Version/s: 1.0.7
-
Fix Version/s: 1.0.7
-
Component/s: freeswitch-core
-
Labels:None
-
Environment:Visual Studio 2008, Windows 7
-
Platform:Vista/VS
-
FreeSWITCH GIT Revision:883de14f3068d8cc269cccce3895effc750ef108
-
Reproduced with GIT HEAD?:Yes
-
Target Version:
Description
This patch makes a few changes to the FS soft timer;
1. Removed a couple of debug log lines I once added to timer_test, it's really not needed anymore, it was more for proof of concept way back. I also enabled another log line which was removed for Windows, I couldn't find a reason why that was disabled.
2. Improved timer_test report accuracy, made it not to include the time it will take for the log to be written (really not much, but still).
3. Changed timer loop to actually sleep the time it needs to, instead of always using runtime.microseconds_per_tick, this will make default 20ms timer work better on OS'es not using timerfd. Since the loop will take some time to actually trigger the waiting timers, using a fixed value the timer will drift more and more, and eventually catch up again, but changing it to sleep a shorter time will give better precision. I used to enable 1ms-timer for this, but after this change it's not needed anymore.
4. Windows: Added QueryPerformanceCounter() reference, insead of timeGetTime(). This is ony activated if it detects Vista or later (sonce some reports on Internet says that it's not always stable on older OS'es), and it also does a basic init check so that it actually returns good values as well. If something seems bad it reverts to the good old timeGetTime(). As for timeGetTime() it also requires that start parameter "-monotonic-clock". This add usec precision to the time reported, and it also removes the need for mutex lock around timeGetTime(), it also has a faster execution time compared to timeGetTime().
5. Windows: Disabled timer calibration on Windows, it's really no use anyway, since we only have ms sleep - and it's not even implemented in the FS code.
/Peter
1. Removed a couple of debug log lines I once added to timer_test, it's really not needed anymore, it was more for proof of concept way back. I also enabled another log line which was removed for Windows, I couldn't find a reason why that was disabled.
2. Improved timer_test report accuracy, made it not to include the time it will take for the log to be written (really not much, but still).
3. Changed timer loop to actually sleep the time it needs to, instead of always using runtime.microseconds_per_tick, this will make default 20ms timer work better on OS'es not using timerfd. Since the loop will take some time to actually trigger the waiting timers, using a fixed value the timer will drift more and more, and eventually catch up again, but changing it to sleep a shorter time will give better precision. I used to enable 1ms-timer for this, but after this change it's not needed anymore.
4. Windows: Added QueryPerformanceCounter() reference, insead of timeGetTime(). This is ony activated if it detects Vista or later (sonce some reports on Internet says that it's not always stable on older OS'es), and it also does a basic init check so that it actually returns good values as well. If something seems bad it reverts to the good old timeGetTime(). As for timeGetTime() it also requires that start parameter "-monotonic-clock". This add usec precision to the time reported, and it also removes the need for mutex lock around timeGetTime(), it also has a faster execution time compared to timeGetTime().
5. Windows: Disabled timer calibration on Windows, it's really no use anyway, since we only have ms sleep - and it's not even implemented in the FS code.
/Peter
Activity
Peter Olsson
made changes -
| Field | Original Value | New Value |
|---|---|---|
| Attachment | timing-patch.txt [ 15411 ] |
Peter Olsson
made changes -
| Attachment | timing-patch.txt [ 15412 ] |
Peter Olsson
made changes -
| Attachment | timing-patch.txt [ 15420 ] |
Peter Olsson
made changes -
| Attachment | timing-patch.txt [ 16082 ] |
Peter Olsson
made changes -
| Attachment | timing-patch.txt [ 15420 ] |
Peter Olsson
made changes -
| Attachment | timing-patch.txt [ 15412 ] |
Peter Olsson
made changes -
| Attachment | timing-patch.txt [ 15411 ] |
Peter Olsson
made changes -
| Attachment | timing-patch.txt [ 15410 ] |
Git
made changes -
| Status | Open [ 1 ] | Resolved [ 5 ] |
| Resolution | Fixed [ 1 ] |
Auto Admin
made changes -
| Status | Resolved [ 5 ] | Closed [ 6 ] |