diff options
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | 53 | ||||
-rw-r--r-- | bin/OpenSimDefaults.ini | 6 |
2 files changed, 2 insertions, 57 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index e175db4..6861272 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | |||
@@ -54,15 +54,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
54 | 54 | ||
55 | public int DebugLevel { get; set; } | 55 | public int DebugLevel { get; set; } |
56 | 56 | ||
57 | /// <summary> | ||
58 | /// Period to sleep per 100 prims in order to avoid CPU spikes when an avatar with many attachments logs in/changes | ||
59 | /// outfit or many avatars with a medium levels of attachments login/change outfit simultaneously. | ||
60 | /// </summary> | ||
61 | /// <remarks> | ||
62 | /// A value of 0 will apply no pause. The pause is specified in milliseconds. | ||
63 | /// </remarks> | ||
64 | public int ThrottlePer100PrimsRezzed { get; set; } | ||
65 | |||
66 | private Scene m_scene; | 57 | private Scene m_scene; |
67 | private IInventoryAccessModule m_invAccessModule; | 58 | private IInventoryAccessModule m_invAccessModule; |
68 | 59 | ||
@@ -80,8 +71,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
80 | if (config != null) | 71 | if (config != null) |
81 | { | 72 | { |
82 | Enabled = config.GetBoolean("Enabled", true); | 73 | Enabled = config.GetBoolean("Enabled", true); |
83 | |||
84 | ThrottlePer100PrimsRezzed = config.GetInt("ThrottlePer100PrimsRezzed", 0); | ||
85 | } | 74 | } |
86 | else | 75 | else |
87 | { | 76 | { |
@@ -115,17 +104,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
115 | MainConsole.Instance.Commands.AddCommand( | 104 | MainConsole.Instance.Commands.AddCommand( |
116 | "Debug", | 105 | "Debug", |
117 | false, | 106 | false, |
118 | "debug attachments throttle", | ||
119 | "debug attachments throttle <ms>", | ||
120 | "Turn on attachments throttling.", | ||
121 | "This requires a millisecond value. " + | ||
122 | " == 0 - disable throttling.\n" | ||
123 | + " > 0 - sleeps for this number of milliseconds per 100 prims rezzed.", | ||
124 | HandleDebugAttachmentsThrottle); | ||
125 | |||
126 | MainConsole.Instance.Commands.AddCommand( | ||
127 | "Debug", | ||
128 | false, | ||
129 | "debug attachments status", | 107 | "debug attachments status", |
130 | "debug attachments status", | 108 | "debug attachments status", |
131 | "Show current attachments debug status", | 109 | "Show current attachments debug status", |
@@ -151,27 +129,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
151 | } | 129 | } |
152 | } | 130 | } |
153 | 131 | ||
154 | private void HandleDebugAttachmentsThrottle(string module, string[] args) | ||
155 | { | ||
156 | int ms; | ||
157 | |||
158 | if (args.Length == 4 && int.TryParse(args[3], out ms)) | ||
159 | { | ||
160 | ThrottlePer100PrimsRezzed = ms; | ||
161 | MainConsole.Instance.OutputFormat( | ||
162 | "Attachments rez throttle per 100 prims is now {0} in {1}", ThrottlePer100PrimsRezzed, m_scene.Name); | ||
163 | |||
164 | return; | ||
165 | } | ||
166 | |||
167 | MainConsole.Instance.OutputFormat("Usage: debug attachments throttle <ms>"); | ||
168 | } | ||
169 | |||
170 | private void HandleDebugAttachmentsStatus(string module, string[] args) | 132 | private void HandleDebugAttachmentsStatus(string module, string[] args) |
171 | { | 133 | { |
172 | MainConsole.Instance.OutputFormat("Settings for {0}", m_scene.Name); | 134 | MainConsole.Instance.OutputFormat("Settings for {0}", m_scene.Name); |
173 | MainConsole.Instance.OutputFormat("Debug logging level: {0}", DebugLevel); | 135 | MainConsole.Instance.OutputFormat("Debug logging level: {0}", DebugLevel); |
174 | MainConsole.Instance.OutputFormat("Throttle per 100 prims: {0}ms", ThrottlePer100PrimsRezzed); | ||
175 | } | 136 | } |
176 | 137 | ||
177 | /// <summary> | 138 | /// <summary> |
@@ -211,6 +172,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
211 | public void RegionLoaded(Scene scene) | 172 | public void RegionLoaded(Scene scene) |
212 | { | 173 | { |
213 | m_invAccessModule = m_scene.RequestModuleInterface<IInventoryAccessModule>(); | 174 | m_invAccessModule = m_scene.RequestModuleInterface<IInventoryAccessModule>(); |
175 | if (!Enabled) | ||
176 | return; | ||
214 | } | 177 | } |
215 | 178 | ||
216 | public void Close() | 179 | public void Close() |
@@ -1213,18 +1176,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
1213 | if (tainted) | 1176 | if (tainted) |
1214 | objatt.HasGroupChanged = true; | 1177 | objatt.HasGroupChanged = true; |
1215 | 1178 | ||
1216 | if (ThrottlePer100PrimsRezzed > 0) | ||
1217 | { | ||
1218 | int throttleMs = (int)Math.Round((float)objatt.PrimCount / 100 * ThrottlePer100PrimsRezzed); | ||
1219 | |||
1220 | if (DebugLevel > 0) | ||
1221 | m_log.DebugFormat( | ||
1222 | "[ATTACHMENTS MODULE]: Throttling by {0}ms after rez of {1} with {2} prims for attachment to {3} on point {4} in {5}", | ||
1223 | throttleMs, objatt.Name, objatt.PrimCount, sp.Name, attachmentPt, m_scene.Name); | ||
1224 | |||
1225 | Thread.Sleep(throttleMs); | ||
1226 | } | ||
1227 | |||
1228 | return objatt; | 1179 | return objatt; |
1229 | } | 1180 | } |
1230 | 1181 | ||
diff --git a/bin/OpenSimDefaults.ini b/bin/OpenSimDefaults.ini index e821c1a..6429faf 100644 --- a/bin/OpenSimDefaults.ini +++ b/bin/OpenSimDefaults.ini | |||
@@ -947,12 +947,6 @@ | |||
947 | ; Defaults to true - only set to false for debugging purposes | 947 | ; Defaults to true - only set to false for debugging purposes |
948 | Enabled = true | 948 | Enabled = true |
949 | 949 | ||
950 | ; Controls the number of milliseconds that are slept per 100 prims rezzed in attachments | ||
951 | ; Experimental setting to control CPU spiking when avatars with many attachments login/change outfit | ||
952 | ; or when multiple avatars with medium level attachments login/change outfit simultaneously. | ||
953 | ; If 0 then no throttling is performed. | ||
954 | ThrottlePer100PrimsRezzed = 0 | ||
955 | |||
956 | 950 | ||
957 | [Mesh] | 951 | [Mesh] |
958 | ; enable / disable mesh asset uploads | 952 | ; enable / disable mesh asset uploads |