From f4c165afe7003ad6276ad7d015fd1c9164a84328 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sat, 6 Mar 2010 08:21:54 -0800 Subject: Bug fix: store correct position information upon logout. Fixes mantis #4608 --- OpenSim/Framework/Util.cs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'OpenSim/Framework/Util.cs') diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index 10af925..64f6118 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs @@ -29,6 +29,7 @@ using System; using System.Collections; using System.Collections.Generic; using System.Data; +using System.Diagnostics; using System.Globalization; using System.IO; using System.IO.Compression; @@ -1443,6 +1444,7 @@ namespace OpenSim.Framework } #endregion FireAndForget Threading Pattern + /// /// Environment.TickCount is an int but it counts all 32 bits so it goes positive /// and negative every 24.9 days. This trims down TickCount so it doesn't wrap @@ -1467,5 +1469,21 @@ namespace OpenSim.Framework Int32 diff = EnvironmentTickCount() - prevValue; return (diff >= 0) ? diff : (diff + EnvironmentTickCountMask + 1); } + + /// + /// Prints the call stack at any given point. Useful for debugging. + /// + public static void PrintCallStack() + { + StackTrace stackTrace = new StackTrace(); // get call stack + StackFrame[] stackFrames = stackTrace.GetFrames(); // get method calls (frames) + + // write call stack method names + foreach (StackFrame stackFrame in stackFrames) + { + m_log.Debug(stackFrame.GetMethod().DeclaringType + "." + stackFrame.GetMethod().Name); // write method name + } + } + } } -- cgit v1.1