mirror of
https://github.com/opensim/opensim.git
synced 2026-08-08 02:05:34 +08:00
Merge branch 'master' of ssh://justincc@opensimulator.org/var/git/opensim
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user