diff options
author | Justin Clark-Casey (justincc) | 2013-01-10 00:57:49 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2013-01-25 23:49:06 +0000 |
commit | 2563553f80b109cbd955484865a0eb104983f206 (patch) | |
tree | a62f91b54fc822ab3e7a3b5db3bf5e3992457229 /OpenSim/Region/ScriptEngine/Shared/Api/Implementation | |
parent | Add "show sensors" command to show script sensor information for debug purposes. (diff) | |
download | opensim-SC-2563553f80b109cbd955484865a0eb104983f206.zip opensim-SC-2563553f80b109cbd955484865a0eb104983f206.tar.gz opensim-SC-2563553f80b109cbd955484865a0eb104983f206.tar.bz2 opensim-SC-2563553f80b109cbd955484865a0eb104983f206.tar.xz |
Add "show script timers" command to show script timers. For debug purposes.
Also, "show sensors" changes to "show script sensors".
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs | 18 | ||||
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Timer.cs | 52 |
2 files changed, 38 insertions, 32 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs index 37422d7..dd45406 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs | |||
@@ -61,19 +61,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins | |||
61 | 61 | ||
62 | public SensorInfo Clone() | 62 | public SensorInfo Clone() |
63 | { | 63 | { |
64 | SensorInfo s = new SensorInfo(); | 64 | return (SensorInfo)this.MemberwiseClone(); |
65 | s.localID = localID; | ||
66 | s.itemID = itemID; | ||
67 | s.interval = interval; | ||
68 | s.next = next; | ||
69 | s.name = name; | ||
70 | s.keyID = keyID; | ||
71 | s.type = type; | ||
72 | s.range = range; | ||
73 | s.arc = arc; | ||
74 | s.host = host; | ||
75 | |||
76 | return s; | ||
77 | } | 65 | } |
78 | } | 66 | } |
79 | 67 | ||
@@ -701,8 +689,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins | |||
701 | 689 | ||
702 | lock (SenseRepeatListLock) | 690 | lock (SenseRepeatListLock) |
703 | { | 691 | { |
704 | foreach (SensorInfo si in SenseRepeaters) | 692 | foreach (SensorInfo i in SenseRepeaters) |
705 | retList.Add(si.Clone()); | 693 | retList.Add(i.Clone()); |
706 | } | 694 | } |
707 | 695 | ||
708 | return retList; | 696 | return retList; |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Timer.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Timer.cs index bc63030..0b14565 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Timer.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Timer.cs | |||
@@ -35,6 +35,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins | |||
35 | { | 35 | { |
36 | public class Timer | 36 | public class Timer |
37 | { | 37 | { |
38 | public class TimerInfo | ||
39 | { | ||
40 | public uint localID; | ||
41 | public UUID itemID; | ||
42 | //public double interval; | ||
43 | public long interval; | ||
44 | //public DateTime next; | ||
45 | public long next; | ||
46 | |||
47 | public TimerInfo Clone() | ||
48 | { | ||
49 | return (TimerInfo)this.MemberwiseClone(); | ||
50 | } | ||
51 | } | ||
52 | |||
38 | public AsyncCommandManager m_CmdManager; | 53 | public AsyncCommandManager m_CmdManager; |
39 | 54 | ||
40 | public int TimersCount | 55 | public int TimersCount |
@@ -59,17 +74,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins | |||
59 | return localID.ToString() + itemID.ToString(); | 74 | return localID.ToString() + itemID.ToString(); |
60 | } | 75 | } |
61 | 76 | ||
62 | private class TimerClass | 77 | private Dictionary<string,TimerInfo> Timers = new Dictionary<string,TimerInfo>(); |
63 | { | ||
64 | public uint localID; | ||
65 | public UUID itemID; | ||
66 | //public double interval; | ||
67 | public long interval; | ||
68 | //public DateTime next; | ||
69 | public long next; | ||
70 | } | ||
71 | |||
72 | private Dictionary<string,TimerClass> Timers = new Dictionary<string,TimerClass>(); | ||
73 | private object TimerListLock = new object(); | 78 | private object TimerListLock = new object(); |
74 | 79 | ||
75 | public void SetTimerEvent(uint m_localID, UUID m_itemID, double sec) | 80 | public void SetTimerEvent(uint m_localID, UUID m_itemID, double sec) |
@@ -81,7 +86,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins | |||
81 | } | 86 | } |
82 | 87 | ||
83 | // Add to timer | 88 | // Add to timer |
84 | TimerClass ts = new TimerClass(); | 89 | TimerInfo ts = new TimerInfo(); |
85 | ts.localID = m_localID; | 90 | ts.localID = m_localID; |
86 | ts.itemID = m_itemID; | 91 | ts.itemID = m_itemID; |
87 | ts.interval = Convert.ToInt64(sec * 10000000); // How many 100 nanoseconds (ticks) should we wait | 92 | ts.interval = Convert.ToInt64(sec * 10000000); // How many 100 nanoseconds (ticks) should we wait |
@@ -121,8 +126,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins | |||
121 | lock (TimerListLock) | 126 | lock (TimerListLock) |
122 | { | 127 | { |
123 | // Go through all timers | 128 | // Go through all timers |
124 | Dictionary<string, TimerClass>.ValueCollection tvals = Timers.Values; | 129 | Dictionary<string, TimerInfo>.ValueCollection tvals = Timers.Values; |
125 | foreach (TimerClass ts in tvals) | 130 | foreach (TimerInfo ts in tvals) |
126 | { | 131 | { |
127 | // Time has passed? | 132 | // Time has passed? |
128 | if (ts.next < DateTime.Now.Ticks) | 133 | if (ts.next < DateTime.Now.Ticks) |
@@ -147,8 +152,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins | |||
147 | 152 | ||
148 | lock (TimerListLock) | 153 | lock (TimerListLock) |
149 | { | 154 | { |
150 | Dictionary<string, TimerClass>.ValueCollection tvals = Timers.Values; | 155 | Dictionary<string, TimerInfo>.ValueCollection tvals = Timers.Values; |
151 | foreach (TimerClass ts in tvals) | 156 | foreach (TimerInfo ts in tvals) |
152 | { | 157 | { |
153 | if (ts.itemID == itemID) | 158 | if (ts.itemID == itemID) |
154 | { | 159 | { |
@@ -167,7 +172,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins | |||
167 | 172 | ||
168 | while (idx < data.Length) | 173 | while (idx < data.Length) |
169 | { | 174 | { |
170 | TimerClass ts = new TimerClass(); | 175 | TimerInfo ts = new TimerInfo(); |
171 | 176 | ||
172 | ts.localID = localID; | 177 | ts.localID = localID; |
173 | ts.itemID = itemID; | 178 | ts.itemID = itemID; |
@@ -181,5 +186,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins | |||
181 | } | 186 | } |
182 | } | 187 | } |
183 | } | 188 | } |
189 | |||
190 | public List<TimerInfo> GetTimersInfo() | ||
191 | { | ||
192 | List<TimerInfo> retList = new List<TimerInfo>(); | ||
193 | |||
194 | lock (TimerListLock) | ||
195 | { | ||
196 | foreach (TimerInfo i in Timers.Values) | ||
197 | retList.Add(i.Clone()); | ||
198 | } | ||
199 | |||
200 | return retList; | ||
201 | } | ||
184 | } | 202 | } |
185 | } | 203 | } |