diff options
author | Justin Clark-Casey (justincc) | 2014-07-05 00:48:01 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2014-07-05 00:50:33 +0100 |
commit | 219d2734181e615199ccfd6c10d595ea6aa41b14 (patch) | |
tree | 713698ac9dfb9e3368fc9964383820d904359aba /OpenSim/Services/GridService | |
parent | Merge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff) | |
download | opensim-SC_OLD-219d2734181e615199ccfd6c10d595ea6aa41b14.zip opensim-SC_OLD-219d2734181e615199ccfd6c10d595ea6aa41b14.tar.gz opensim-SC_OLD-219d2734181e615199ccfd6c10d595ea6aa41b14.tar.bz2 opensim-SC_OLD-219d2734181e615199ccfd6c10d595ea6aa41b14.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/Services/GridService')
-rw-r--r-- | OpenSim/Services/GridService/GridService.cs | 39 |
1 files changed, 34 insertions, 5 deletions
diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index 477f54b..e0e2f03 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs | |||
@@ -118,12 +118,19 @@ namespace OpenSim.Services.GridService | |||
118 | "For example, show region at 1000 1000", | 118 | "For example, show region at 1000 1000", |
119 | HandleShowRegionAt); | 119 | HandleShowRegionAt); |
120 | 120 | ||
121 | MainConsole.Instance.Commands.AddCommand("Regions", true, | 121 | MainConsole.Instance.Commands.AddCommand("General", true, |
122 | "set region flags", | 122 | "show grid size", |
123 | "set region flags <Region name> <flags>", | 123 | "show grid size", |
124 | "Set database flags for region", | 124 | "Show the current grid size (excluding hyperlink references)", |
125 | String.Empty, | 125 | String.Empty, |
126 | HandleSetFlags); | 126 | HandleShowGridSize); |
127 | |||
128 | MainConsole.Instance.Commands.AddCommand("Regions", true, | ||
129 | "set region flags", | ||
130 | "set region flags <Region name> <flags>", | ||
131 | "Set database flags for region", | ||
132 | String.Empty, | ||
133 | HandleSetFlags); | ||
127 | } | 134 | } |
128 | m_HypergridLinker = new HypergridLinker(m_config, this, m_Database); | 135 | m_HypergridLinker = new HypergridLinker(m_config, this, m_Database); |
129 | } | 136 | } |
@@ -620,6 +627,28 @@ namespace OpenSim.Services.GridService | |||
620 | OutputRegionsToConsoleSummary(regions); | 627 | OutputRegionsToConsoleSummary(regions); |
621 | } | 628 | } |
622 | 629 | ||
630 | private void HandleShowGridSize(string module, string[] cmd) | ||
631 | { | ||
632 | List<RegionData> regions = m_Database.Get(int.MinValue, int.MinValue, int.MaxValue, int.MaxValue, UUID.Zero); | ||
633 | |||
634 | double size = 0; | ||
635 | |||
636 | foreach (RegionData region in regions) | ||
637 | { | ||
638 | int flags = Convert.ToInt32(region.Data["flags"]); | ||
639 | |||
640 | if ((flags & (int)Framework.RegionFlags.Hyperlink) == 0) | ||
641 | size += region.sizeX * region.sizeY; | ||
642 | } | ||
643 | |||
644 | MainConsole.Instance.Output("This is a very rough approximation."); | ||
645 | MainConsole.Instance.Output("Although it will not count regions that are actually links to others over the Hypergrid, "); | ||
646 | MainConsole.Instance.Output("it will count regions that are inactive but were not deregistered from the grid service"); | ||
647 | MainConsole.Instance.Output("(e.g. simulator crashed rather than shutting down cleanly).\n"); | ||
648 | |||
649 | MainConsole.Instance.OutputFormat("Grid size: {0} km squared.", size / 1000000); | ||
650 | } | ||
651 | |||
623 | private void HandleShowRegion(string module, string[] cmd) | 652 | private void HandleShowRegion(string module, string[] cmd) |
624 | { | 653 | { |
625 | if (cmd.Length != 4) | 654 | if (cmd.Length != 4) |