diff options
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneGraph.cs | 6 | ||||
-rw-r--r-- | OpenSim/Tests/Torture/ObjectTortureTests.cs | 126 |
3 files changed, 134 insertions, 0 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 984058c..975d769 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -1943,6 +1943,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1943 | /// If true, the object is made persistent into the scene. | 1943 | /// If true, the object is made persistent into the scene. |
1944 | /// If false, the object will not persist over server restarts | 1944 | /// If false, the object will not persist over server restarts |
1945 | /// </param> | 1945 | /// </param> |
1946 | /// <returns>true if the object was added. false if not</returns> | ||
1946 | public bool AddNewSceneObject(SceneObjectGroup sceneObject, bool attachToBackup) | 1947 | public bool AddNewSceneObject(SceneObjectGroup sceneObject, bool attachToBackup) |
1947 | { | 1948 | { |
1948 | return AddNewSceneObject(sceneObject, attachToBackup, true); | 1949 | return AddNewSceneObject(sceneObject, attachToBackup, true); |
@@ -1960,6 +1961,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1960 | /// If true, updates for the new scene object are sent to all viewers in range. | 1961 | /// If true, updates for the new scene object are sent to all viewers in range. |
1961 | /// If false, it is left to the caller to schedule the update | 1962 | /// If false, it is left to the caller to schedule the update |
1962 | /// </param> | 1963 | /// </param> |
1964 | /// <returns>true if the object was added. false if not</returns> | ||
1963 | public bool AddNewSceneObject(SceneObjectGroup sceneObject, bool attachToBackup, bool sendClientUpdates) | 1965 | public bool AddNewSceneObject(SceneObjectGroup sceneObject, bool attachToBackup, bool sendClientUpdates) |
1964 | { | 1966 | { |
1965 | if (m_sceneGraph.AddNewSceneObject(sceneObject, attachToBackup, sendClientUpdates)) | 1967 | if (m_sceneGraph.AddNewSceneObject(sceneObject, attachToBackup, sendClientUpdates)) |
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 36a454e..006f9c6 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs | |||
@@ -357,7 +357,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
357 | return false; | 357 | return false; |
358 | 358 | ||
359 | if (Entities.ContainsKey(sceneObject.UUID)) | 359 | if (Entities.ContainsKey(sceneObject.UUID)) |
360 | { | ||
361 | // m_log.DebugFormat( | ||
362 | // "[SCENEGRAPH]: Scene graph for {0} already contains object {1} in AddSceneObject()", | ||
363 | // m_parentScene.RegionInfo.RegionName, sceneObject.UUID); | ||
364 | |||
360 | return false; | 365 | return false; |
366 | } | ||
361 | 367 | ||
362 | // m_log.DebugFormat( | 368 | // m_log.DebugFormat( |
363 | // "[SCENEGRAPH]: Adding scene object {0} {1}, with {2} parts on {3}", | 369 | // "[SCENEGRAPH]: Adding scene object {0} {1}, with {2} parts on {3}", |
diff --git a/OpenSim/Tests/Torture/ObjectTortureTests.cs b/OpenSim/Tests/Torture/ObjectTortureTests.cs new file mode 100644 index 0000000..cdbaa66 --- /dev/null +++ b/OpenSim/Tests/Torture/ObjectTortureTests.cs | |||
@@ -0,0 +1,126 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Diagnostics; | ||
30 | using System.Reflection; | ||
31 | using log4net; | ||
32 | using NUnit.Framework; | ||
33 | using OpenMetaverse; | ||
34 | using OpenSim.Framework; | ||
35 | using OpenSim.Region.Framework.Scenes; | ||
36 | using OpenSim.Tests.Common; | ||
37 | using OpenSim.Tests.Common.Mock; | ||
38 | |||
39 | namespace OpenSim.Tests.Torture | ||
40 | { | ||
41 | /// <summary> | ||
42 | /// Object torture tests | ||
43 | /// </summary> | ||
44 | /// <remarks> | ||
45 | /// Don't rely on the numbers given by these tests - they will vary a lot depending on what is already cached, | ||
46 | /// how much memory is free, etc. In some cases, later larger tests will apparently take less time than smaller | ||
47 | /// earlier tests. | ||
48 | /// </remarks> | ||
49 | [TestFixture] | ||
50 | public class ObjectTortureTests | ||
51 | { | ||
52 | // [Test] | ||
53 | // public void Test0000Clean() | ||
54 | // { | ||
55 | // TestHelpers.InMethod(); | ||
56 | //// log4net.Config.XmlConfigurator.Configure(); | ||
57 | // | ||
58 | // TestAddObjects(200000); | ||
59 | // } | ||
60 | |||
61 | [Test] | ||
62 | public void Test0001TenThousandObjects() | ||
63 | { | ||
64 | TestHelpers.InMethod(); | ||
65 | // log4net.Config.XmlConfigurator.Configure(); | ||
66 | |||
67 | TestAddObjects(10000); | ||
68 | } | ||
69 | |||
70 | [Test] | ||
71 | public void Test0002OneHundredThousandObjects() | ||
72 | { | ||
73 | TestHelpers.InMethod(); | ||
74 | // log4net.Config.XmlConfigurator.Configure(); | ||
75 | |||
76 | TestAddObjects(100000); | ||
77 | } | ||
78 | |||
79 | [Test] | ||
80 | public void Test0003TwoHundredThousandObjects() | ||
81 | { | ||
82 | TestHelpers.InMethod(); | ||
83 | // log4net.Config.XmlConfigurator.Configure(); | ||
84 | |||
85 | TestAddObjects(200000); | ||
86 | } | ||
87 | |||
88 | private void TestAddObjects(int objectsToAdd) | ||
89 | { | ||
90 | UUID ownerId = new UUID("F0000000-0000-0000-0000-000000000000"); | ||
91 | |||
92 | TestScene scene = SceneHelpers.SetupScene(); | ||
93 | |||
94 | Process process = Process.GetCurrentProcess(); | ||
95 | // long startProcessMemory = process.PrivateMemorySize64; | ||
96 | long startGcMemory = GC.GetTotalMemory(true); | ||
97 | DateTime start = DateTime.Now; | ||
98 | |||
99 | for (int i = 1; i <= objectsToAdd; i++) | ||
100 | { | ||
101 | SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, ownerId, "part_", i); | ||
102 | Assert.That(scene.AddNewSceneObject(so, false), Is.True, string.Format("Object {0} was not created", i)); | ||
103 | } | ||
104 | |||
105 | TimeSpan elapsed = DateTime.Now - start; | ||
106 | // long processMemoryAlloc = process.PrivateMemorySize64 - startProcessMemory; | ||
107 | long processGcAlloc = GC.GetTotalMemory(false) - startGcMemory; | ||
108 | |||
109 | for (int i = 1; i <= objectsToAdd; i++) | ||
110 | { | ||
111 | Assert.That( | ||
112 | scene.GetSceneObjectGroup(TestHelpers.ParseTail(i)), | ||
113 | Is.Not.Null, | ||
114 | string.Format("Object {0} could not be retrieved", i)); | ||
115 | } | ||
116 | |||
117 | // Console.WriteLine( | ||
118 | // "Took {0}ms, {1}MB to create {2} single prim scene objects", | ||
119 | // elapsed.Milliseconds, processGcAlloc / 1024 / 1024, objectsToAdd); | ||
120 | |||
121 | Console.WriteLine( | ||
122 | "Took {0}MB to create {1} single prim scene objects", | ||
123 | processGcAlloc / 1024 / 1024, objectsToAdd); | ||
124 | } | ||
125 | } | ||
126 | } \ No newline at end of file | ||