Merge branch 'master' of ssh://justincc@opensimulator.org/var/git/opensim

This commit is contained in:
Justin Clark-Casey (justincc)
2009-11-09 17:36:28 +00:00
37 changed files with 385 additions and 138 deletions

View File

@@ -54,6 +54,7 @@ namespace OpenSim.Region.Framework.Interfaces
bool IsBannedFromLand(UUID avatar);
bool IsRestrictedFromLand(UUID avatar);
void SendLandUpdateToClient(IClientAPI remote_client);
void SendLandUpdateToClient(bool snap_selection, IClientAPI remote_client);
List<UUID> CreateAccessListArrayByFlag(AccessList flag);
void SendAccessList(UUID agentID, UUID sessionID, uint flags, int sequenceID, IClientAPI remote_client);
void UpdateAccessList(uint flags, List<ParcelManager.ParcelAccessEntry> entries, IClientAPI remote_client);

View File

@@ -118,7 +118,7 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid
// HGAssetService dispatches it to the remote grid.
// It's not pretty, but the best that can be done while
// not having a global naming infrastructure
AssetBase asset1 = new AssetBase();
AssetBase asset1 = new AssetBase(asset.FullID, asset.Name, asset.Type);
Copy(asset, asset1);
try
{

View File

@@ -626,11 +626,8 @@ namespace OpenSim.Region.Framework.Scenes
/// <returns></returns>
private AssetBase CreateAsset(string name, string description, sbyte assetType, byte[] data)
{
AssetBase asset = new AssetBase();
asset.Name = name;
AssetBase asset = new AssetBase(UUID.Random(), name, assetType);
asset.Description = description;
asset.Type = assetType;
asset.FullID = UUID.Random();
asset.Data = (data == null) ? new byte[1] : data;
return asset;

View File

@@ -36,6 +36,7 @@ using System.Timers;
using System.Xml;
using Nini.Config;
using OpenMetaverse;
using OpenMetaverse.Packets;
using OpenMetaverse.Imaging;
using OpenSim.Framework;
using OpenSim.Services.Interfaces;
@@ -397,6 +398,73 @@ namespace OpenSim.Region.Framework.Scenes
#endregion
#region BinaryStats
public class StatLogger
{
public DateTime StartTime;
public string Path;
public System.IO.BinaryWriter Log;
}
static StatLogger m_statLog = null;
static TimeSpan m_statLogPeriod = TimeSpan.FromSeconds(300);
static string m_statsDir = String.Empty;
static Object m_statLockObject = new Object();
private void LogSimStats(SimStats stats)
{
SimStatsPacket pack = new SimStatsPacket();
pack.Region = new SimStatsPacket.RegionBlock();
pack.Region.RegionX = stats.RegionX;
pack.Region.RegionY = stats.RegionY;
pack.Region.RegionFlags = stats.RegionFlags;
pack.Region.ObjectCapacity = stats.ObjectCapacity;
//pack.Region = //stats.RegionBlock;
pack.Stat = stats.StatsBlock;
pack.Header.Reliable = false;
// note that we are inside the reporter lock when called
DateTime now = DateTime.Now;
// hide some time information into the packet
pack.Header.Sequence = (uint)now.Ticks;
lock (m_statLockObject) // m_statLog is shared so make sure there is only executer here
{
try
{
if (m_statLog == null || now > m_statLog.StartTime + m_statLogPeriod)
{
// First log file or time has expired, start writing to a new log file
if (m_statLog != null && m_statLog.Log != null)
{
m_statLog.Log.Close();
}
m_statLog = new StatLogger();
m_statLog.StartTime = now;
m_statLog.Path = (m_statsDir.Length > 0 ? m_statsDir + System.IO.Path.DirectorySeparatorChar.ToString() : "")
+ String.Format("stats-{0}.log", now.ToString("yyyyMMddHHmmss"));
m_statLog.Log = new BinaryWriter(File.Open(m_statLog.Path, FileMode.Append, FileAccess.Write));
}
// Write the serialized data to disk
if (m_statLog != null && m_statLog.Log != null)
m_statLog.Log.Write(pack.ToBytes());
}
catch (Exception ex)
{
m_log.Error("statistics gathering failed: " + ex.Message, ex);
if (m_statLog != null && m_statLog.Log != null)
{
m_statLog.Log.Close();
}
m_statLog = null;
}
}
return;
}
#endregion
#region Constructors
public Scene(RegionInfo regInfo, AgentCircuitManager authen,
@@ -582,6 +650,38 @@ namespace OpenSim.Region.Framework.Scenes
}
m_log.Info("[SCENE]: Using the " + m_update_prioritization_scheme + " prioritization scheme");
#region BinaryStats
try
{
IConfig statConfig = m_config.Configs["Statistics.Binary"];
if (statConfig.Contains("enabled") && statConfig.GetBoolean("enabled"))
{
if (statConfig.Contains("collect_region_stats"))
{
if (statConfig.GetBoolean("collect_region_stats"))
{
// if enabled, add us to the event. If not enabled, I won't get called
StatsReporter.OnSendStatsResult += LogSimStats;
}
}
if (statConfig.Contains("region_stats_period_seconds"))
{
m_statLogPeriod = TimeSpan.FromSeconds(statConfig.GetInt("region_stats_period_seconds"));
}
if (statConfig.Contains("stats_dir"))
{
m_statsDir = statConfig.GetString("stats_dir");
}
}
}
catch
{
// if it doesn't work, we don't collect anything
}
#endregion BinaryStats
}
catch
{

View File

@@ -1918,14 +1918,10 @@ namespace OpenSim.Region.Framework.Scenes
}
AssetBase Animasset = new AssetBase();
AssetBase Animasset = new AssetBase(UUID.Random(), "Random Animation", (sbyte)AssetType.Animation);
Animasset.Data = anim.ToBytes();
Animasset.Temporary = true;
Animasset.Local = true;
Animasset.FullID = UUID.Random();
Animasset.ID = Animasset.FullID.ToString();
Animasset.Name = "Random Animation";
Animasset.Type = (sbyte)AssetType.Animation;
Animasset.Description = "dance";
//BinBVHAnimation bbvhanim = new BinBVHAnimation(Animasset.Data);