aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2009-11-09 17:36:28 +0000
committerJustin Clark-Casey (justincc)2009-11-09 17:36:28 +0000
commit7f5d0a6735585d47e081cb0b717de46d5e23260d (patch)
treed463176be6e07c4bb6948f428958fe7452866758 /OpenSim/Region/Framework/Scenes
parentrefactor out iar escaping (diff)
parentremove the debug stuff (diff)
downloadopensim-SC_OLD-7f5d0a6735585d47e081cb0b717de46d5e23260d.zip
opensim-SC_OLD-7f5d0a6735585d47e081cb0b717de46d5e23260d.tar.gz
opensim-SC_OLD-7f5d0a6735585d47e081cb0b717de46d5e23260d.tar.bz2
opensim-SC_OLD-7f5d0a6735585d47e081cb0b717de46d5e23260d.tar.xz
Merge branch 'master' of ssh://justincc@opensimulator.org/var/git/opensim
Diffstat (limited to 'OpenSim/Region/Framework/Scenes')
-rw-r--r--OpenSim/Region/Framework/Scenes/Hypergrid/HGAssetMapper.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs5
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs100
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs6
4 files changed, 103 insertions, 10 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Hypergrid/HGAssetMapper.cs b/OpenSim/Region/Framework/Scenes/Hypergrid/HGAssetMapper.cs
index 7a66d23..ec50598 100644
--- a/OpenSim/Region/Framework/Scenes/Hypergrid/HGAssetMapper.cs
+++ b/OpenSim/Region/Framework/Scenes/Hypergrid/HGAssetMapper.cs
@@ -118,7 +118,7 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid
118 // HGAssetService dispatches it to the remote grid. 118 // HGAssetService dispatches it to the remote grid.
119 // It's not pretty, but the best that can be done while 119 // It's not pretty, but the best that can be done while
120 // not having a global naming infrastructure 120 // not having a global naming infrastructure
121 AssetBase asset1 = new AssetBase(); 121 AssetBase asset1 = new AssetBase(asset.FullID, asset.Name, asset.Type);
122 Copy(asset, asset1); 122 Copy(asset, asset1);
123 try 123 try
124 { 124 {
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index c689aba..d790041 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -626,11 +626,8 @@ namespace OpenSim.Region.Framework.Scenes
626 /// <returns></returns> 626 /// <returns></returns>
627 private AssetBase CreateAsset(string name, string description, sbyte assetType, byte[] data) 627 private AssetBase CreateAsset(string name, string description, sbyte assetType, byte[] data)
628 { 628 {
629 AssetBase asset = new AssetBase(); 629 AssetBase asset = new AssetBase(UUID.Random(), name, assetType);
630 asset.Name = name;
631 asset.Description = description; 630 asset.Description = description;
632 asset.Type = assetType;
633 asset.FullID = UUID.Random();
634 asset.Data = (data == null) ? new byte[1] : data; 631 asset.Data = (data == null) ? new byte[1] : data;
635 632
636 return asset; 633 return asset;
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 093ca3e..6edef11 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -36,6 +36,7 @@ using System.Timers;
36using System.Xml; 36using System.Xml;
37using Nini.Config; 37using Nini.Config;
38using OpenMetaverse; 38using OpenMetaverse;
39using OpenMetaverse.Packets;
39using OpenMetaverse.Imaging; 40using OpenMetaverse.Imaging;
40using OpenSim.Framework; 41using OpenSim.Framework;
41using OpenSim.Services.Interfaces; 42using OpenSim.Services.Interfaces;
@@ -397,6 +398,73 @@ namespace OpenSim.Region.Framework.Scenes
397 398
398 #endregion 399 #endregion
399 400
401 #region BinaryStats
402
403 public class StatLogger
404 {
405 public DateTime StartTime;
406 public string Path;
407 public System.IO.BinaryWriter Log;
408 }
409 static StatLogger m_statLog = null;
410 static TimeSpan m_statLogPeriod = TimeSpan.FromSeconds(300);
411 static string m_statsDir = String.Empty;
412 static Object m_statLockObject = new Object();
413 private void LogSimStats(SimStats stats)
414 {
415 SimStatsPacket pack = new SimStatsPacket();
416 pack.Region = new SimStatsPacket.RegionBlock();
417 pack.Region.RegionX = stats.RegionX;
418 pack.Region.RegionY = stats.RegionY;
419 pack.Region.RegionFlags = stats.RegionFlags;
420 pack.Region.ObjectCapacity = stats.ObjectCapacity;
421 //pack.Region = //stats.RegionBlock;
422 pack.Stat = stats.StatsBlock;
423 pack.Header.Reliable = false;
424
425 // note that we are inside the reporter lock when called
426 DateTime now = DateTime.Now;
427
428 // hide some time information into the packet
429 pack.Header.Sequence = (uint)now.Ticks;
430
431 lock (m_statLockObject) // m_statLog is shared so make sure there is only executer here
432 {
433 try
434 {
435 if (m_statLog == null || now > m_statLog.StartTime + m_statLogPeriod)
436 {
437 // First log file or time has expired, start writing to a new log file
438 if (m_statLog != null && m_statLog.Log != null)
439 {
440 m_statLog.Log.Close();
441 }
442 m_statLog = new StatLogger();
443 m_statLog.StartTime = now;
444 m_statLog.Path = (m_statsDir.Length > 0 ? m_statsDir + System.IO.Path.DirectorySeparatorChar.ToString() : "")
445 + String.Format("stats-{0}.log", now.ToString("yyyyMMddHHmmss"));
446 m_statLog.Log = new BinaryWriter(File.Open(m_statLog.Path, FileMode.Append, FileAccess.Write));
447 }
448
449 // Write the serialized data to disk
450 if (m_statLog != null && m_statLog.Log != null)
451 m_statLog.Log.Write(pack.ToBytes());
452 }
453 catch (Exception ex)
454 {
455 m_log.Error("statistics gathering failed: " + ex.Message, ex);
456 if (m_statLog != null && m_statLog.Log != null)
457 {
458 m_statLog.Log.Close();
459 }
460 m_statLog = null;
461 }
462 }
463 return;
464 }
465
466 #endregion
467
400 #region Constructors 468 #region Constructors
401 469
402 public Scene(RegionInfo regInfo, AgentCircuitManager authen, 470 public Scene(RegionInfo regInfo, AgentCircuitManager authen,
@@ -582,6 +650,38 @@ namespace OpenSim.Region.Framework.Scenes
582 } 650 }
583 651
584 m_log.Info("[SCENE]: Using the " + m_update_prioritization_scheme + " prioritization scheme"); 652 m_log.Info("[SCENE]: Using the " + m_update_prioritization_scheme + " prioritization scheme");
653
654 #region BinaryStats
655
656 try
657 {
658 IConfig statConfig = m_config.Configs["Statistics.Binary"];
659 if (statConfig.Contains("enabled") && statConfig.GetBoolean("enabled"))
660 {
661 if (statConfig.Contains("collect_region_stats"))
662 {
663 if (statConfig.GetBoolean("collect_region_stats"))
664 {
665 // if enabled, add us to the event. If not enabled, I won't get called
666 StatsReporter.OnSendStatsResult += LogSimStats;
667 }
668 }
669 if (statConfig.Contains("region_stats_period_seconds"))
670 {
671 m_statLogPeriod = TimeSpan.FromSeconds(statConfig.GetInt("region_stats_period_seconds"));
672 }
673 if (statConfig.Contains("stats_dir"))
674 {
675 m_statsDir = statConfig.GetString("stats_dir");
676 }
677 }
678 }
679 catch
680 {
681 // if it doesn't work, we don't collect anything
682 }
683
684 #endregion BinaryStats
585 } 685 }
586 catch 686 catch
587 { 687 {
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 1e9201e..17026e5 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -1918,14 +1918,10 @@ namespace OpenSim.Region.Framework.Scenes
1918 } 1918 }
1919 1919
1920 1920
1921 AssetBase Animasset = new AssetBase(); 1921 AssetBase Animasset = new AssetBase(UUID.Random(), "Random Animation", (sbyte)AssetType.Animation);
1922 Animasset.Data = anim.ToBytes(); 1922 Animasset.Data = anim.ToBytes();
1923 Animasset.Temporary = true; 1923 Animasset.Temporary = true;
1924 Animasset.Local = true; 1924 Animasset.Local = true;
1925 Animasset.FullID = UUID.Random();
1926 Animasset.ID = Animasset.FullID.ToString();
1927 Animasset.Name = "Random Animation";
1928 Animasset.Type = (sbyte)AssetType.Animation;
1929 Animasset.Description = "dance"; 1925 Animasset.Description = "dance";
1930 //BinBVHAnimation bbvhanim = new BinBVHAnimation(Animasset.Data); 1926 //BinBVHAnimation bbvhanim = new BinBVHAnimation(Animasset.Data);
1931 1927