aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/XEngine/ScriptEngineConsoleCommands.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ScriptEngine/XEngine/ScriptEngineConsoleCommands.cs')
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/ScriptEngineConsoleCommands.cs46
1 files changed, 43 insertions, 3 deletions
diff --git a/OpenSim/Region/ScriptEngine/XEngine/ScriptEngineConsoleCommands.cs b/OpenSim/Region/ScriptEngine/XEngine/ScriptEngineConsoleCommands.cs
index e47917d..efb854d 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/ScriptEngineConsoleCommands.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/ScriptEngineConsoleCommands.cs
@@ -47,20 +47,29 @@ namespace OpenSim.Region.ScriptEngine.XEngine
47 public void RegisterCommands() 47 public void RegisterCommands()
48 { 48 {
49 MainConsole.Instance.Commands.AddCommand( 49 MainConsole.Instance.Commands.AddCommand(
50 "Scripts", false, "show sensors", "show sensors", "Show script sensors information", 50 "Scripts", false, "show script sensors", "show script sensors", "Show script sensors information",
51 HandleShowSensors); 51 HandleShowSensors);
52
53 MainConsole.Instance.Commands.AddCommand(
54 "Scripts", false, "show script timers", "show script timers", "Show script sensors information",
55 HandleShowTimers);
56 }
57
58 private bool IsSceneSelected()
59 {
60 return MainConsole.Instance.ConsoleScene == null || MainConsole.Instance.ConsoleScene == m_engine.World;
52 } 61 }
53 62
54 private void HandleShowSensors(string module, string[] cmdparams) 63 private void HandleShowSensors(string module, string[] cmdparams)
55 { 64 {
56 if (!(MainConsole.Instance.ConsoleScene == null || MainConsole.Instance.ConsoleScene == m_engine.World)) 65 if (!IsSceneSelected())
57 return; 66 return;
58 67
59 SensorRepeat sr = AsyncCommandManager.GetSensorRepeatPlugin(m_engine); 68 SensorRepeat sr = AsyncCommandManager.GetSensorRepeatPlugin(m_engine);
60 69
61 if (sr == null) 70 if (sr == null)
62 { 71 {
63 MainConsole.Instance.Output("Sensor plugin not yet initialized"); 72 MainConsole.Instance.Output("Plugin not yet initialized");
64 return; 73 return;
65 } 74 }
66 75
@@ -82,5 +91,36 @@ namespace OpenSim.Region.ScriptEngine.XEngine
82 MainConsole.Instance.Output(cdt.ToString()); 91 MainConsole.Instance.Output(cdt.ToString());
83 MainConsole.Instance.OutputFormat("Total: {0}", sensorInfo.Count); 92 MainConsole.Instance.OutputFormat("Total: {0}", sensorInfo.Count);
84 } 93 }
94
95 private void HandleShowTimers(string module, string[] cmdparams)
96 {
97 if (!IsSceneSelected())
98 return;
99
100 Timer timerPlugin = AsyncCommandManager.GetTimerPlugin(m_engine);
101
102 if (timerPlugin == null)
103 {
104 MainConsole.Instance.Output("Plugin not yet initialized");
105 return;
106 }
107
108 List<Timer.TimerInfo> timersInfo = timerPlugin.GetTimersInfo();
109
110 ConsoleDisplayTable cdt = new ConsoleDisplayTable();
111 cdt.AddColumn("Part local ID", 13);
112 cdt.AddColumn("Script item ID", 36);
113 cdt.AddColumn("Interval", 10);
114 cdt.AddColumn("Next", 8);
115
116 foreach (Timer.TimerInfo t in timersInfo)
117 {
118 // Convert from 100 ns ticks back to seconds
119 cdt.AddRow(t.localID, t.itemID, (double)t.interval / 10000000, t.next);
120 }
121
122 MainConsole.Instance.Output(cdt.ToString());
123 MainConsole.Instance.OutputFormat("Total: {0}", timersInfo.Count);
124 }
85 } 125 }
86} \ No newline at end of file 126} \ No newline at end of file