aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2014-07-05 00:48:01 +0100
committerJustin Clark-Casey2014-08-02 00:52:53 +0100
commit6b5533dbdb63998e5feb68a912a0b39c8253685d (patch)
treed7ca756b4040ceb4bbed78be56bc3f55b4c18f03 /OpenSim
parentSmall change to my previous commit: not so aggressive on the trigger, please. (diff)
downloadopensim-SC_OLD-6b5533dbdb63998e5feb68a912a0b39c8253685d.zip
opensim-SC_OLD-6b5533dbdb63998e5feb68a912a0b39c8253685d.tar.gz
opensim-SC_OLD-6b5533dbdb63998e5feb68a912a0b39c8253685d.tar.bz2
opensim-SC_OLD-6b5533dbdb63998e5feb68a912a0b39c8253685d.tar.xz
Add experimental "show grid size" robust console command.
This will show an approximate grid size that doesn't count regions that are hyperlinks Not particularly trustworthy since it will still count regions that are not active but were not deregistered (deliberately or due to simulator crash or similar)
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Services/GridService/GridService.cs39
1 files changed, 34 insertions, 5 deletions
diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs
index 394ba24..3c1e9f3 100644
--- a/OpenSim/Services/GridService/GridService.cs
+++ b/OpenSim/Services/GridService/GridService.cs
@@ -117,12 +117,19 @@ namespace OpenSim.Services.GridService
117 "For example, show region at 1000 1000", 117 "For example, show region at 1000 1000",
118 HandleShowRegionAt); 118 HandleShowRegionAt);
119 119
120 MainConsole.Instance.Commands.AddCommand("Regions", true, 120 MainConsole.Instance.Commands.AddCommand("General", true,
121 "set region flags", 121 "show grid size",
122 "set region flags <Region name> <flags>", 122 "show grid size",
123 "Set database flags for region", 123 "Show the current grid size (excluding hyperlink references)",
124 String.Empty, 124 String.Empty,
125 HandleSetFlags); 125 HandleShowGridSize);
126
127 MainConsole.Instance.Commands.AddCommand("Regions", true,
128 "set region flags",
129 "set region flags <Region name> <flags>",
130 "Set database flags for region",
131 String.Empty,
132 HandleSetFlags);
126 } 133 }
127 m_HypergridLinker = new HypergridLinker(m_config, this, m_Database); 134 m_HypergridLinker = new HypergridLinker(m_config, this, m_Database);
128 } 135 }
@@ -615,6 +622,28 @@ namespace OpenSim.Services.GridService
615 OutputRegionsToConsoleSummary(regions); 622 OutputRegionsToConsoleSummary(regions);
616 } 623 }
617 624
625 private void HandleShowGridSize(string module, string[] cmd)
626 {
627 List<RegionData> regions = m_Database.Get(int.MinValue, int.MinValue, int.MaxValue, int.MaxValue, UUID.Zero);
628
629 double size = 0;
630
631 foreach (RegionData region in regions)
632 {
633 int flags = Convert.ToInt32(region.Data["flags"]);
634
635 if ((flags & (int)Framework.RegionFlags.Hyperlink) == 0)
636 size += region.sizeX * region.sizeY;
637 }
638
639 MainConsole.Instance.Output("This is a very rough approximation.");
640 MainConsole.Instance.Output("Although it will not count regions that are actually links to others over the Hypergrid, ");
641 MainConsole.Instance.Output("it will count regions that are inactive but were not deregistered from the grid service");
642 MainConsole.Instance.Output("(e.g. simulator crashed rather than shutting down cleanly).\n");
643
644 MainConsole.Instance.OutputFormat("Grid size: {0} km squared.", size / 1000000);
645 }
646
618 private void HandleShowRegion(string module, string[] cmd) 647 private void HandleShowRegion(string module, string[] cmd)
619 { 648 {
620 if (cmd.Length != 4) 649 if (cmd.Length != 4)