aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorRobert Adams2012-12-16 17:53:44 -0800
committerRobert Adams2012-12-16 21:19:11 -0800
commit21dc5f4a1ada6fa7538627a81907054c619c0ebb (patch)
treecfaf9864ecda8b129913115c42a849292cf7194e
parentBulletSim: remove some errors on shutdown by moving terrain destruction until... (diff)
downloadopensim-SC_OLD-21dc5f4a1ada6fa7538627a81907054c619c0ebb.zip
opensim-SC_OLD-21dc5f4a1ada6fa7538627a81907054c619c0ebb.tar.gz
opensim-SC_OLD-21dc5f4a1ada6fa7538627a81907054c619c0ebb.tar.bz2
opensim-SC_OLD-21dc5f4a1ada6fa7538627a81907054c619c0ebb.tar.xz
Add stack dump function that takes an alternate printer outter. I've found that log4net can be slowish so, if one is generating A LOT of debug output, alternate printers are better
-rw-r--r--OpenSim/Framework/Util.cs8
1 files changed, 7 insertions, 1 deletions
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index a0c54a0..0c657c5 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -1855,6 +1855,12 @@ namespace OpenSim.Framework
1855 /// </summary> 1855 /// </summary>
1856 public static void PrintCallStack() 1856 public static void PrintCallStack()
1857 { 1857 {
1858 PrintCallStack(m_log.DebugFormat);
1859 }
1860
1861 public delegate void DebugPrinter(string msg, params Object[] parm);
1862 public static void PrintCallStack(DebugPrinter printer)
1863 {
1858 StackTrace stackTrace = new StackTrace(true); // get call stack 1864 StackTrace stackTrace = new StackTrace(true); // get call stack
1859 StackFrame[] stackFrames = stackTrace.GetFrames(); // get method calls (frames) 1865 StackFrame[] stackFrames = stackTrace.GetFrames(); // get method calls (frames)
1860 1866
@@ -1862,7 +1868,7 @@ namespace OpenSim.Framework
1862 foreach (StackFrame stackFrame in stackFrames) 1868 foreach (StackFrame stackFrame in stackFrames)
1863 { 1869 {
1864 MethodBase mb = stackFrame.GetMethod(); 1870 MethodBase mb = stackFrame.GetMethod();
1865 m_log.DebugFormat("{0}.{1}:{2}", mb.DeclaringType, mb.Name, stackFrame.GetFileLineNumber()); // write method name 1871 printer("{0}.{1}:{2}", mb.DeclaringType, mb.Name, stackFrame.GetFileLineNumber()); // write method name
1866 } 1872 }
1867 } 1873 }
1868 1874