diff options
author | UbitUmarov | 2015-09-04 11:05:15 +0100 |
---|---|---|
committer | UbitUmarov | 2015-09-04 11:05:15 +0100 |
commit | f0c865555beb7fb079280fb7a177a0fcd677b373 (patch) | |
tree | 1d379b73cf70d68e8eb833deb0e3a7716a61b470 /OpenSim/Framework/Util.cs | |
parent | normalise physics plugins to return fps as (simulated time / requested simula... (diff) | |
download | opensim-SC-f0c865555beb7fb079280fb7a177a0fcd677b373.zip opensim-SC-f0c865555beb7fb079280fb7a177a0fcd677b373.tar.gz opensim-SC-f0c865555beb7fb079280fb7a177a0fcd677b373.tar.bz2 opensim-SC-f0c865555beb7fb079280fb7a177a0fcd677b373.tar.xz |
add a GetTimeStampMS method, this returns a time stamp in miliSeconds with the resolution avaiable for StopWatchs. Value in double since it can be large (as machine uptime in high resolution ticks)
Diffstat (limited to 'OpenSim/Framework/Util.cs')
-rw-r--r-- | OpenSim/Framework/Util.cs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index 77985bd..d1cdaa6 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs | |||
@@ -140,10 +140,14 @@ namespace OpenSim.Framework | |||
140 | 140 | ||
141 | public static readonly int MAX_THREADPOOL_LEVEL = 3; | 141 | public static readonly int MAX_THREADPOOL_LEVEL = 3; |
142 | 142 | ||
143 | public static double TimeStampClockPeriodMS; | ||
144 | |||
143 | static Util() | 145 | static Util() |
144 | { | 146 | { |
145 | LogThreadPool = 0; | 147 | LogThreadPool = 0; |
146 | LogOverloads = true; | 148 | LogOverloads = true; |
149 | TimeStampClockPeriodMS = 1000.0D / (double)Stopwatch.Frequency; | ||
150 | m_log.InfoFormat("[UTIL] TimeStamp clock with period of {0}ms", Math.Round(TimeStampClockPeriodMS,6,MidpointRounding.AwayFromZero)); | ||
147 | } | 151 | } |
148 | 152 | ||
149 | private static uint nextXferID = 5000; | 153 | private static uint nextXferID = 5000; |
@@ -2662,6 +2666,13 @@ namespace OpenSim.Framework | |||
2662 | return tcA - tcB; | 2666 | return tcA - tcB; |
2663 | } | 2667 | } |
2664 | 2668 | ||
2669 | // returns a timestamp in ms as double | ||
2670 | // using the time resolution avaiable to StopWatch | ||
2671 | public static double GetTimeStampMS() | ||
2672 | { | ||
2673 | return (double)Stopwatch.GetTimestamp() * TimeStampClockPeriodMS; | ||
2674 | } | ||
2675 | |||
2665 | /// <summary> | 2676 | /// <summary> |
2666 | /// Formats a duration (given in milliseconds). | 2677 | /// Formats a duration (given in milliseconds). |
2667 | /// </summary> | 2678 | /// </summary> |