Move experimental attachments throttling further down the chain so that multiple attachments changes (e.g. change outfit) are also throttled

TeleportWork
Justin Clark-Casey (justincc) 2013-08-02 00:00:00 +01:00
parent 7a5d11f8a7
commit c9695a0a59
2 changed files with 17 additions and 18 deletions

View File

@ -53,8 +53,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
public int DebugLevel { get; set; } public int DebugLevel { get; set; }
/// <summary> /// <summary>
/// Period to sleep per 100 prims in order to avoid CPU spikes when an avatar with many attachments logs in /// Period to sleep per 100 prims in order to avoid CPU spikes when an avatar with many attachments logs in/changes
/// or many avatars with a medium levels of attachments login simultaneously. /// outfit or many avatars with a medium levels of attachments login/change outfit simultaneously.
/// </summary> /// </summary>
/// <remarks> /// <remarks>
/// A value of 0 will apply no pause. The pause is specified in milliseconds. /// A value of 0 will apply no pause. The pause is specified in milliseconds.
@ -319,19 +319,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
SceneObjectGroup objatt SceneObjectGroup objatt
= RezSingleAttachmentFromInventoryInternal( = RezSingleAttachmentFromInventoryInternal(
sp, sp.PresenceType == PresenceType.Npc ? UUID.Zero : attach.ItemID, attach.AssetID, attachmentPt, true); sp, sp.PresenceType == PresenceType.Npc ? UUID.Zero : attach.ItemID, attach.AssetID, attachmentPt, true);
if (ThrottlePer100PrimsRezzed > 0)
{
int throttleMs = (int)Math.Round((float)objatt.PrimCount / 100 * ThrottlePer100PrimsRezzed);
if (DebugLevel > 0)
m_log.DebugFormat(
"[ATTACHMENTS MODULE]: Throttling by {0}ms after rez of {1} with {2} prims for attachment to {3} on point {4} in {5}",
throttleMs, objatt.Name, objatt.PrimCount, sp.Name, attachmentPt, m_scene.Name);
Thread.Sleep(throttleMs);
}
} }
catch (Exception e) catch (Exception e)
{ {
@ -1025,6 +1012,18 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
if (tainted) if (tainted)
objatt.HasGroupChanged = true; objatt.HasGroupChanged = true;
if (ThrottlePer100PrimsRezzed > 0)
{
int throttleMs = (int)Math.Round((float)objatt.PrimCount / 100 * ThrottlePer100PrimsRezzed);
if (DebugLevel > 0)
m_log.DebugFormat(
"[ATTACHMENTS MODULE]: Throttling by {0}ms after rez of {1} with {2} prims for attachment to {3} on point {4} in {5}",
throttleMs, objatt.Name, objatt.PrimCount, sp.Name, attachmentPt, m_scene.Name);
Thread.Sleep(throttleMs);
}
return objatt; return objatt;
} }

View File

@ -710,8 +710,8 @@
Enabled = true Enabled = true
; Controls the number of milliseconds that are slept per 100 prims rezzed in attachments ; Controls the number of milliseconds that are slept per 100 prims rezzed in attachments
; Experimental setting to control CPU spiking when avatars with many attachments login ; Experimental setting to control CPU spiking when avatars with many attachments login/change outfit
; or when multiple avatars with medium level attachments login simultaneously. ; or when multiple avatars with medium level attachments login/change outfit simultaneously.
; If 0 then no throttling is performed. ; If 0 then no throttling is performed.
ThrottlePer100PrimsRezzed = 0; ThrottlePer100PrimsRezzed = 0;