From 822574df9f3889c877035d302f9060769ed27e70 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 15 Jun 2017 20:28:20 +0100 Subject: change the clock source for EnvironmentTickCount so it does get a bit more resolution if avaiable (1ms) specially on windows. This until all calls to this are removed. Coment out some stats in workpool/threads creation path --- OpenSim/Framework/Util.cs | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'OpenSim/Framework/Util.cs') diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index 9a1e348..a855767 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs @@ -2617,7 +2617,7 @@ namespace OpenSim.Framework public static void FireAndForget(System.Threading.WaitCallback callback, object obj, string context, bool dotimeout = true) { Interlocked.Increment(ref numTotalThreadFuncsCalled); - +/* if (context != null) { if (!m_fireAndForgetCallsMade.ContainsKey(context)) @@ -2630,7 +2630,7 @@ namespace OpenSim.Framework else m_fireAndForgetCallsInProgress[context]++; } - +*/ WaitCallback realCallback; bool loggingEnabled = LogThreadPool > 0; @@ -2647,8 +2647,8 @@ namespace OpenSim.Framework Culture.SetCurrentCulture(); callback(o); - if (context != null) - m_fireAndForgetCallsInProgress[context]--; +// if (context != null) +// m_fireAndForgetCallsInProgress[context]--; }; } else @@ -2688,8 +2688,8 @@ namespace OpenSim.Framework if ((loggingEnabled || (threadFuncOverloadMode == 1)) && threadInfo.LogThread) m_log.DebugFormat("Exit threadfunc {0} ({1})", threadFuncNum, FormatDuration(threadInfo.Elapsed())); - if (context != null) - m_fireAndForgetCallsInProgress[context]--; +// if (context != null) +// m_fireAndForgetCallsInProgress[context]--; } }; } @@ -2967,7 +2967,8 @@ namespace OpenSim.Framework /// public static Int32 EnvironmentTickCount() { - return Environment.TickCount & EnvironmentTickCountMask; + double now = GetTimeStampMS(); + return (int)now; } const Int32 EnvironmentTickCountMask = 0x3fffffff; @@ -2993,7 +2994,8 @@ namespace OpenSim.Framework /// subtraction of passed prevValue from current Environment.TickCount public static Int32 EnvironmentTickCountSubtract(Int32 prevValue) { - return EnvironmentTickCountSubtract(EnvironmentTickCount(), prevValue); + double now = GetTimeStampMS(); + return EnvironmentTickCountSubtract((int)now, prevValue); } // Returns value of Tick Count A - TickCount B accounting for wrapping of TickCount -- cgit v1.1