Ejemplo n.º 1
0
        private void HandleShowThreadpoolCallsComplete(string module, string[] args)
        {
            List <KeyValuePair <string, int> > calls = Util.GetFireAndForgetCallsMade().ToList();

            calls.Sort((kvp1, kvp2) => kvp2.Value.CompareTo(kvp1.Value));
            int namedCallsMade = 0;

            ConsoleDisplayList cdl = new ConsoleDisplayList();

            foreach (KeyValuePair <string, int> kvp in calls)
            {
                cdl.AddRow(kvp.Key, kvp.Value);
                namedCallsMade += kvp.Value;
            }

            cdl.AddRow("TOTAL NAMED", namedCallsMade);

            long allCallsMade = Util.TotalFireAndForgetCallsMade;

            cdl.AddRow("TOTAL ANONYMOUS", allCallsMade - namedCallsMade);
            cdl.AddRow("TOTAL ALL", allCallsMade);

            MainConsole.Instance.Output(cdl.ToString());
        }
        private void HandleGetCommand(string module, string[] args)
        {
            if (SceneManager.Instance.CurrentScene != null && SceneManager.Instance.CurrentScene != m_udpServer.Scene)
            {
                return;
            }

            m_console.OutputFormat("Debug settings for {0}", m_udpServer.Scene.Name);
            ConsoleDisplayList cdl = new ConsoleDisplayList();

            long maxSceneDripRate = (long)m_udpServer.Throttle.MaxDripRate;

            cdl.AddRow(
                "max-scene-throttle",
                maxSceneDripRate != 0 ? string.Format("{0} kbps", maxSceneDripRate * 8 / 1000) : "unset");

            int maxClientDripRate = m_udpServer.ThrottleRates.Total;

            cdl.AddRow(
                "max-new-client-throttle",
                maxClientDripRate != 0 ? string.Format("{0} kbps", maxClientDripRate * 8 / 1000) : "unset");

            m_console.Output(cdl.ToString());
        }
