Stop individually deleting objects at the end of each ObjectTortureTest.

We can now do this since the entire scene and all objects within it are now successfully gc'd at the end of these tests.
This greatly improves the time taken to run each test (by reducing teardown time, not the time to actually do the test work that we're interested in).
Slightly simplifies config read in Scene constructor to help facilitate this.
0.7.3-extended
Justin Clark-Casey (justincc) 2012-03-07 00:31:18 +00:00
parent 6fa3dffad2
commit 756d1f917f
5 changed files with 36 additions and 35 deletions

View File

@ -670,10 +670,10 @@ namespace OpenSim.Region.Framework.Scenes
#region Region Config #region Region Config
try // Region config overrides global config
//
if (m_config.Configs["Startup"] != null)
{ {
// Region config overrides global config
//
IConfig startupConfig = m_config.Configs["Startup"]; IConfig startupConfig = m_config.Configs["Startup"];
m_defaultDrawDistance = startupConfig.GetFloat("DefaultDrawDistance",m_defaultDrawDistance); m_defaultDrawDistance = startupConfig.GetFloat("DefaultDrawDistance",m_defaultDrawDistance);
@ -765,40 +765,33 @@ namespace OpenSim.Region.Framework.Scenes
SendPeriodicAppearanceUpdates = startupConfig.GetBoolean("SendPeriodicAppearanceUpdates", SendPeriodicAppearanceUpdates); SendPeriodicAppearanceUpdates = startupConfig.GetBoolean("SendPeriodicAppearanceUpdates", SendPeriodicAppearanceUpdates);
} }
catch
{
m_log.Warn("[SCENE]: Failed to load StartupConfig");
}
#endregion Region Config #endregion Region Config
#region Interest Management #region Interest Management
if (m_config != null) IConfig interestConfig = m_config.Configs["InterestManagement"];
if (interestConfig != null)
{ {
IConfig interestConfig = m_config.Configs["InterestManagement"]; string update_prioritization_scheme = interestConfig.GetString("UpdatePrioritizationScheme", "Time").Trim().ToLower();
if (interestConfig != null)
try
{ {
string update_prioritization_scheme = interestConfig.GetString("UpdatePrioritizationScheme", "Time").Trim().ToLower(); m_priorityScheme = (UpdatePrioritizationSchemes)Enum.Parse(typeof(UpdatePrioritizationSchemes), update_prioritization_scheme, true);
try
{
m_priorityScheme = (UpdatePrioritizationSchemes)Enum.Parse(typeof(UpdatePrioritizationSchemes), update_prioritization_scheme, true);
}
catch (Exception)
{
m_log.Warn("[PRIORITIZER]: UpdatePrioritizationScheme was not recognized, setting to default prioritizer Time");
m_priorityScheme = UpdatePrioritizationSchemes.Time;
}
m_reprioritizationEnabled = interestConfig.GetBoolean("ReprioritizationEnabled", true);
m_reprioritizationInterval = interestConfig.GetDouble("ReprioritizationInterval", 5000.0);
m_rootReprioritizationDistance = interestConfig.GetDouble("RootReprioritizationDistance", 10.0);
m_childReprioritizationDistance = interestConfig.GetDouble("ChildReprioritizationDistance", 20.0);
} }
catch (Exception)
{
m_log.Warn("[PRIORITIZER]: UpdatePrioritizationScheme was not recognized, setting to default prioritizer Time");
m_priorityScheme = UpdatePrioritizationSchemes.Time;
}
m_reprioritizationEnabled = interestConfig.GetBoolean("ReprioritizationEnabled", true);
m_reprioritizationInterval = interestConfig.GetDouble("ReprioritizationInterval", 5000.0);
m_rootReprioritizationDistance = interestConfig.GetDouble("RootReprioritizationDistance", 10.0);
m_childReprioritizationDistance = interestConfig.GetDouble("ChildReprioritizationDistance", 20.0);
} }
m_log.InfoFormat("[SCENE]: Using the {0} prioritization scheme", m_priorityScheme); m_log.DebugFormat("[SCENE]: Using the {0} prioritization scheme", m_priorityScheme);
#endregion Interest Management #endregion Interest Management

View File

@ -75,6 +75,10 @@ namespace OpenSim.Tests.Torture
[TestFixtureTearDown] [TestFixtureTearDown]
public void TearDown() public void TearDown()
{ {
scene.Close();
GC.Collect();
GC.WaitForPendingFinalizers();
// We must set this back afterwards, otherwise later tests will fail since they're expecting multiple // We must set this back afterwards, otherwise later tests will fail since they're expecting multiple
// threads. Possibly, later tests should be rewritten not to worry about such things. // threads. Possibly, later tests should be rewritten not to worry about such things.
Util.FireAndForgetMethod = Util.DefaultFireAndForgetMethod; Util.FireAndForgetMethod = Util.DefaultFireAndForgetMethod;

View File

@ -156,11 +156,6 @@ namespace OpenSim.Tests.Torture
// objects will be clean up by the garbage collector before the next stress test is run. // objects will be clean up by the garbage collector before the next stress test is run.
scene.Update(1); scene.Update(1);
// Currently, we need to do this in order to garbage collect the scene objects ready for the next test run.
// However, what we really need to do is find out why the entire scene is not garbage collected in
// teardown.
scene.DeleteAllSceneObjects();
Console.WriteLine( Console.WriteLine(
"Took {0}ms, {1}MB ({2} - {3}) to create {4} objects each containing {5} prim(s)", "Took {0}ms, {1}MB ({2} - {3}) to create {4} objects each containing {5} prim(s)",
Math.Round(elapsed.TotalMilliseconds), Math.Round(elapsed.TotalMilliseconds),
@ -170,7 +165,8 @@ namespace OpenSim.Tests.Torture
objectsToAdd, objectsToAdd,
primsInEachObject); primsInEachObject);
scene = null; scene.Close();
// scene = null;
} }
} }
} }

View File

@ -91,6 +91,14 @@ namespace OpenSim.Tests.Torture
m_scene.StartScripts(); m_scene.StartScripts();
} }
[TearDown]
public void TearDown()
{
m_scene.Close();
GC.Collect();
GC.WaitForPendingFinalizers();
}
[Test] [Test]
public void TestCompileAndStart100Scripts() public void TestCompileAndStart100Scripts()
{ {