29 using System.Collections.Generic;
30 using System.Reflection;
32 using System.Text.RegularExpressions;
38 using OpenSim.Framework;
39 using OpenSim.Framework.Console;
40 using OpenSim.Framework.Monitoring;
41 using OpenSim.Region.Framework.Interfaces;
42 using OpenSim.Region.Framework.Scenes;
49 [Extension(Path =
"/OpenSim/RegionModules", NodeName =
"RegionModule", Id =
"RegionCommandsModule")]
52 private Scene m_scene;
55 public string Name {
get {
return "Region Commands Module"; } }
57 public Type ReplaceableInterface {
get {
return null; } }
79 m_console = MainConsole.Instance;
81 m_console.Commands.AddCommand(
82 "Regions",
false,
"show scene",
84 "Show live information for the currently selected scene (fps, prims, etc.).", HandleShowScene);
86 m_console.Commands.AddCommand(
87 "Regions",
false,
"show region",
89 "Show control information for the currently selected region (host name, max physical prim size, etc).",
90 "A synonym for \"region get\"",
93 m_console.Commands.AddCommand(
94 "Regions",
false,
"region get",
96 "Show control information for the currently selected region (host name, max physical prim size, etc).",
97 "Some parameters can be set with the \"region set\" command.\n"
98 +
"Others must be changed via a viewer (usually via the region/estate dialog box).",
101 m_console.Commands.AddCommand(
102 "Regions",
false,
"region set",
104 "Set control information for the currently selected region.",
105 "Currently, the following parameters can be set:\n"
106 +
"agent-limit <int> - Current root agent limit. This is persisted over restart.\n"
107 +
"max-agent-limit <int> - Maximum root agent limit. agent-limit cannot exceed this."
108 +
" This is not persisted over restart - to set it every time you must add a MaxAgents entry to your regions file.",
122 private void HandleShowRegion(
string module,
string[] cmd)
130 StringBuilder sb =
new StringBuilder();
131 sb.AppendFormat(
"Region information for {0}\n", m_scene.Name);
134 dispList.AddRow(
"Region ID", ri.RegionID);
135 dispList.AddRow(
"Region handle", ri.RegionHandle);
136 dispList.AddRow(
"Region location", string.Format(
"{0},{1}", ri.RegionLocX, ri.RegionLocY));
137 dispList.AddRow(
"Region size", string.Format(
"{0}x{1}", ri.RegionSizeX, ri.RegionSizeY));
139 dispList.AddRow(
"Maturity", rs.Maturity);
140 dispList.AddRow(
"Region address", ri.ServerURI);
141 dispList.AddRow(
"From region file", ri.RegionFile);
142 dispList.AddRow(
"External endpoint", ri.ExternalEndPoint);
143 dispList.AddRow(
"Internal endpoint", ri.InternalEndPoint);
144 dispList.AddRow(
"Access level", ri.AccessLevel);
145 dispList.AddRow(
"Agent limit", rs.AgentLimit);
146 dispList.AddRow(
"Max agent limit", ri.AgentCapacity);
147 dispList.AddRow(
"Linkset capacity", ri.LinksetCapacity <= 0 ?
"not set" : ri.LinksetCapacity.ToString());
148 dispList.AddRow(
"Prim capacity", ri.ObjectCapacity);
149 dispList.AddRow(
"Prim bonus", rs.ObjectBonus);
150 dispList.AddRow(
"Max prims per user", ri.MaxPrimsPerUser < 0 ?
"n/a" : ri.MaxPrimsPerUser.ToString());
151 dispList.AddRow(
"Clamp prim size", ri.ClampPrimSize);
152 dispList.AddRow(
"Non physical prim min size", ri.NonphysPrimMin <= 0 ?
"not set" : string.Format(
"{0} m", ri.NonphysPrimMin));
153 dispList.AddRow(
"Non physical prim max size", ri.NonphysPrimMax <= 0 ?
"not set" : string.Format(
"{0} m", ri.NonphysPrimMax));
154 dispList.AddRow(
"Physical prim min size", ri.PhysPrimMin <= 0 ?
"not set" : string.Format(
"{0} m", ri.PhysPrimMin));
155 dispList.AddRow(
"Physical prim max size", ri.PhysPrimMax <= 0 ?
"not set" : string.Format(
"{0} m", ri.PhysPrimMax));
157 dispList.AddRow(
"Allow Damage", rs.AllowDamage);
158 dispList.AddRow(
"Allow Land join/divide", rs.AllowLandJoinDivide);
159 dispList.AddRow(
"Allow land resell", rs.AllowLandResell);
160 dispList.AddRow(
"Block fly", rs.BlockFly);
161 dispList.AddRow(
"Block show in search", rs.BlockShowInSearch);
162 dispList.AddRow(
"Block terraform", rs.BlockTerraform);
163 dispList.AddRow(
"Covenant UUID", rs.Covenant);
164 dispList.AddRow(
"Convenant change Unix time", rs.CovenantChangedDateTime);
165 dispList.AddRow(
"Disable collisions", rs.DisableCollisions);
166 dispList.AddRow(
"Disable physics", rs.DisablePhysics);
167 dispList.AddRow(
"Disable scripts", rs.DisableScripts);
168 dispList.AddRow(
"Restrict pushing", rs.RestrictPushing);
169 dispList.AddRow(
"Fixed sun", rs.FixedSun);
170 dispList.AddRow(
"Sun position", rs.SunPosition);
171 dispList.AddRow(
"Sun vector", rs.SunVector);
172 dispList.AddRow(
"Use estate sun", rs.UseEstateSun);
173 dispList.AddRow(
"Telehub UUID", rs.TelehubObject);
174 dispList.AddRow(
"Terrain lower limit", string.Format(
"{0} m", rs.TerrainLowerLimit));
175 dispList.AddRow(
"Terrain raise limit", string.Format(
"{0} m", rs.TerrainRaiseLimit));
176 dispList.AddRow(
"Water height", string.Format(
"{0} m", rs.WaterHeight));
178 dispList.AddRow(
"Maptile static file", ri.MaptileStaticFile);
179 dispList.AddRow(
"Maptile static UUID", ri.MaptileStaticUUID);
180 dispList.AddRow(
"Last map refresh", ri.lastMapRefresh);
181 dispList.AddRow(
"Last map UUID", ri.lastMapUUID);
183 dispList.AddToStringBuilder(sb);
185 MainConsole.Instance.Output(sb.ToString());
188 private void HandleRegionSet(
string module,
string[] args)
193 if (args.Length != 4)
195 MainConsole.Instance.OutputFormat(
"Usage: region set <param> <value>");
199 string param = args[2];
200 string rawValue = args[3];
208 if (param ==
"agent-limit")
217 MainConsole.Instance.OutputFormat(
218 "Cannot set {0} to {1} in {2} as max-agent-limit is {3}",
"agent-limit",
219 newValue, m_scene.Name, ri.AgentCapacity);
223 rs.AgentLimit = newValue;
225 MainConsole.Instance.OutputFormat(
226 "{0} set to {1} in {2}",
"agent-limit", newValue, m_scene.Name);
231 else if (param ==
"max-agent-limit")
238 ri.AgentCapacity = newValue;
240 MainConsole.Instance.OutputFormat(
241 "{0} set to {1} in {2}",
"max-agent-limit", newValue, m_scene.Name);
245 rs.AgentLimit = ri.AgentCapacity;
247 MainConsole.Instance.OutputFormat(
248 "Reducing {0} to {1} in {2}",
"agent-limit", rs.AgentLimit, m_scene.Name);
255 private void HandleShowScene(
string module,
string[] cmd)
261 float[] stats = r.LastReportedSimStats;
263 float timeDilation = stats[0];
264 float simFps = stats[1];
265 float physicsFps = stats[2];
266 float agentUpdates = stats[3];
267 float rootAgents = stats[4];
268 float childAgents = stats[5];
269 float totalPrims = stats[6];
270 float activePrims = stats[7];
271 float totalFrameTime = stats[8];
273 float physicsFrameTime = stats[10];
274 float otherFrameTime = stats[12];
276 float inPacketsPerSecond = stats[13];
277 float outPacketsPerSecond = stats[14];
278 float unackedBytes = stats[15];
280 float pendingDownloads = stats[17];
281 float pendingUploads = stats[18];
282 float activeScripts = stats[19];
283 float scriptLinesPerSecond = stats[23];
285 StringBuilder sb =
new StringBuilder();
286 sb.AppendFormat(
"Scene statistics for {0}\n", m_scene.RegionInfo.RegionName);
289 dispList.AddRow(
"Time Dilation", timeDilation);
290 dispList.AddRow(
"Sim FPS", simFps);
291 dispList.AddRow(
"Physics FPS", physicsFps);
292 dispList.AddRow(
"Avatars", rootAgents);
293 dispList.AddRow(
"Child agents", childAgents);
294 dispList.AddRow(
"Total prims", totalPrims);
295 dispList.AddRow(
"Scripts", activeScripts);
296 dispList.AddRow(
"Script lines processed per second", scriptLinesPerSecond);
297 dispList.AddRow(
"Physics enabled prims", activePrims);
298 dispList.AddRow(
"Total frame time", totalFrameTime);
299 dispList.AddRow(
"Physics frame time", physicsFrameTime);
300 dispList.AddRow(
"Other frame time", otherFrameTime);
301 dispList.AddRow(
"Agent Updates per second", agentUpdates);
302 dispList.AddRow(
"Packets processed from clients per second", inPacketsPerSecond);
303 dispList.AddRow(
"Packets sent to clients per second", outPacketsPerSecond);
304 dispList.AddRow(
"Bytes unacknowledged by clients", unackedBytes);
305 dispList.AddRow(
"Pending asset downloads to clients", pendingDownloads);
306 dispList.AddRow(
"Pending asset uploads from clients", pendingUploads);
308 dispList.AddToStringBuilder(sb);
310 MainConsole.Instance.Output(sb.ToString());
Used to generated a formatted table for the console.
OpenSim.Framework.RegionInfo RegionInfo
OpenSim.Framework.RegionSettings RegionSettings
A module that holds commands for manipulating objects in the scene.
void RegionLoaded(Scene scene)
This will be called once for every scene loaded. In a shared module this will be multiple times in on...
void AddRegion(Scene scene)
This is called whenever a Scene is added. For shared modules, this can happen several times...
static ICommandConsole Instance
void Initialise(IConfigSource source)
This is called to initialize the region module. For shared modules, this is called exactly once...
void Close()
This is the inverse to Initialise. After a Close(), this instance won't be usable anymore...
static bool TryParseConsoleNaturalInt(ICommandConsole console, string rawConsoleInt, out int i)
Convert a console integer to a natural int, automatically complaining if a console is given...
Collect statistics from the scene to send to the client and for access by other monitoring tools...
void RemoveRegion(Scene scene)
This is called whenever a Scene is removed. For shared modules, this can happen several times...