Ejemplo n.º 3
0
        private void HandleCheckWearablesCommand(string module, string[] cmd)
        {
            if (cmd.Length != 4)
            {
                MainConsole.Instance.Output("Usage: wearables check <first-name> <last-name>");
                return;
            }

            string firstname = cmd[2];
            string lastname  = cmd[3];

            StringBuilder sb           = new StringBuilder();
            UuidGatherer  uuidGatherer = new UuidGatherer(m_scenes[0].AssetService);

            lock (m_scenes)
            {
                foreach (Scene scene in m_scenes)
                {
                    ScenePresence sp = scene.GetScenePresence(firstname, lastname);
                    if (sp != null && !sp.IsChildAgent)
                    {
                        sb.AppendFormat("Wearables checks for {0}\n\n", sp.Name);

                        AvatarWearable[] wearables = sp.Appearance.Wearables;
                        if (wearables.Length == 0)
                        {
                            MainConsole.Instance.Output("avatar has no wearables");
                            return;
                        }

                        for (int i = 0; i < wearables.Length; i++)
                        {
                            AvatarWearable aw = wearables[i];

                            sb.Append(Enum.GetName(typeof(WearableType), i));
                            sb.Append("\n");
                            if (aw.Count > 0)
                            {
                                for (int j = 0; j < aw.Count; j++)
                                {
                                    WearableItem wi = aw[j];

                                    ConsoleDisplayList cdl = new ConsoleDisplayList();
                                    cdl.Indent = 2;
                                    cdl.AddRow("Item UUID", wi.ItemID);
                                    cdl.AddRow("Assets", "");
                                    sb.Append(cdl.ToString());

                                    uuidGatherer.AddForInspection(wi.AssetID);
                                    uuidGatherer.GatherAll();
                                    string[] assetStrings
                                        = Array.ConvertAll <UUID, string>(uuidGatherer.GatheredUuids.Keys.ToArray(), u => u.ToString());

                                    bool[] existChecks = scene.AssetService.AssetsExist(assetStrings);

                                    ConsoleDisplayTable cdt = new ConsoleDisplayTable();
                                    cdt.Indent = 4;
                                    cdt.AddColumn("Type", 10);
                                    cdt.AddColumn("UUID", ConsoleDisplayUtil.UuidSize);
                                    cdt.AddColumn("Found", 5);

                                    for (int k = 0; k < existChecks.Length; k++)
                                    {
                                        cdt.AddRow(
                                            (AssetType)uuidGatherer.GatheredUuids[new UUID(assetStrings[k])],
                                            assetStrings[k], existChecks[k] ? "yes" : "no");
                                    }

                                    sb.Append(cdt.ToString());
                                    sb.Append("\n");
                                }
                            }
                            else
                            {
                                sb.Append("  Empty\n");
                            }
                        }
                    }
                }
            }

            MainConsole.Instance.Output(sb.ToString());
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Append a scene object part report to an input StringBuilder
        /// </summary>
        /// <returns></returns>
        /// <param name='sb'></param>
        /// <param name='sop'</param>
        /// <param name='showFull'>
        /// If true then information on each inventory item will be shown.
        /// If false then only summary inventory information is shown.
        /// </param>
        private StringBuilder AddScenePartReport(StringBuilder sb, SceneObjectPart sop, bool showFull)
        {
            ConsoleDisplayList cdl = new ConsoleDisplayList();

            cdl.AddRow("Name", sop.Name);
            cdl.AddRow("Description", sop.Description);
            cdl.AddRow("Local ID", sop.LocalId);
            cdl.AddRow("UUID", sop.UUID);
            cdl.AddRow("Location", string.Format("{0} @ {1}", sop.AbsolutePosition, sop.ParentGroup.Scene.Name));
            cdl.AddRow(
                "Parent",
                sop.IsRoot ? "Is Root" : string.Format("{0} {1}", sop.ParentGroup.Name, sop.ParentGroup.UUID));
            cdl.AddRow("Link number", sop.LinkNum);
            cdl.AddRow("Flags", sop.Flags);

            if (showFull)
            {
                PrimitiveBaseShape s = sop.Shape;
                cdl.AddRow("FlexiDrag", s.FlexiDrag);
                cdl.AddRow("FlexiEntry", s.FlexiEntry);
                cdl.AddRow("FlexiForce", string.Format("<{0},{1},{2}>", s.FlexiForceX, s.FlexiForceY, s.FlexiForceZ));
                cdl.AddRow("FlexiGravity", s.FlexiGravity);
                cdl.AddRow("FlexiSoftness", s.FlexiSoftness);
                cdl.AddRow("HollowShape", s.HollowShape);
                cdl.AddRow(
                    "LightColor",
                    string.Format("<{0},{1},{2},{3}>", s.LightColorR, s.LightColorB, s.LightColorG, s.LightColorA));
                cdl.AddRow("LightCutoff", s.LightCutoff);
                cdl.AddRow("LightEntry", s.LightEntry);
                cdl.AddRow("LightFalloff", s.LightFalloff);
                cdl.AddRow("LightIntensity", s.LightIntensity);
                cdl.AddRow("LightRadius", s.LightRadius);
                cdl.AddRow("Location (relative)", sop.RelativePosition);
                cdl.AddRow("Media", string.Format("{0} entries", s.Media != null ? s.Media.Count.ToString() : "n/a"));
                cdl.AddRow("PathBegin", s.PathBegin);
                cdl.AddRow("PathEnd", s.PathEnd);
                cdl.AddRow("PathCurve", s.PathCurve);
                cdl.AddRow("PathRadiusOffset", s.PathRadiusOffset);
                cdl.AddRow("PathRevolutions", s.PathRevolutions);
                cdl.AddRow("PathScale", string.Format("<{0},{1}>", s.PathScaleX, s.PathScaleY));
                cdl.AddRow("PathSkew", string.Format("<{0},{1}>", s.PathShearX, s.PathShearY));
                cdl.AddRow("FlexiDrag", s.PathSkew);
                cdl.AddRow("PathTaper", string.Format("<{0},{1}>", s.PathTaperX, s.PathTaperY));
                cdl.AddRow("PathTwist", s.PathTwist);
                cdl.AddRow("PathTwistBegin", s.PathTwistBegin);
                cdl.AddRow("PCode", s.PCode);
                cdl.AddRow("ProfileBegin", s.ProfileBegin);
                cdl.AddRow("ProfileEnd", s.ProfileEnd);
                cdl.AddRow("ProfileHollow", s.ProfileHollow);
                cdl.AddRow("ProfileShape", s.ProfileShape);
                cdl.AddRow("ProjectionAmbiance", s.ProjectionAmbiance);
                cdl.AddRow("ProjectionEntry", s.ProjectionEntry);
                cdl.AddRow("ProjectionFocus", s.ProjectionFocus);
                cdl.AddRow("ProjectionFOV", s.ProjectionFOV);
                cdl.AddRow("ProjectionTextureUUID", s.ProjectionTextureUUID);
                cdl.AddRow("Rotation (Relative)", sop.RotationOffset);
                cdl.AddRow("Rotation (World)", sop.GetWorldRotation());
                cdl.AddRow("Scale", s.Scale);
                cdl.AddRow(
                    "SculptData",
                    string.Format("{0} bytes", s.SculptData != null ? s.SculptData.Length.ToString() : "n/a"));
                cdl.AddRow("SculptEntry", s.SculptEntry);
                cdl.AddRow("SculptTexture", s.SculptTexture);
                cdl.AddRow("SculptType", s.SculptType);
                cdl.AddRow("State", s.State);

                // TODO, need to display more information about textures but in a compact format
                // to stop output becoming huge.
                for (int i = 0; i < sop.GetNumberOfSides(); i++)
                {
                    Primitive.TextureEntryFace teFace = s.Textures.FaceTextures[i];

                    UUID textureID;

                    if (teFace != null)
                    {
                        textureID = teFace.TextureID;
                    }
                    else
                    {
                        textureID = s.Textures.DefaultTexture.TextureID;
                    }

                    cdl.AddRow(string.Format("Face {0} texture ID", i), textureID);
                }

                //cdl.AddRow("Textures", string.Format("{0} entries", s.Textures.
            }

            object itemsOutput;

            if (showFull)
            {
                StringBuilder itemsSb = new StringBuilder("\n");
                itemsOutput = AddScenePartItemsReport(itemsSb, sop.Inventory).ToString();
            }
            else
            {
                itemsOutput = sop.Inventory.Count;
            }

            cdl.AddRow("Items", itemsOutput);

            return(sb.Append(cdl.ToString()));
        }
Ejemplo n.º 5
0
        private void HandleShowScene(string module, string[] cmd)
        {
            if (!(MainConsole.Instance.ConsoleScene == null || MainConsole.Instance.ConsoleScene == m_scene))
            {
                return;
            }

            SimStatsReporter r = m_scene.StatsReporter;

            float[] stats = r.LastReportedSimStats;

            float timeDilation   = stats[0];
            float simFps         = stats[1];
            float physicsFps     = stats[2];
            float agentUpdates   = stats[3];
            float rootAgents     = stats[4];
            float childAgents    = stats[5];
            float totalPrims     = stats[6];
            float activePrims    = stats[7];
            float totalFrameTime = stats[8];
//            float netFrameTime            = stats.StatsBlock[9].StatValue; // Ignored - not used by OpenSimulator
            float physicsFrameTime = stats[10];
            float otherFrameTime   = stats[11];
//            float imageFrameTime          = stats.StatsBlock[12].StatValue; // Ignored
            float inPacketsPerSecond  = stats[13];
            float outPacketsPerSecond = stats[14];
            float unackedBytes        = stats[15];
//            float agentFrameTime          = stats.StatsBlock[16].StatValue; // Not really used
            float pendingDownloads     = stats[17];
            float pendingUploads       = stats[18];
            float activeScripts        = stats[19];
            float scriptLinesPerSecond = stats[20];

            StringBuilder sb = new StringBuilder();

            sb.AppendFormat("Scene statistics for {0}\n", m_scene.RegionInfo.RegionName);

            ConsoleDisplayList dispList = new ConsoleDisplayList();

            dispList.AddRow("Time Dilation", timeDilation);
            dispList.AddRow("Sim FPS", simFps);
            dispList.AddRow("Physics FPS", physicsFps);
            dispList.AddRow("Avatars", rootAgents);
            dispList.AddRow("Child agents", childAgents);
            dispList.AddRow("Total prims", totalPrims);
            dispList.AddRow("Scripts", activeScripts);
            dispList.AddRow("Script lines processed per second", scriptLinesPerSecond);
            dispList.AddRow("Physics enabled prims", activePrims);
            dispList.AddRow("Total frame time", totalFrameTime);
            dispList.AddRow("Physics frame time", physicsFrameTime);
            dispList.AddRow("Other frame time", otherFrameTime);
            dispList.AddRow("Agent Updates per second", agentUpdates);
            dispList.AddRow("Packets processed from clients per second", inPacketsPerSecond);
            dispList.AddRow("Packets sent to clients per second", outPacketsPerSecond);
            dispList.AddRow("Bytes unacknowledged by clients", unackedBytes);
            dispList.AddRow("Pending asset downloads to clients", pendingDownloads);
            dispList.AddRow("Pending asset uploads from clients", pendingUploads);

            dispList.AddToStringBuilder(sb);

            MainConsole.Instance.Output(sb.ToString());
        }
Ejemplo n.º 6
0
        private void HandleShowRegion(string module, string[] cmd)
        {
            if (!(MainConsole.Instance.ConsoleScene == null || MainConsole.Instance.ConsoleScene == m_scene))
            {
                return;
            }

            RegionInfo     ri = m_scene.RegionInfo;
            RegionSettings rs = ri.RegionSettings;

            StringBuilder sb = new StringBuilder();

            sb.AppendFormat("Region information for {0}\n", m_scene.Name);

            ConsoleDisplayList dispList = new ConsoleDisplayList();

            dispList.AddRow("Region ID", ri.RegionID);
            dispList.AddRow("Region handle", ri.RegionHandle);
            dispList.AddRow("Region location", string.Format("{0},{1}", ri.RegionLocX, ri.RegionLocY));
            dispList.AddRow("Region size", string.Format("{0}x{1}", ri.RegionSizeX, ri.RegionSizeY));
            //dispList.AddRow("Region type", ri.RegionType);
            dispList.AddRow("Maturity", rs.Maturity);
            dispList.AddRow("Region address", ri.ServerURI);
            dispList.AddRow("From region file", ri.RegionFile);
            dispList.AddRow("External endpoint", ri.ExternalEndPoint);
            dispList.AddRow("Internal endpoint", ri.InternalEndPoint);
            dispList.AddRow("Access level", ri.AccessLevel);
            dispList.AddRow("Agent limit", rs.AgentLimit);
            dispList.AddRow("Max agent limit", ri.AgentCapacity);
            dispList.AddRow("Linkset capacity", ri.LinksetCapacity <= 0 ? "not set" : ri.LinksetCapacity.ToString());
            dispList.AddRow("Prim capacity", ri.ObjectCapacity);
            dispList.AddRow("Prim bonus", rs.ObjectBonus);
            dispList.AddRow("Max prims per user", ri.MaxPrimsPerUser < 0 ? "n/a" : ri.MaxPrimsPerUser.ToString());
            dispList.AddRow("Clamp prim size", ri.ClampPrimSize);
            dispList.AddRow("Non physical prim min size", ri.NonphysPrimMin <= 0 ? "not set" : string.Format("{0} m", ri.NonphysPrimMin));
            dispList.AddRow("Non physical prim max size", ri.NonphysPrimMax <= 0 ? "not set" : string.Format("{0} m", ri.NonphysPrimMax));
            dispList.AddRow("Physical prim min size", ri.PhysPrimMin <= 0 ? "not set" : string.Format("{0} m", ri.PhysPrimMin));
            dispList.AddRow("Physical prim max size", ri.PhysPrimMax <= 0 ? "not set" : string.Format("{0} m", ri.PhysPrimMax));

            dispList.AddRow("Allow Damage", rs.AllowDamage);
            dispList.AddRow("Allow Land join/divide", rs.AllowLandJoinDivide);
            dispList.AddRow("Allow land resell", rs.AllowLandResell);
            dispList.AddRow("Block fly", rs.BlockFly);
            dispList.AddRow("Block show in search", rs.BlockShowInSearch);
            dispList.AddRow("Block terraform", rs.BlockTerraform);
            dispList.AddRow("Covenant UUID", rs.Covenant);
            dispList.AddRow("Convenant change Unix time", rs.CovenantChangedDateTime);
            dispList.AddRow("Disable collisions", rs.DisableCollisions);
            dispList.AddRow("Disable physics", rs.DisablePhysics);
            dispList.AddRow("Disable scripts", rs.DisableScripts);
            dispList.AddRow("Restrict pushing", rs.RestrictPushing);
            dispList.AddRow("Fixed sun", rs.FixedSun);
            dispList.AddRow("Sun position", rs.SunPosition);
            dispList.AddRow("Sun vector", rs.SunVector);
            dispList.AddRow("Use estate sun", rs.UseEstateSun);
            dispList.AddRow("Telehub UUID", rs.TelehubObject);
            dispList.AddRow("Terrain lower limit", string.Format("{0} m", rs.TerrainLowerLimit));
            dispList.AddRow("Terrain raise limit", string.Format("{0} m", rs.TerrainRaiseLimit));
            dispList.AddRow("Water height", string.Format("{0} m", rs.WaterHeight));

            dispList.AddRow("Maptile static file", ri.MaptileStaticFile);
            dispList.AddRow("Maptile static UUID", ri.MaptileStaticUUID);
            dispList.AddRow("Last map refresh", ri.lastMapRefresh);
            dispList.AddRow("Last map UUID", ri.lastMapUUID);

            dispList.AddToStringBuilder(sb);

            MainConsole.Instance.Output(sb.ToString());
        }
        private void GetAttachmentsReport(ScenePresence sp, StringBuilder sb)
        {
            sb.AppendFormat("Animations for {0}\n", sp.Name);

            ConsoleDisplayList cdl = new ConsoleDisplayList()
            {
                Indent = 2
            };
            ScenePresenceAnimator spa   = sp.Animator;
            AnimationSet          anims = sp.Animator.Animations;

            string cma = spa.CurrentMovementAnimation;

            cdl.AddRow(
                "Current movement anim",
                string.Format("{0}, {1}", DefaultAvatarAnimations.GetDefaultAnimation(cma), cma));

            UUID defaultAnimId = anims.DefaultAnimation.AnimID;

            cdl.AddRow(
                "Default anim",
                string.Format("{0}, {1}", defaultAnimId, sp.Animator.GetAnimName(defaultAnimId)));

            UUID implicitDefaultAnimId = anims.ImplicitDefaultAnimation.AnimID;

            cdl.AddRow(
                "Implicit default anim",
                string.Format("{0}, {1}",
                              implicitDefaultAnimId, sp.Animator.GetAnimName(implicitDefaultAnimId)));

            cdl.AddToStringBuilder(sb);

            ConsoleDisplayTable cdt = new ConsoleDisplayTable()
            {
                Indent = 2
            };

            cdt.AddColumn("Animation ID", 36);
            cdt.AddColumn("Name", 20);
            cdt.AddColumn("Seq", 3);
            cdt.AddColumn("Object ID", 36);

            UUID[] animIds;
            int[]  sequenceNumbers;
            UUID[] objectIds;

            sp.Animator.Animations.GetArrays(out animIds, out sequenceNumbers, out objectIds);

            for (int i = 0; i < animIds.Length; i++)
            {
                UUID   animId   = animIds[i];
                string animName = sp.Animator.GetAnimName(animId);
                int    seq      = sequenceNumbers[i];
                UUID   objectId = objectIds[i];

                cdt.AddRow(animId, animName, seq, objectId);
            }

            cdt.AddToStringBuilder(sb);
            sb.Append("\n");
        }
        /// <summary>
        /// Append a scene object part report to an input StringBuilder
        /// </summary>
        /// <returns></returns>
        /// <param name='sb'></param>
        /// <param name='sop'</param>
        /// <param name='showFull'>
        /// If true then information on each inventory item will be shown.
        /// If false then only summary inventory information is shown.
        /// </param>
        private StringBuilder AddScenePartReport(StringBuilder sb, SceneObjectPart sop, bool showFull)
        {
            ConsoleDisplayList cdl = new ConsoleDisplayList();

            cdl.AddRow("Name", sop.Name);
            cdl.AddRow("Description", sop.Description);
            cdl.AddRow("Local ID", sop.LocalId);
            cdl.AddRow("UUID", sop.UUID);
            cdl.AddRow("Location", string.Format("{0} @ {1}", sop.AbsolutePosition, sop.ParentGroup.Scene.Name));
            cdl.AddRow(
                "Parent",
                sop.IsRoot ? "Is Root" : string.Format("{0} {1}", sop.ParentGroup.Name, sop.ParentGroup.UUID));
            cdl.AddRow("Link number", sop.LinkNum);
            cdl.AddRow("Flags", sop.Flags);

            if (showFull)
            {
                PrimitiveBaseShape s = sop.Shape;
                cdl.AddRow("FlexiDrag", s.FlexiDrag);
                cdl.AddRow("FlexiEntry", s.FlexiEntry);
                cdl.AddRow("FlexiForce", string.Format("<{0},{1},{2}>", s.FlexiForceX, s.FlexiForceY, s.FlexiForceZ));
                cdl.AddRow("FlexiGravity", s.FlexiGravity);
                cdl.AddRow("FlexiSoftness", s.FlexiSoftness);
                cdl.AddRow("HollowShape", s.HollowShape);
                cdl.AddRow(
                    "LightColor",
                    string.Format("<{0},{1},{2},{3}>", s.LightColorR, s.LightColorB, s.LightColorG, s.LightColorA));
                cdl.AddRow("LightCutoff", s.LightCutoff);
                cdl.AddRow("LightEntry", s.LightEntry);
                cdl.AddRow("LightFalloff", s.LightFalloff);
                cdl.AddRow("LightIntensity", s.LightIntensity);
                cdl.AddRow("LightRadius", s.LightRadius);
                cdl.AddRow("Media", string.Format("{0} entries", s.Media != null ? s.Media.Count.ToString() : "n/a"));
                cdl.AddRow("PathBegin", s.PathBegin);
                cdl.AddRow("PathEnd", s.PathEnd);
                cdl.AddRow("PathCurve", s.PathCurve);
                cdl.AddRow("PathRadiusOffset", s.PathRadiusOffset);
                cdl.AddRow("PathRevolutions", s.PathRevolutions);
                cdl.AddRow("PathScale", string.Format("<{0},{1}>", s.PathScaleX, s.PathScaleY));
                cdl.AddRow("PathSkew", string.Format("<{0},{1}>", s.PathShearX, s.PathShearY));
                cdl.AddRow("FlexiDrag", s.PathSkew);
                cdl.AddRow("PathTaper", string.Format("<{0},{1}>", s.PathTaperX, s.PathTaperY));
                cdl.AddRow("PathTwist", s.PathTwist);
                cdl.AddRow("PathTwistBegin", s.PathTwistBegin);
                cdl.AddRow("PCode", s.PCode);
                cdl.AddRow("ProfileBegin", s.ProfileBegin);
                cdl.AddRow("ProfileEnd", s.ProfileEnd);
                cdl.AddRow("ProfileHollow", s.ProfileHollow);
                cdl.AddRow("ProfileShape", s.ProfileShape);
                cdl.AddRow("ProjectionAmbiance", s.ProjectionAmbiance);
                cdl.AddRow("ProjectionEntry", s.ProjectionEntry);
                cdl.AddRow("ProjectionFocus", s.ProjectionFocus);
                cdl.AddRow("ProjectionFOV", s.ProjectionFOV);
                cdl.AddRow("ProjectionTextureUUID", s.ProjectionTextureUUID);
                cdl.AddRow("Scale", s.Scale);
                cdl.AddRow(
                    "SculptData",
                    string.Format("{0} bytes", s.SculptData != null ? s.SculptData.Length.ToString() : "n/a"));
                cdl.AddRow("SculptEntry", s.SculptEntry);
                cdl.AddRow("SculptTexture", s.SculptTexture);
                cdl.AddRow("SculptType", s.SculptType);
                cdl.AddRow("State", s.State);

                // TODO, unpack and display texture entries
                //cdl.AddRow("Textures", string.Format("{0} entries", s.Textures.
            }

            object itemsOutput;

            if (showFull)
            {
                StringBuilder itemsSb = new StringBuilder("\n");
                itemsOutput = AddScenePartItemsReport(itemsSb, sop.Inventory).ToString();
            }
            else
            {
                itemsOutput = sop.Inventory.Count;
            }

            cdl.AddRow("Items", itemsOutput);

            return(sb.Append(cdl.ToString()));
        }