diff options
Diffstat (limited to 'OpenSim/Region/Framework')
3 files changed, 62 insertions, 16 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs b/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs index 33041e9..ad421ee 100644 --- a/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs +++ b/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs | |||
@@ -87,7 +87,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
87 | { | 87 | { |
88 | if (m_defaultAnimation.AnimID == animID) | 88 | if (m_defaultAnimation.AnimID == animID) |
89 | { | 89 | { |
90 | ResetDefaultAnimation(); | 90 | m_defaultAnimation = new OpenSim.Framework.Animation(UUID.Zero, 1, UUID.Zero); |
91 | } | 91 | } |
92 | else if (HasAnimation(animID)) | 92 | else if (HasAnimation(animID)) |
93 | { | 93 | { |
@@ -149,19 +149,26 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
149 | { | 149 | { |
150 | lock (m_animations) | 150 | lock (m_animations) |
151 | { | 151 | { |
152 | animIDs = new UUID[m_animations.Count + 1]; | 152 | int defaultSize = 0; |
153 | sequenceNums = new int[m_animations.Count + 1]; | 153 | if (m_defaultAnimation.AnimID != UUID.Zero) |
154 | objectIDs = new UUID[m_animations.Count + 1]; | 154 | defaultSize++; |
155 | 155 | ||
156 | animIDs[0] = m_defaultAnimation.AnimID; | 156 | animIDs = new UUID[m_animations.Count + defaultSize]; |
157 | sequenceNums[0] = m_defaultAnimation.SequenceNum; | 157 | sequenceNums = new int[m_animations.Count + defaultSize]; |
158 | objectIDs[0] = m_defaultAnimation.ObjectID; | 158 | objectIDs = new UUID[m_animations.Count + defaultSize]; |
159 | |||
160 | if (m_defaultAnimation.AnimID != UUID.Zero) | ||
161 | { | ||
162 | animIDs[0] = m_defaultAnimation.AnimID; | ||
163 | sequenceNums[0] = m_defaultAnimation.SequenceNum; | ||
164 | objectIDs[0] = m_defaultAnimation.ObjectID; | ||
165 | } | ||
159 | 166 | ||
160 | for (int i = 0; i < m_animations.Count; ++i) | 167 | for (int i = 0; i < m_animations.Count; ++i) |
161 | { | 168 | { |
162 | animIDs[i + 1] = m_animations[i].AnimID; | 169 | animIDs[i + defaultSize] = m_animations[i].AnimID; |
163 | sequenceNums[i + 1] = m_animations[i].SequenceNum; | 170 | sequenceNums[i + defaultSize] = m_animations[i].SequenceNum; |
164 | objectIDs[i + 1] = m_animations[i].ObjectID; | 171 | objectIDs[i + defaultSize] = m_animations[i].ObjectID; |
165 | } | 172 | } |
166 | } | 173 | } |
167 | } | 174 | } |
diff --git a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs index 50a176b..9458079 100644 --- a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs +++ b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs | |||
@@ -424,13 +424,19 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
424 | { | 424 | { |
425 | lock (m_animations) | 425 | lock (m_animations) |
426 | { | 426 | { |
427 | CurrentMovementAnimation = DetermineMovementAnimation(); | 427 | string newMovementAnimation = DetermineMovementAnimation(); |
428 | if (CurrentMovementAnimation != newMovementAnimation) | ||
429 | { | ||
430 | CurrentMovementAnimation = DetermineMovementAnimation(); | ||
428 | 431 | ||
429 | // m_log.DebugFormat( | 432 | // m_log.DebugFormat( |
430 | // "[SCENE PRESENCE ANIMATOR]: Determined animation {0} for {1} in UpdateMovementAnimations()", | 433 | // "[SCENE PRESENCE ANIMATOR]: Determined animation {0} for {1} in UpdateMovementAnimations()", |
431 | // CurrentMovementAnimation, m_scenePresence.Name); | 434 | // CurrentMovementAnimation, m_scenePresence.Name); |
432 | 435 | ||
433 | TrySetMovementAnimation(CurrentMovementAnimation); | 436 | // Only set it if it's actually changed, give a script |
437 | // a chance to stop a default animation | ||
438 | TrySetMovementAnimation(CurrentMovementAnimation); | ||
439 | } | ||
434 | } | 440 | } |
435 | } | 441 | } |
436 | 442 | ||
@@ -552,4 +558,4 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
552 | SendAnimPack(animIDs, sequenceNums, objectIDs); | 558 | SendAnimPack(animIDs, sequenceNums, objectIDs); |
553 | } | 559 | } |
554 | } | 560 | } |
555 | } \ No newline at end of file | 561 | } |
diff --git a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs index 756b1f4..0d359b9 100644 --- a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs +++ b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs | |||
@@ -47,6 +47,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
47 | = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | 47 | = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); |
48 | 48 | ||
49 | public const string LastReportedObjectUpdateStatName = "LastReportedObjectUpdates"; | 49 | public const string LastReportedObjectUpdateStatName = "LastReportedObjectUpdates"; |
50 | public const string SlowFramesStatName = "SlowFrames"; | ||
50 | 51 | ||
51 | public delegate void SendStatResult(SimStats stats); | 52 | public delegate void SendStatResult(SimStats stats); |
52 | 53 | ||
@@ -129,6 +130,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
129 | } | 130 | } |
130 | 131 | ||
131 | /// <summary> | 132 | /// <summary> |
133 | /// Number of frames that have taken longer to process than Scene.MIN_FRAME_TIME | ||
134 | /// </summary> | ||
135 | public Stat SlowFramesStat { get; private set; } | ||
136 | |||
137 | /// <summary> | ||
138 | /// The threshold at which we log a slow frame. | ||
139 | /// </summary> | ||
140 | public int SlowFramesStatReportThreshold { get; private set; } | ||
141 | |||
142 | /// <summary> | ||
132 | /// Extra sim statistics that are used by monitors but not sent to the client. | 143 | /// Extra sim statistics that are used by monitors but not sent to the client. |
133 | /// </summary> | 144 | /// </summary> |
134 | /// <value> | 145 | /// <value> |
@@ -226,6 +237,22 @@ namespace OpenSim.Region.Framework.Scenes | |||
226 | 237 | ||
227 | if (StatsManager.SimExtraStats != null) | 238 | if (StatsManager.SimExtraStats != null) |
228 | OnSendStatsResult += StatsManager.SimExtraStats.ReceiveClassicSimStatsPacket; | 239 | OnSendStatsResult += StatsManager.SimExtraStats.ReceiveClassicSimStatsPacket; |
240 | |||
241 | /// At the moment, we'll only report if a frame is over 120% of target, since commonly frames are a bit | ||
242 | /// longer than ideal (which in itself is a concern). | ||
243 | SlowFramesStatReportThreshold = (int)Math.Ceiling(m_scene.MinFrameTime * 1000 * 1.2); | ||
244 | |||
245 | SlowFramesStat | ||
246 | = new Stat( | ||
247 | "SlowFrames", | ||
248 | "Slow Frames", | ||
249 | " frames", | ||
250 | "scene", | ||
251 | m_scene.Name, | ||
252 | StatVerbosity.Info, | ||
253 | "Number of frames where frame time has been significantly longer than the desired frame time."); | ||
254 | |||
255 | StatsManager.RegisterStat(SlowFramesStat); | ||
229 | } | 256 | } |
230 | 257 | ||
231 | public void Close() | 258 | public void Close() |
@@ -443,6 +470,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
443 | lock (m_lastReportedExtraSimStats) | 470 | lock (m_lastReportedExtraSimStats) |
444 | { | 471 | { |
445 | m_lastReportedExtraSimStats[LastReportedObjectUpdateStatName] = m_objectUpdates / m_statsUpdateFactor; | 472 | m_lastReportedExtraSimStats[LastReportedObjectUpdateStatName] = m_objectUpdates / m_statsUpdateFactor; |
473 | m_lastReportedExtraSimStats[SlowFramesStat.ShortName] = (float)SlowFramesStat.Value; | ||
446 | 474 | ||
447 | Dictionary<string, float> physicsStats = m_scene.PhysicsScene.GetStats(); | 475 | Dictionary<string, float> physicsStats = m_scene.PhysicsScene.GetStats(); |
448 | 476 | ||
@@ -563,6 +591,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
563 | public void addFrameMS(int ms) | 591 | public void addFrameMS(int ms) |
564 | { | 592 | { |
565 | m_frameMS += ms; | 593 | m_frameMS += ms; |
594 | |||
595 | // At the moment, we'll only report if a frame is over 120% of target, since commonly frames are a bit | ||
596 | // longer than ideal due to the inaccuracy of the Sleep in Scene.Update() (which in itself is a concern). | ||
597 | if (ms > SlowFramesStatReportThreshold) | ||
598 | SlowFramesStat.Value++; | ||
566 | } | 599 | } |
567 | 600 | ||
568 | public void addNetMS(int ms) | 601 | public void addNetMS(int ms) |