mirror of
https://github.com/opensim/opensim.git
synced 2026-08-07 17:55:48 +08:00
Massive tab and trailing space cleanup
This commit is contained in:
@@ -78,7 +78,7 @@ namespace OpenSim.Framework.Monitoring
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
|
||||
public virtual string XReport(string uptime, string version)
|
||||
{
|
||||
return (string) Math.Round(GC.GetTotalMemory(false) / 1024.0 / 1024.0).ToString() ;
|
||||
|
||||
@@ -79,7 +79,7 @@ namespace OpenSim.Framework.Monitoring
|
||||
string category,
|
||||
string container,
|
||||
Func<Check, bool> checkFunc,
|
||||
StatVerbosity verbosity)
|
||||
StatVerbosity verbosity)
|
||||
{
|
||||
if (ChecksManager.SubCommands.Contains(category))
|
||||
throw new Exception(
|
||||
@@ -108,9 +108,9 @@ namespace OpenSim.Framework.Monitoring
|
||||
public virtual string ToConsoleString()
|
||||
{
|
||||
return string.Format(
|
||||
"{0}.{1}.{2} - {3}",
|
||||
Category,
|
||||
Container,
|
||||
"{0}.{1}.{2} - {3}",
|
||||
Category,
|
||||
Container,
|
||||
ShortName,
|
||||
Description);
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace OpenSim.Framework.Monitoring
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
string Report();
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Report back collected statistical information in json
|
||||
/// </summary>
|
||||
|
||||
@@ -49,7 +49,7 @@ namespace OpenSim.Framework.Monitoring
|
||||
/// <summary>
|
||||
/// Is this engine running?
|
||||
/// </summary>
|
||||
public bool IsRunning { get; private set; }
|
||||
public bool IsRunning { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// The current job that the engine is running.
|
||||
@@ -73,7 +73,7 @@ namespace OpenSim.Framework.Monitoring
|
||||
/// Controls whether we need to warn in the log about exceeding the max queue size.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This is flipped to false once queue max has been exceeded and back to true when it falls below max, in
|
||||
/// This is flipped to false once queue max has been exceeded and back to true when it falls below max, in
|
||||
/// order to avoid spamming the log with lots of warnings.
|
||||
/// </remarks>
|
||||
private bool m_warnOverMaxQueue = true;
|
||||
@@ -120,7 +120,7 @@ namespace OpenSim.Framework.Monitoring
|
||||
}
|
||||
|
||||
public void Stop()
|
||||
{
|
||||
{
|
||||
lock (JobLock)
|
||||
{
|
||||
try
|
||||
@@ -150,7 +150,7 @@ namespace OpenSim.Framework.Monitoring
|
||||
/// Make a job.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// We provide this method to replace the constructor so that we can later pool job objects if necessary to
|
||||
/// We provide this method to replace the constructor so that we can later pool job objects if necessary to
|
||||
/// reduce memory churn. Normally one would directly call QueueJob() with parameters anyway.
|
||||
/// </remarks>
|
||||
/// <returns></returns>
|
||||
@@ -304,7 +304,7 @@ namespace OpenSim.Framework.Monitoring
|
||||
CommonId = commonId;
|
||||
Action = action;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Make a job. It needs to be separately queued.
|
||||
/// </summary>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("OpenSim.Framework.Monitoring")]
|
||||
@@ -14,8 +14,8 @@ using System.Runtime.InteropServices;
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
@@ -25,7 +25,7 @@ using System.Runtime.InteropServices;
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
|
||||
@@ -167,18 +167,18 @@ namespace OpenSim.Framework.Monitoring
|
||||
}
|
||||
|
||||
MakeStat("BuiltinThreadpoolWorkerThreadsAvailable", null, "threads", ContainerThreadpool,
|
||||
s =>
|
||||
{
|
||||
int workerThreads, iocpThreads;
|
||||
ThreadPool.GetAvailableThreads(out workerThreads, out iocpThreads);
|
||||
s =>
|
||||
{
|
||||
int workerThreads, iocpThreads;
|
||||
ThreadPool.GetAvailableThreads(out workerThreads, out iocpThreads);
|
||||
s.Value = workerThreads;
|
||||
});
|
||||
|
||||
MakeStat("BuiltinThreadpoolIOCPThreadsAvailable", null, "threads", ContainerThreadpool,
|
||||
s =>
|
||||
{
|
||||
int workerThreads, iocpThreads;
|
||||
ThreadPool.GetAvailableThreads(out workerThreads, out iocpThreads);
|
||||
s =>
|
||||
{
|
||||
int workerThreads, iocpThreads;
|
||||
ThreadPool.GetAvailableThreads(out workerThreads, out iocpThreads);
|
||||
s.Value = iocpThreads;
|
||||
});
|
||||
|
||||
@@ -193,10 +193,10 @@ namespace OpenSim.Framework.Monitoring
|
||||
}
|
||||
|
||||
MakeStat(
|
||||
"HTTPRequestsMade",
|
||||
"Number of outbound HTTP requests made",
|
||||
"requests",
|
||||
ContainerNetwork,
|
||||
"HTTPRequestsMade",
|
||||
"Number of outbound HTTP requests made",
|
||||
"requests",
|
||||
ContainerNetwork,
|
||||
s => s.Value = WebUtil.RequestNumber,
|
||||
MeasuresOfInterest.AverageChangeOverTime);
|
||||
|
||||
@@ -294,7 +294,7 @@ namespace OpenSim.Framework.Monitoring
|
||||
});
|
||||
}
|
||||
|
||||
// Notes on performance counters:
|
||||
// Notes on performance counters:
|
||||
// "How To Read Performance Counters": http://blogs.msdn.com/b/bclteam/archive/2006/06/02/618156.aspx
|
||||
// "How to get the CPU Usage in C#": http://stackoverflow.com/questions/278071/how-to-get-the-cpu-usage-in-c
|
||||
// "Mono Performance Counters": http://www.mono-project.com/Mono_Performance_Counters
|
||||
|
||||
@@ -90,17 +90,17 @@ namespace OpenSim.Framework.Monitoring
|
||||
// /// haven't yet been implemented...
|
||||
// /// </summary>
|
||||
// public long AssetsInCache { get { return assetsInCache; } }
|
||||
//
|
||||
//
|
||||
// /// <value>
|
||||
// /// Currently unused
|
||||
// /// </value>
|
||||
// public long TexturesInCache { get { return texturesInCache; } }
|
||||
//
|
||||
//
|
||||
// /// <value>
|
||||
// /// Currently misleading since we can't currently subtract removed asset memory usage without a performance hit
|
||||
// /// </value>
|
||||
// public long AssetCacheMemoryUsage { get { return assetCacheMemoryUsage; } }
|
||||
//
|
||||
//
|
||||
// /// <value>
|
||||
// /// Currently unused
|
||||
// /// </value>
|
||||
@@ -127,7 +127,7 @@ namespace OpenSim.Framework.Monitoring
|
||||
public float PendingUploads { get { return pendingUploads; } }
|
||||
public float ActiveScripts { get { return activeScripts; } }
|
||||
public float ScriptLinesPerSecond { get { return scriptLinesPerSecond; } }
|
||||
|
||||
|
||||
// /// <summary>
|
||||
// /// This is the time it took for the last asset request made in response to a cache miss.
|
||||
// /// </summary>
|
||||
@@ -177,7 +177,7 @@ namespace OpenSim.Framework.Monitoring
|
||||
// assetsInCache++;
|
||||
// //assetCacheMemoryUsage += asset.Data.Length;
|
||||
// }
|
||||
//
|
||||
//
|
||||
// public void RemoveAsset(UUID uuid)
|
||||
// {
|
||||
// assetsInCache--;
|
||||
@@ -204,7 +204,7 @@ namespace OpenSim.Framework.Monitoring
|
||||
// texturesInCache = 0;
|
||||
// textureCacheMemoryUsage = 0;
|
||||
// }
|
||||
//
|
||||
//
|
||||
// public void AddAssetRequestTimeAfterCacheMiss(TimeSpan ts)
|
||||
// {
|
||||
// assetRequestTimeAfterCacheMiss = ts;
|
||||
@@ -306,7 +306,7 @@ namespace OpenSim.Framework.Monitoring
|
||||
StringBuilder sb = new StringBuilder(Environment.NewLine);
|
||||
// sb.Append("ASSET STATISTICS");
|
||||
// sb.Append(Environment.NewLine);
|
||||
|
||||
|
||||
/*
|
||||
sb.Append(
|
||||
string.Format(
|
||||
@@ -342,7 +342,7 @@ Asset service request failures: {3}" + Environment.NewLine,
|
||||
List<Stat> stats = StatsManager.GetStatsFromEachContainer("clientstack", "ClientLogoutsDueToNoReceives");
|
||||
|
||||
sb.AppendFormat(
|
||||
"Client logouts due to no data receive timeout: {0}\n\n",
|
||||
"Client logouts due to no data receive timeout: {0}\n\n",
|
||||
stats != null ? stats.Sum(s => s.Value).ToString() : "unknown");
|
||||
|
||||
// sb.Append(Environment.NewLine);
|
||||
@@ -443,10 +443,10 @@ Asset service request failures: {3}" + Environment.NewLine,
|
||||
foreach (ProcessThread currentThread in
|
||||
Process.GetCurrentProcess().Threads)
|
||||
{
|
||||
// A known issue with the current process .Threads property is
|
||||
// that it can return null threads, thus don't count those as
|
||||
// A known issue with the current process .Threads property is
|
||||
// that it can return null threads, thus don't count those as
|
||||
// running threads and prevent the program function from failing
|
||||
if (currentThread != null &&
|
||||
if (currentThread != null &&
|
||||
currentThread.ThreadState == ThreadState.Running)
|
||||
{
|
||||
numberThreadsRunning++;
|
||||
@@ -505,7 +505,7 @@ Asset service request failures: {3}" + Environment.NewLine,
|
||||
"{0:0.##}", numberThreadsRunning));
|
||||
args["ProcMem"] = OSD.FromString(String.Format("{0:#,###,###.##}",
|
||||
memUsage));
|
||||
|
||||
|
||||
return args;
|
||||
}
|
||||
}
|
||||
@@ -531,12 +531,12 @@ Asset service request failures: {3}" + Environment.NewLine,
|
||||
{
|
||||
return m_statsProvider.GetStats();
|
||||
}
|
||||
|
||||
|
||||
public string XReport(string uptime, string version)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
public OSDMap OReport(string uptime, string version)
|
||||
{
|
||||
OSDMap ret = new OSDMap();
|
||||
|
||||
@@ -121,17 +121,17 @@ namespace OpenSim.Framework.Monitoring
|
||||
string container,
|
||||
StatType type,
|
||||
Action<Stat> pullAction,
|
||||
StatVerbosity verbosity)
|
||||
StatVerbosity verbosity)
|
||||
: this(
|
||||
shortName,
|
||||
name,
|
||||
description,
|
||||
unitName,
|
||||
category,
|
||||
container,
|
||||
type,
|
||||
MeasuresOfInterest.None,
|
||||
pullAction,
|
||||
shortName,
|
||||
name,
|
||||
description,
|
||||
unitName,
|
||||
category,
|
||||
container,
|
||||
type,
|
||||
MeasuresOfInterest.None,
|
||||
pullAction,
|
||||
verbosity)
|
||||
{
|
||||
}
|
||||
@@ -227,11 +227,11 @@ namespace OpenSim.Framework.Monitoring
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.AppendFormat(
|
||||
"{0}.{1}.{2} : {3}{4}",
|
||||
Category,
|
||||
Container,
|
||||
ShortName,
|
||||
Value,
|
||||
"{0}.{1}.{2} : {3}{4}",
|
||||
Category,
|
||||
Container,
|
||||
ShortName,
|
||||
Value,
|
||||
string.IsNullOrEmpty(UnitName) ? "" : string.Format(" {0}", UnitName));
|
||||
|
||||
AppendMeasuresOfInterest(sb);
|
||||
@@ -290,7 +290,7 @@ namespace OpenSim.Framework.Monitoring
|
||||
lock (m_samples)
|
||||
{
|
||||
// m_log.DebugFormat(
|
||||
// "[STAT]: Samples for {0} are {1}",
|
||||
// "[STAT]: Samples for {0} are {1}",
|
||||
// Name, string.Join(",", m_samples.Select(s => s.ToString()).ToArray()));
|
||||
|
||||
foreach (double s in m_samples)
|
||||
@@ -326,9 +326,9 @@ namespace OpenSim.Framework.Monitoring
|
||||
if (ComputeMeasuresOfInterest(out lastChangeOverTime, out averageChangeOverTime))
|
||||
{
|
||||
sb.AppendFormat(
|
||||
", {0:0.##}{1}/s, {2:0.##}{3}/s",
|
||||
lastChangeOverTime,
|
||||
string.IsNullOrEmpty(UnitName) ? "" : string.Format(" {0}", UnitName),
|
||||
", {0:0.##}{1}/s, {2:0.##}{3}/s",
|
||||
lastChangeOverTime,
|
||||
string.IsNullOrEmpty(UnitName) ? "" : string.Format(" {0}", UnitName),
|
||||
averageChangeOverTime,
|
||||
string.IsNullOrEmpty(UnitName) ? "" : string.Format(" {0}", UnitName));
|
||||
}
|
||||
|
||||
@@ -99,13 +99,13 @@ namespace OpenSim.Framework.Monitoring
|
||||
}
|
||||
|
||||
string path = cmd[2];
|
||||
|
||||
|
||||
using (StreamWriter sw = new StreamWriter(path, true))
|
||||
{
|
||||
foreach (string line in GetReport())
|
||||
sw.WriteLine(line);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
MainConsole.Instance.OutputFormat("Stats saved to file {0}", path);
|
||||
}
|
||||
|
||||
|
||||
@@ -274,7 +274,7 @@ namespace OpenSim.Framework.Monitoring
|
||||
{
|
||||
if (!(string.IsNullOrEmpty(pContainerName) || pContainerName == AllSubCommand || pContainerName == contName))
|
||||
continue;
|
||||
|
||||
|
||||
OSDMap statMap = new OSDMap();
|
||||
|
||||
SortedDictionary<string, Stat> theStats = RegisteredStats[catName][contName];
|
||||
@@ -398,7 +398,7 @@ namespace OpenSim.Framework.Monitoring
|
||||
{
|
||||
if (!TryGetStatParents(stat, out category, out container))
|
||||
return false;
|
||||
|
||||
|
||||
if(container != null)
|
||||
{
|
||||
container.Remove(stat.ShortName);
|
||||
|
||||
@@ -96,7 +96,7 @@ namespace OpenSim.Framework.Monitoring
|
||||
FirstTick = Environment.TickCount & Int32.MaxValue;
|
||||
LastTick = FirstTick;
|
||||
|
||||
Stat
|
||||
Stat
|
||||
= new Stat(
|
||||
name,
|
||||
string.Format("Last update of thread {0}", name),
|
||||
|
||||
@@ -36,16 +36,16 @@ namespace OpenSim.Framework.Monitoring
|
||||
/// Manages various work items in the simulator.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Currently, here work can be started
|
||||
/// Currently, here work can be started
|
||||
/// * As a long-running and monitored thread.
|
||||
/// * In a thread that will never timeout but where the job is expected to eventually complete.
|
||||
/// * In a threadpool thread that will timeout if it takes a very long time to complete (> 10 mins).
|
||||
/// * As a job which will be run in a single-threaded job engine. Such jobs must not incorporate delays (sleeps,
|
||||
/// network waits, etc.).
|
||||
///
|
||||
///
|
||||
/// This is an evolving approach to better manage the work that OpenSimulator is asked to do from a very diverse
|
||||
/// range of sources (client actions, incoming network, outgoing network calls, etc.).
|
||||
///
|
||||
///
|
||||
/// Util.FireAndForget is still available to insert jobs in the threadpool, though this is equivalent to
|
||||
/// WorkManager.RunInThreadPool().
|
||||
/// </remarks>
|
||||
@@ -122,7 +122,7 @@ namespace OpenSim.Framework.Monitoring
|
||||
thread.Priority = priority;
|
||||
thread.IsBackground = isBackground;
|
||||
thread.Name = name;
|
||||
|
||||
|
||||
Watchdog.ThreadWatchdogInfo twi
|
||||
= new Watchdog.ThreadWatchdogInfo(thread, timeout, name)
|
||||
{ AlarmIfTimeout = alarmIfTimeout, AlarmMethod = alarmMethod };
|
||||
@@ -144,7 +144,7 @@ namespace OpenSim.Framework.Monitoring
|
||||
/// <param name="name">Name of the thread</param>
|
||||
public static void RunInThread(WaitCallback callback, object obj, string name, bool log = false)
|
||||
{
|
||||
if (Util.FireAndForgetMethod == FireAndForgetMethod.RegressionTest)
|
||||
if (Util.FireAndForgetMethod == FireAndForgetMethod.RegressionTest)
|
||||
{
|
||||
Culture.SetCurrentCulture();
|
||||
callback(obj);
|
||||
@@ -169,7 +169,7 @@ namespace OpenSim.Framework.Monitoring
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Run the callback via a threadpool thread.
|
||||
/// Run the callback via a threadpool thread.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Such jobs may run after some delay but must always complete.
|
||||
@@ -188,17 +188,17 @@ namespace OpenSim.Framework.Monitoring
|
||||
/// <remarks>
|
||||
/// This differs from direct scheduling (e.g. Util.FireAndForget) in that a job can be run in the job
|
||||
/// engine if it is running, where all jobs are currently performed in sequence on a single thread. This is
|
||||
/// to prevent observed overload and server freeze problems when there are hundreds of connections which all attempt to
|
||||
/// to prevent observed overload and server freeze problems when there are hundreds of connections which all attempt to
|
||||
/// perform work at once (e.g. in conference situations). With lower numbers of connections, the small
|
||||
/// delay in performing jobs in sequence rather than concurrently has not been notiecable in testing, though a future more
|
||||
/// delay in performing jobs in sequence rather than concurrently has not been notiecable in testing, though a future more
|
||||
/// sophisticated implementation could perform jobs concurrently when the server is under low load.
|
||||
///
|
||||
///
|
||||
/// However, be advised that some callers of this function rely on all jobs being performed in sequence if any
|
||||
/// jobs are performed in sequence (i.e. if jobengine is active or not). Therefore, expanding the jobengine
|
||||
/// beyond a single thread will require considerable thought.
|
||||
///
|
||||
///
|
||||
/// Also, any jobs submitted must be guaranteed to complete within a reasonable timeframe (e.g. they cannot
|
||||
/// incorporate a network delay with a long timeout). At the moment, work that could suffer such issues
|
||||
/// incorporate a network delay with a long timeout). At the moment, work that could suffer such issues
|
||||
/// should still be run directly with RunInThread(), Util.FireAndForget(), etc. This is another area where
|
||||
/// the job engine could be improved and so CPU utilization improved by better management of concurrency within
|
||||
/// OpenSimulator.
|
||||
@@ -212,10 +212,10 @@ namespace OpenSim.Framework.Monitoring
|
||||
/// <param name="log">If set to true then extra logging is performed.</param>
|
||||
public static void RunJob(
|
||||
string jobType, WaitCallback callback, object obj, string name,
|
||||
bool canRunInThisThread = false, bool mustNotTimeout = false,
|
||||
bool canRunInThisThread = false, bool mustNotTimeout = false,
|
||||
bool log = false)
|
||||
{
|
||||
if (Util.FireAndForgetMethod == FireAndForgetMethod.RegressionTest)
|
||||
if (Util.FireAndForgetMethod == FireAndForgetMethod.RegressionTest)
|
||||
{
|
||||
Culture.SetCurrentCulture();
|
||||
callback(obj);
|
||||
@@ -273,16 +273,16 @@ namespace OpenSim.Framework.Monitoring
|
||||
MainConsole.Instance.Output("Usage: debug jobengine log <level>");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// int logLevel;
|
||||
int logLevel = int.Parse(args[3]);
|
||||
// if (ConsoleUtil.TryParseConsoleInt(MainConsole.Instance, args[4], out logLevel))
|
||||
// {
|
||||
// {
|
||||
JobEngine.LogLevel = logLevel;
|
||||
MainConsole.Instance.OutputFormat("Set debug log level to {0}", JobEngine.LogLevel);
|
||||
// }
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
MainConsole.Instance.OutputFormat("Unrecognized job engine subcommand {0}", subCommand);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user