diff options
Diffstat (limited to 'OpenSim/Framework/Util.cs')
-rw-r--r-- | OpenSim/Framework/Util.cs | 18 |
1 files changed, 18 insertions, 0 deletions
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; | |||
29 | using System.Collections; | 29 | using System.Collections; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.Data; | 31 | using System.Data; |
32 | using System.Diagnostics; | ||
32 | using System.Globalization; | 33 | using System.Globalization; |
33 | using System.IO; | 34 | using System.IO; |
34 | using System.IO.Compression; | 35 | using System.IO.Compression; |
@@ -1443,6 +1444,7 @@ namespace OpenSim.Framework | |||
1443 | } | 1444 | } |
1444 | 1445 | ||
1445 | #endregion FireAndForget Threading Pattern | 1446 | #endregion FireAndForget Threading Pattern |
1447 | |||
1446 | /// <summary> | 1448 | /// <summary> |
1447 | /// Environment.TickCount is an int but it counts all 32 bits so it goes positive | 1449 | /// Environment.TickCount is an int but it counts all 32 bits so it goes positive |
1448 | /// and negative every 24.9 days. This trims down TickCount so it doesn't wrap | 1450 | /// and negative every 24.9 days. This trims down TickCount so it doesn't wrap |
@@ -1467,5 +1469,21 @@ namespace OpenSim.Framework | |||
1467 | Int32 diff = EnvironmentTickCount() - prevValue; | 1469 | Int32 diff = EnvironmentTickCount() - prevValue; |
1468 | return (diff >= 0) ? diff : (diff + EnvironmentTickCountMask + 1); | 1470 | return (diff >= 0) ? diff : (diff + EnvironmentTickCountMask + 1); |
1469 | } | 1471 | } |
1472 | |||
1473 | /// <summary> | ||
1474 | /// Prints the call stack at any given point. Useful for debugging. | ||
1475 | /// </summary> | ||
1476 | public static void PrintCallStack() | ||
1477 | { | ||
1478 | StackTrace stackTrace = new StackTrace(); // get call stack | ||
1479 | StackFrame[] stackFrames = stackTrace.GetFrames(); // get method calls (frames) | ||
1480 | |||
1481 | // write call stack method names | ||
1482 | foreach (StackFrame stackFrame in stackFrames) | ||
1483 | { | ||
1484 | m_log.Debug(stackFrame.GetMethod().DeclaringType + "." + stackFrame.GetMethod().Name); // write method name | ||
1485 | } | ||
1486 | } | ||
1487 | |||
1470 | } | 1488 | } |
1471 | } | 1489 | } |