diff options
author | onefang | 2021-08-26 06:21:19 +1000 |
---|---|---|
committer | onefang | 2021-08-26 06:21:19 +1000 |
commit | cdfbb899f1112dab44d5490838765e9bd73bc60e (patch) | |
tree | 52cddd0b76e7ad8544a0ada533f91bb5fc402025 /OpenSim/Framework/Monitoring | |
parent | Still failing to reconnect for dbCount(), just set the fucking timeout to a y... (diff) | |
parent | Don't strip (OWNER) out of script error report. (diff) | |
download | opensim-SC-cdfbb899f1112dab44d5490838765e9bd73bc60e.zip opensim-SC-cdfbb899f1112dab44d5490838765e9bd73bc60e.tar.gz opensim-SC-cdfbb899f1112dab44d5490838765e9bd73bc60e.tar.bz2 opensim-SC-cdfbb899f1112dab44d5490838765e9bd73bc60e.tar.xz |
Merge branch 'switch' into Domme.
Diffstat (limited to 'OpenSim/Framework/Monitoring')
-rw-r--r-- | OpenSim/Framework/Monitoring/BaseStatsCollector.cs | 35 | ||||
-rw-r--r-- | OpenSim/Framework/Monitoring/ChecksManager.cs | 2 | ||||
-rw-r--r-- | OpenSim/Framework/Monitoring/JobEngine.cs | 6 | ||||
-rw-r--r-- | OpenSim/Framework/Monitoring/MemoryWatchdog.cs | 17 | ||||
-rw-r--r-- | OpenSim/Framework/Monitoring/SimExtraStatsCollector.cs | 22 | ||||
-rw-r--r-- | OpenSim/Framework/Monitoring/Stats/Stat.cs | 4 | ||||
-rw-r--r-- | OpenSim/Framework/Monitoring/StatsLogger.cs | 4 | ||||
-rw-r--r-- | OpenSim/Framework/Monitoring/StatsManager.cs | 8 | ||||
-rw-r--r-- | OpenSim/Framework/Monitoring/Watchdog.cs | 3 | ||||
-rw-r--r-- | OpenSim/Framework/Monitoring/WorkManager.cs | 84 |
10 files changed, 70 insertions, 115 deletions
diff --git a/OpenSim/Framework/Monitoring/BaseStatsCollector.cs b/OpenSim/Framework/Monitoring/BaseStatsCollector.cs index e513abd..7119964 100644 --- a/OpenSim/Framework/Monitoring/BaseStatsCollector.cs +++ b/OpenSim/Framework/Monitoring/BaseStatsCollector.cs | |||
@@ -48,28 +48,25 @@ namespace OpenSim.Framework.Monitoring | |||
48 | Math.Round(GC.GetTotalMemory(false) / 1024.0 / 1024.0)); | 48 | Math.Round(GC.GetTotalMemory(false) / 1024.0 / 1024.0)); |
49 | 49 | ||
50 | sb.AppendFormat( | 50 | sb.AppendFormat( |
51 | "Last heap allocation rate : {0} MB/s\n", | 51 | "Heap allocation rate (last/avg): {0}/{1}MB/s\n", |
52 | Math.Round((MemoryWatchdog.LastHeapAllocationRate * 1000) / 1024.0 / 1024, 3)); | 52 | Math.Round((MemoryWatchdog.LastHeapAllocationRate * 1000) / 1048576.0, 3), |
53 | Math.Round((MemoryWatchdog.AverageHeapAllocationRate * 1000) / 1048576.0, 3)); | ||
53 | 54 | ||
54 | sb.AppendFormat( | ||
55 | "Average heap allocation rate: {0} MB/s\n", | ||
56 | Math.Round((MemoryWatchdog.AverageHeapAllocationRate * 1000) / 1024.0 / 1024, 3)); | ||
57 | |||
58 | Process myprocess = Process.GetCurrentProcess(); | ||
59 | // if (!myprocess.HasExited) | ||
60 | try | 55 | try |
61 | { | 56 | { |
62 | myprocess.Refresh(); | 57 | using (Process myprocess = Process.GetCurrentProcess()) |
63 | sb.AppendFormat( | 58 | { |
64 | "Process memory: Physical {0} MB \t Paged {1} MB \t Virtual {2} MB\n", | 59 | sb.AppendFormat( |
65 | Math.Round(myprocess.WorkingSet64 / 1024.0 / 1024.0), | 60 | "Process memory: Physical {0} MB \t Paged {1} MB \t Virtual {2} MB\n", |
66 | Math.Round(myprocess.PagedMemorySize64 / 1024.0 / 1024.0), | 61 | Math.Round(myprocess.WorkingSet64 / 1024.0 / 1024.0), |
67 | Math.Round(myprocess.VirtualMemorySize64 / 1024.0 / 1024.0)); | 62 | Math.Round(myprocess.PagedMemorySize64 / 1024.0 / 1024.0), |
68 | sb.AppendFormat( | 63 | Math.Round(myprocess.VirtualMemorySize64 / 1024.0 / 1024.0)); |
69 | "Peak process memory: Physical {0} MB \t Paged {1} MB \t Virtual {2} MB\n", | 64 | sb.AppendFormat( |
70 | Math.Round(myprocess.PeakWorkingSet64 / 1024.0 / 1024.0), | 65 | "Peak process memory: Physical {0} MB \t Paged {1} MB \t Virtual {2} MB\n", |
71 | Math.Round(myprocess.PeakPagedMemorySize64 / 1024.0 / 1024.0), | 66 | Math.Round(myprocess.PeakWorkingSet64 / 1024.0 / 1024.0), |
72 | Math.Round(myprocess.PeakVirtualMemorySize64 / 1024.0 / 1024.0)); | 67 | Math.Round(myprocess.PeakPagedMemorySize64 / 1024.0 / 1024.0), |
68 | Math.Round(myprocess.PeakVirtualMemorySize64 / 1024.0 / 1024.0)); | ||
69 | } | ||
73 | } | 70 | } |
74 | catch | 71 | catch |
75 | { } | 72 | { } |
diff --git a/OpenSim/Framework/Monitoring/ChecksManager.cs b/OpenSim/Framework/Monitoring/ChecksManager.cs index ff3b041..f719099 100644 --- a/OpenSim/Framework/Monitoring/ChecksManager.cs +++ b/OpenSim/Framework/Monitoring/ChecksManager.cs | |||
@@ -88,7 +88,7 @@ namespace OpenSim.Framework.Monitoring | |||
88 | con.Output("check categories available are:"); | 88 | con.Output("check categories available are:"); |
89 | 89 | ||
90 | foreach (string category in RegisteredChecks.Keys) | 90 | foreach (string category in RegisteredChecks.Keys) |
91 | con.OutputFormat(" {0}", category); | 91 | con.Output(" {0}", category); |
92 | } | 92 | } |
93 | // else | 93 | // else |
94 | // { | 94 | // { |
diff --git a/OpenSim/Framework/Monitoring/JobEngine.cs b/OpenSim/Framework/Monitoring/JobEngine.cs index 7264c25..6c388b3 100644 --- a/OpenSim/Framework/Monitoring/JobEngine.cs +++ b/OpenSim/Framework/Monitoring/JobEngine.cs | |||
@@ -79,7 +79,7 @@ namespace OpenSim.Framework.Monitoring | |||
79 | /// </remarks> | 79 | /// </remarks> |
80 | private bool m_warnOverMaxQueue = true; | 80 | private bool m_warnOverMaxQueue = true; |
81 | 81 | ||
82 | private BlockingCollection<Job> m_jobQueue = new BlockingCollection<Job>(new ConcurrentQueue<Job>(), 5000); | 82 | private BlockingCollection<Job> m_jobQueue = new BlockingCollection<Job>(5000); |
83 | 83 | ||
84 | private CancellationTokenSource m_cancelSource; | 84 | private CancellationTokenSource m_cancelSource; |
85 | 85 | ||
@@ -194,7 +194,7 @@ namespace OpenSim.Framework.Monitoring | |||
194 | { | 194 | { |
195 | if(!IsRunning) | 195 | if(!IsRunning) |
196 | return false; | 196 | return false; |
197 | 197 | ||
198 | if(!m_threadRunnig) | 198 | if(!m_threadRunnig) |
199 | { | 199 | { |
200 | WorkManager.RunInThreadPool(ProcessRequests, null, Name, false); | 200 | WorkManager.RunInThreadPool(ProcessRequests, null, Name, false); |
@@ -238,7 +238,7 @@ namespace OpenSim.Framework.Monitoring | |||
238 | break; | 238 | break; |
239 | } | 239 | } |
240 | } | 240 | } |
241 | catch (ObjectDisposedException) | 241 | catch(ObjectDisposedException) |
242 | { | 242 | { |
243 | m_log.DebugFormat("[JobEngine] {0} stopping ignoring {1} jobs in queue", | 243 | m_log.DebugFormat("[JobEngine] {0} stopping ignoring {1} jobs in queue", |
244 | Name,m_jobQueue.Count); | 244 | Name,m_jobQueue.Count); |
diff --git a/OpenSim/Framework/Monitoring/MemoryWatchdog.cs b/OpenSim/Framework/Monitoring/MemoryWatchdog.cs index c474622..f2e47f8 100644 --- a/OpenSim/Framework/Monitoring/MemoryWatchdog.cs +++ b/OpenSim/Framework/Monitoring/MemoryWatchdog.cs | |||
@@ -110,20 +110,17 @@ namespace OpenSim.Framework.Monitoring | |||
110 | long memoryNow = GC.GetTotalMemory(false); | 110 | long memoryNow = GC.GetTotalMemory(false); |
111 | long memoryDiff = memoryNow - m_lastUpdateMemory; | 111 | long memoryDiff = memoryNow - m_lastUpdateMemory; |
112 | 112 | ||
113 | if (memoryDiff >= 0) | 113 | if (m_samples.Count >= m_maxSamples) |
114 | { | ||
115 | if (m_samples.Count >= m_maxSamples) | ||
116 | m_samples.Dequeue(); | 114 | m_samples.Dequeue(); |
117 | 115 | ||
118 | double elapsed = Util.EnvironmentTickCountSubtract(now, m_lastUpdateTick); | 116 | double elapsed = Util.EnvironmentTickCountSubtract(now, m_lastUpdateTick); |
119 | 117 | ||
120 | // This should never happen since it's not useful for updates to occur with no time elapsed, but | 118 | // This should never happen since it's not useful for updates to occur with no time elapsed, but |
121 | // protect ourselves from a divide-by-zero just in case. | 119 | // protect ourselves from a divide-by-zero just in case. |
122 | if (elapsed == 0) | 120 | if (elapsed == 0) |
123 | return; | 121 | return; |
124 | 122 | ||
125 | m_samples.Enqueue(memoryDiff / (double)elapsed); | 123 | m_samples.Enqueue(memoryDiff / (double)elapsed); |
126 | } | ||
127 | 124 | ||
128 | UpdateLastRecord(memoryNow, now); | 125 | UpdateLastRecord(memoryNow, now); |
129 | } | 126 | } |
diff --git a/OpenSim/Framework/Monitoring/SimExtraStatsCollector.cs b/OpenSim/Framework/Monitoring/SimExtraStatsCollector.cs index 88a0297..c41c4b9 100644 --- a/OpenSim/Framework/Monitoring/SimExtraStatsCollector.cs +++ b/OpenSim/Framework/Monitoring/SimExtraStatsCollector.cs | |||
@@ -435,21 +435,19 @@ Asset service request failures: {3}" + Environment.NewLine, | |||
435 | // Get the amount of physical memory, allocated with the instance of this program, in kilobytes; | 435 | // Get the amount of physical memory, allocated with the instance of this program, in kilobytes; |
436 | // the working set is the set of memory pages currently visible to this program in physical RAM | 436 | // the working set is the set of memory pages currently visible to this program in physical RAM |
437 | // memory and includes both shared (e.g. system libraries) and private data | 437 | // memory and includes both shared (e.g. system libraries) and private data |
438 | double memUsage = Process.GetCurrentProcess().WorkingSet64 / 1024.0; | ||
439 | |||
440 | // Get the number of threads from the system that are currently | ||
441 | // running | ||
442 | int numberThreadsRunning = 0; | 438 | int numberThreadsRunning = 0; |
443 | foreach (ProcessThread currentThread in | 439 | double memUsage = 0; |
444 | Process.GetCurrentProcess().Threads) | 440 | using(Process p = Process.GetCurrentProcess()) |
445 | { | 441 | { |
446 | // A known issue with the current process .Threads property is | 442 | memUsage = p.WorkingSet64 / 1024.0; |
447 | // that it can return null threads, thus don't count those as | 443 | |
448 | // running threads and prevent the program function from failing | 444 | // Get the number of threads from the system that are currently |
449 | if (currentThread != null && | 445 | // running |
450 | currentThread.ThreadState == ThreadState.Running) | 446 | |
447 | foreach (ProcessThread currentThread in p.Threads) | ||
451 | { | 448 | { |
452 | numberThreadsRunning++; | 449 | if (currentThread != null && currentThread.ThreadState == ThreadState.Running) |
450 | numberThreadsRunning++; | ||
453 | } | 451 | } |
454 | } | 452 | } |
455 | 453 | ||
diff --git a/OpenSim/Framework/Monitoring/Stats/Stat.cs b/OpenSim/Framework/Monitoring/Stats/Stat.cs index 2276341..4b1a229 100644 --- a/OpenSim/Framework/Monitoring/Stats/Stat.cs +++ b/OpenSim/Framework/Monitoring/Stats/Stat.cs | |||
@@ -242,11 +242,7 @@ namespace OpenSim.Framework.Monitoring | |||
242 | public virtual OSDMap ToBriefOSDMap() | 242 | public virtual OSDMap ToBriefOSDMap() |
243 | { | 243 | { |
244 | OSDMap ret = new OSDMap(); | 244 | OSDMap ret = new OSDMap(); |
245 | |||
246 | ret.Add("Value", OSD.FromReal(Value)); | 245 | ret.Add("Value", OSD.FromReal(Value)); |
247 | |||
248 | // double lastChangeOverTime, averageChangeOverTime; | ||
249 | |||
250 | return ret; | 246 | return ret; |
251 | } | 247 | } |
252 | 248 | ||
diff --git a/OpenSim/Framework/Monitoring/StatsLogger.cs b/OpenSim/Framework/Monitoring/StatsLogger.cs index b719af9..e87c188 100644 --- a/OpenSim/Framework/Monitoring/StatsLogger.cs +++ b/OpenSim/Framework/Monitoring/StatsLogger.cs | |||
@@ -79,7 +79,7 @@ namespace OpenSim.Framework.Monitoring | |||
79 | if (cmd[2] == "start") | 79 | if (cmd[2] == "start") |
80 | { | 80 | { |
81 | Start(); | 81 | Start(); |
82 | con.OutputFormat("Now recording all stats to file every {0}ms", m_statsLogIntervalMs); | 82 | con.Output("Now recording all stats to file every {0}ms", m_statsLogIntervalMs); |
83 | } | 83 | } |
84 | else if (cmd[2] == "stop") | 84 | else if (cmd[2] == "stop") |
85 | { | 85 | { |
@@ -106,7 +106,7 @@ namespace OpenSim.Framework.Monitoring | |||
106 | sw.WriteLine(line); | 106 | sw.WriteLine(line); |
107 | } | 107 | } |
108 | 108 | ||
109 | MainConsole.Instance.OutputFormat("Stats saved to file {0}", path); | 109 | MainConsole.Instance.Output("Stats saved to file {0}", path); |
110 | } | 110 | } |
111 | 111 | ||
112 | public static void Start() | 112 | public static void Start() |
diff --git a/OpenSim/Framework/Monitoring/StatsManager.cs b/OpenSim/Framework/Monitoring/StatsManager.cs index a6b341f..05fb07a 100644 --- a/OpenSim/Framework/Monitoring/StatsManager.cs +++ b/OpenSim/Framework/Monitoring/StatsManager.cs | |||
@@ -117,14 +117,14 @@ namespace OpenSim.Framework.Monitoring | |||
117 | { | 117 | { |
118 | con.Output("Statistic categories available are:"); | 118 | con.Output("Statistic categories available are:"); |
119 | foreach (string category in RegisteredStats.Keys) | 119 | foreach (string category in RegisteredStats.Keys) |
120 | con.OutputFormat(" {0}", category); | 120 | con.Output(" {0}", category); |
121 | } | 121 | } |
122 | else | 122 | else |
123 | { | 123 | { |
124 | SortedDictionary<string, SortedDictionary<string, Stat>> category; | 124 | SortedDictionary<string, SortedDictionary<string, Stat>> category; |
125 | if (!RegisteredStats.TryGetValue(categoryName, out category)) | 125 | if (!RegisteredStats.TryGetValue(categoryName, out category)) |
126 | { | 126 | { |
127 | con.OutputFormat("No such category as {0}", categoryName); | 127 | con.Output("No such category as {0}", categoryName); |
128 | } | 128 | } |
129 | else | 129 | else |
130 | { | 130 | { |
@@ -150,14 +150,14 @@ namespace OpenSim.Framework.Monitoring | |||
150 | } | 150 | } |
151 | else | 151 | else |
152 | { | 152 | { |
153 | con.OutputFormat( | 153 | con.Output( |
154 | "No such stat {0} in {1}.{2}", statName, categoryName, containerName); | 154 | "No such stat {0} in {1}.{2}", statName, categoryName, containerName); |
155 | } | 155 | } |
156 | } | 156 | } |
157 | } | 157 | } |
158 | else | 158 | else |
159 | { | 159 | { |
160 | con.OutputFormat("No such container {0} in category {1}", containerName, categoryName); | 160 | con.Output("No such container {0} in category {1}", containerName, categoryName); |
161 | } | 161 | } |
162 | } | 162 | } |
163 | } | 163 | } |
diff --git a/OpenSim/Framework/Monitoring/Watchdog.cs b/OpenSim/Framework/Monitoring/Watchdog.cs index 9cac451..ad21d93 100644 --- a/OpenSim/Framework/Monitoring/Watchdog.cs +++ b/OpenSim/Framework/Monitoring/Watchdog.cs | |||
@@ -197,6 +197,9 @@ namespace OpenSim.Framework.Monitoring | |||
197 | foreach(ThreadWatchdogInfo twi in m_threads.Values) | 197 | foreach(ThreadWatchdogInfo twi in m_threads.Values) |
198 | { | 198 | { |
199 | Thread t = twi.Thread; | 199 | Thread t = twi.Thread; |
200 | // m_log.DebugFormat( | ||
201 | // "[WATCHDOG]: Stop: Removing thread {0}, ID {1}", twi.Thread.Name, twi.Thread.ManagedThreadId); | ||
202 | |||
200 | if(t.IsAlive) | 203 | if(t.IsAlive) |
201 | t.Abort(); | 204 | t.Abort(); |
202 | } | 205 | } |
diff --git a/OpenSim/Framework/Monitoring/WorkManager.cs b/OpenSim/Framework/Monitoring/WorkManager.cs index 5d9b185..ce639b9 100644 --- a/OpenSim/Framework/Monitoring/WorkManager.cs +++ b/OpenSim/Framework/Monitoring/WorkManager.cs | |||
@@ -88,6 +88,11 @@ namespace OpenSim.Framework.Monitoring | |||
88 | Watchdog.Stop(); | 88 | Watchdog.Stop(); |
89 | } | 89 | } |
90 | 90 | ||
91 | public static Thread StartThread(ThreadStart start, string name, bool alarmIfTimeout = false, bool log = true) | ||
92 | { | ||
93 | return StartThread(start, name, ThreadPriority.Normal, true, alarmIfTimeout, null, Watchdog.DEFAULT_WATCHDOG_TIMEOUT_MS, log); | ||
94 | } | ||
95 | |||
91 | /// <summary> | 96 | /// <summary> |
92 | /// Start a new long-lived thread. | 97 | /// Start a new long-lived thread. |
93 | /// </summary> | 98 | /// </summary> |
@@ -99,9 +104,9 @@ namespace OpenSim.Framework.Monitoring | |||
99 | /// <param name="log">If true then creation of thread is logged.</param> | 104 | /// <param name="log">If true then creation of thread is logged.</param> |
100 | /// <returns>The newly created Thread object</returns> | 105 | /// <returns>The newly created Thread object</returns> |
101 | public static Thread StartThread( | 106 | public static Thread StartThread( |
102 | ThreadStart start, string name, ThreadPriority priority, bool isBackground, bool alarmIfTimeout, bool log = true) | 107 | ThreadStart start, string name, ThreadPriority priority, bool alarmIfTimeout, bool log = true) |
103 | { | 108 | { |
104 | return StartThread(start, name, priority, isBackground, alarmIfTimeout, null, Watchdog.DEFAULT_WATCHDOG_TIMEOUT_MS, log); | 109 | return StartThread(start, name, priority, true, alarmIfTimeout, null, Watchdog.DEFAULT_WATCHDOG_TIMEOUT_MS, log); |
105 | } | 110 | } |
106 | 111 | ||
107 | /// <summary> | 112 | /// <summary> |
@@ -162,15 +167,22 @@ namespace OpenSim.Framework.Monitoring | |||
162 | { | 167 | { |
163 | Culture.SetCurrentCulture(); | 168 | Culture.SetCurrentCulture(); |
164 | callback(obj); | 169 | callback(obj); |
165 | Watchdog.RemoveThread(log:false); | ||
166 | } | 170 | } |
167 | catch (Exception e) | 171 | catch (Exception e) |
168 | { | 172 | { |
169 | m_log.Error(string.Format("[WATCHDOG]: Exception in thread {0}.", name), e); | 173 | m_log.Error(string.Format("[WATCHDOG]: Exception in thread {0}.", name), e); |
170 | } | 174 | } |
175 | finally | ||
176 | { | ||
177 | try | ||
178 | { | ||
179 | Watchdog.RemoveThread(log: false); | ||
180 | } | ||
181 | catch { } | ||
182 | } | ||
171 | }); | 183 | }); |
172 | 184 | ||
173 | StartThread(ts, name, ThreadPriority.Normal, true, false, log:log); | 185 | StartThread(ts, name, false, log:log); |
174 | } | 186 | } |
175 | 187 | ||
176 | /// <summary> | 188 | /// <summary> |
@@ -187,54 +199,6 @@ namespace OpenSim.Framework.Monitoring | |||
187 | Util.FireAndForget(callback, obj, name, timeout); | 199 | Util.FireAndForget(callback, obj, name, timeout); |
188 | } | 200 | } |
189 | 201 | ||
190 | /// <summary> | ||
191 | /// Run a job. | ||
192 | /// </summary> | ||
193 | /// <remarks> | ||
194 | /// This differs from direct scheduling (e.g. Util.FireAndForget) in that a job can be run in the job | ||
195 | /// engine if it is running, where all jobs are currently performed in sequence on a single thread. This is | ||
196 | /// to prevent observed overload and server freeze problems when there are hundreds of connections which all attempt to | ||
197 | /// perform work at once (e.g. in conference situations). With lower numbers of connections, the small | ||
198 | /// delay in performing jobs in sequence rather than concurrently has not been notiecable in testing, though a future more | ||
199 | /// sophisticated implementation could perform jobs concurrently when the server is under low load. | ||
200 | /// | ||
201 | /// However, be advised that some callers of this function rely on all jobs being performed in sequence if any | ||
202 | /// jobs are performed in sequence (i.e. if jobengine is active or not). Therefore, expanding the jobengine | ||
203 | /// beyond a single thread will require considerable thought. | ||
204 | /// | ||
205 | /// Also, any jobs submitted must be guaranteed to complete within a reasonable timeframe (e.g. they cannot | ||
206 | /// incorporate a network delay with a long timeout). At the moment, work that could suffer such issues | ||
207 | /// should still be run directly with RunInThread(), Util.FireAndForget(), etc. This is another area where | ||
208 | /// the job engine could be improved and so CPU utilization improved by better management of concurrency within | ||
209 | /// OpenSimulator. | ||
210 | /// </remarks> | ||
211 | /// <param name="jobType">General classification for the job (e.g. "RezAttachments").</param> | ||
212 | /// <param name="callback">Callback for job.</param> | ||
213 | /// <param name="obj">Object to pass to callback when run</param> | ||
214 | /// <param name="name">Specific name of job (e.g. "RezAttachments for Joe Bloggs"</param> | ||
215 | /// <param name="canRunInThisThread">If set to true then the job may be run in ths calling thread.</param> | ||
216 | /// <param name="mustNotTimeout">If the true then the job must never timeout.</param> | ||
217 | /// <param name="log">If set to true then extra logging is performed.</param> | ||
218 | public static void RunJob( | ||
219 | string jobType, WaitCallback callback, object obj, string name, | ||
220 | bool canRunInThisThread = false, bool mustNotTimeout = false, | ||
221 | bool log = false) | ||
222 | { | ||
223 | if (Util.FireAndForgetMethod == FireAndForgetMethod.RegressionTest) | ||
224 | { | ||
225 | Culture.SetCurrentCulture(); | ||
226 | callback(obj); | ||
227 | return; | ||
228 | } | ||
229 | |||
230 | if (JobEngine.IsRunning) | ||
231 | JobEngine.QueueJob(name, () => callback(obj)); | ||
232 | else if (canRunInThisThread) | ||
233 | callback(obj); | ||
234 | else | ||
235 | Util.FireAndForget(callback, obj, name, !mustNotTimeout); | ||
236 | } | ||
237 | |||
238 | private static void HandleControlCommand(string module, string[] args) | 202 | private static void HandleControlCommand(string module, string[] args) |
239 | { | 203 | { |
240 | // if (SceneManager.Instance.CurrentScene != null && SceneManager.Instance.CurrentScene != m_udpServer.Scene) | 204 | // if (SceneManager.Instance.CurrentScene != null && SceneManager.Instance.CurrentScene != m_udpServer.Scene) |
@@ -251,23 +215,23 @@ namespace OpenSim.Framework.Monitoring | |||
251 | if (subCommand == "stop") | 215 | if (subCommand == "stop") |
252 | { | 216 | { |
253 | JobEngine.Stop(); | 217 | JobEngine.Stop(); |
254 | MainConsole.Instance.OutputFormat("Stopped job engine."); | 218 | MainConsole.Instance.Output("Stopped job engine."); |
255 | } | 219 | } |
256 | else if (subCommand == "start") | 220 | else if (subCommand == "start") |
257 | { | 221 | { |
258 | JobEngine.Start(); | 222 | JobEngine.Start(); |
259 | MainConsole.Instance.OutputFormat("Started job engine."); | 223 | MainConsole.Instance.Output("Started job engine."); |
260 | } | 224 | } |
261 | else if (subCommand == "status") | 225 | else if (subCommand == "status") |
262 | { | 226 | { |
263 | MainConsole.Instance.OutputFormat("Job engine running: {0}", JobEngine.IsRunning); | 227 | MainConsole.Instance.Output("Job engine running: {0}", JobEngine.IsRunning); |
264 | 228 | ||
265 | JobEngine.Job job = JobEngine.CurrentJob; | 229 | JobEngine.Job job = JobEngine.CurrentJob; |
266 | MainConsole.Instance.OutputFormat("Current job {0}", job != null ? job.Name : "none"); | 230 | MainConsole.Instance.Output("Current job {0}", job != null ? job.Name : "none"); |
267 | 231 | ||
268 | MainConsole.Instance.OutputFormat( | 232 | MainConsole.Instance.Output( |
269 | "Jobs waiting: {0}", JobEngine.IsRunning ? JobEngine.JobsWaiting.ToString() : "n/a"); | 233 | "Jobs waiting: {0}", JobEngine.IsRunning ? JobEngine.JobsWaiting.ToString() : "n/a"); |
270 | MainConsole.Instance.OutputFormat("Log Level: {0}", JobEngine.LogLevel); | 234 | MainConsole.Instance.Output("Log Level: {0}", JobEngine.LogLevel); |
271 | } | 235 | } |
272 | else if (subCommand == "log") | 236 | else if (subCommand == "log") |
273 | { | 237 | { |
@@ -282,12 +246,12 @@ namespace OpenSim.Framework.Monitoring | |||
282 | // if (ConsoleUtil.TryParseConsoleInt(MainConsole.Instance, args[4], out logLevel)) | 246 | // if (ConsoleUtil.TryParseConsoleInt(MainConsole.Instance, args[4], out logLevel)) |
283 | // { | 247 | // { |
284 | JobEngine.LogLevel = logLevel; | 248 | JobEngine.LogLevel = logLevel; |
285 | MainConsole.Instance.OutputFormat("Set debug log level to {0}", JobEngine.LogLevel); | 249 | MainConsole.Instance.Output("Set debug log level to {0}", JobEngine.LogLevel); |
286 | // } | 250 | // } |
287 | } | 251 | } |
288 | else | 252 | else |
289 | { | 253 | { |
290 | MainConsole.Instance.OutputFormat("Unrecognized job engine subcommand {0}", subCommand); | 254 | MainConsole.Instance.Output("Unrecognized job engine subcommand {0}", subCommand); |
291 | } | 255 | } |
292 | } | 256 | } |
293 | } | 257 | } |