Add a much cheaper agent count retrieval method. This is obsoleted by 0.7 so it can be reverted then.

avinationmerge
Thomas Grimshaw 2010-04-05 22:08:34 +02:00
parent e0b287961f
commit f34cc6b469
4 changed files with 12 additions and 4 deletions

View File

@ -192,7 +192,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Regions
protected string RegionStats(OSHttpResponse httpResponse, Scene scene)
{
int users = scene.GetAvatars().Count;
int users = scene.GetRootAgentCount();
int objects = scene.Entities.Count - users;
RestXmlWriter rxw = new RestXmlWriter(new StringWriter());

View File

@ -125,7 +125,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Regions
rxw.WriteString(s.RegionInfo.InternalEndPoint.ToString());
rxw.WriteEndAttribute();
int users = s.GetAvatars().Count;
int users = s.GetRootAgentCount();
rxw.WriteStartAttribute(String.Empty, "avatars", String.Empty);
rxw.WriteValue(users);
rxw.WriteEndAttribute();

View File

@ -4338,6 +4338,14 @@ namespace OpenSim.Region.Framework.Scenes
return m_sceneGraph.GetAvatars();
}
/// <summary>
/// Cheaply return the number of avatars in a region (without fetching a list object)
/// </summary>
public int GetRootAgentCount()
{
return m_sceneGraph.GetRootAgentCount();
}
/// <summary>
/// Return a list of all ScenePresences in this region. This returns child agents as well as root agents.
/// This list is a new object, so it can be iterated over without locking.

View File

@ -5266,7 +5266,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_Integer llGetRegionAgentCount()
{
m_host.AddScriptLPS(1);
return new LSL_Integer(World.GetAvatars().Count);
return new LSL_Integer(World.GetRootAgentCount());
}
public LSL_Vector llGetRegionCorner()