diff options
author | Teravus Ovares | 2008-01-16 03:33:46 +0000 |
---|---|---|
committer | Teravus Ovares | 2008-01-16 03:33:46 +0000 |
commit | 5958192398bcb48fa5ec4dfd2b2485f798e525a6 (patch) | |
tree | f52479b2229827289f247aa6f725315994e0a6bb | |
parent | * Refactored the SimStatsReporter to reuse the same packet and packet blocks ... (diff) | |
download | opensim-SC-5958192398bcb48fa5ec4dfd2b2485f798e525a6.zip opensim-SC-5958192398bcb48fa5ec4dfd2b2485f798e525a6.tar.gz opensim-SC-5958192398bcb48fa5ec4dfd2b2485f798e525a6.tar.bz2 opensim-SC-5958192398bcb48fa5ec4dfd2b2485f798e525a6.tar.xz |
* Added Packets In/s, Packets Out/s and Current un_acked Packets to the SimStatsReporter
* This doesn't take into account the throttler, it just assumes the throttle limit isn't reached.
-rw-r--r-- | OpenSim/Framework/IClientAPI.cs | 3 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/ClientView.cs | 30 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.cs | 8 | ||||
-rw-r--r-- | OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs | 1 |
4 files changed, 42 insertions, 0 deletions
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 039526b..046688f 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs | |||
@@ -398,6 +398,8 @@ namespace OpenSim.Framework | |||
398 | public delegate void FriendActionDelegate(IClientAPI remoteClient,LLUUID agentID,LLUUID transactionID,List<LLUUID> callingCardFolders); | 398 | public delegate void FriendActionDelegate(IClientAPI remoteClient,LLUUID agentID,LLUUID transactionID,List<LLUUID> callingCardFolders); |
399 | 399 | ||
400 | public delegate void FriendshipTermination(IClientAPI remoteClient,LLUUID agentID, LLUUID ExID); | 400 | public delegate void FriendshipTermination(IClientAPI remoteClient,LLUUID agentID, LLUUID ExID); |
401 | |||
402 | public delegate void PacketStats(int inPackets, int outPackets, int unAckedBytes); | ||
401 | 403 | ||
402 | 404 | ||
403 | 405 | ||
@@ -501,6 +503,7 @@ namespace OpenSim.Framework | |||
501 | event FriendActionDelegate OnApproveFriendRequest; | 503 | event FriendActionDelegate OnApproveFriendRequest; |
502 | event FriendActionDelegate OnDenyFriendRequest; | 504 | event FriendActionDelegate OnDenyFriendRequest; |
503 | event FriendshipTermination OnTerminateFriendship; | 505 | event FriendshipTermination OnTerminateFriendship; |
506 | event PacketStats OnPacketStats; | ||
504 | 507 | ||
505 | 508 | ||
506 | LLVector3 StartPos { get; set; } | 509 | LLVector3 StartPos { get; set; } |
diff --git a/OpenSim/Region/ClientStack/ClientView.cs b/OpenSim/Region/ClientStack/ClientView.cs index d3a8254..c1f4126 100644 --- a/OpenSim/Region/ClientStack/ClientView.cs +++ b/OpenSim/Region/ClientStack/ClientView.cs | |||
@@ -63,7 +63,14 @@ namespace OpenSim.Region.ClientStack | |||
63 | // private InventoryCache m_inventoryCache; | 63 | // private InventoryCache m_inventoryCache; |
64 | private int m_cachedTextureSerial = 0; | 64 | private int m_cachedTextureSerial = 0; |
65 | private Timer m_clientPingTimer; | 65 | private Timer m_clientPingTimer; |
66 | |||
66 | private int m_packetsReceived = 0; | 67 | private int m_packetsReceived = 0; |
68 | private int m_lastpacketsSentToScene = 0; | ||
69 | private int m_unAckedBytes = 0; | ||
70 | |||
71 | private int m_packetsSent = 0; | ||
72 | private int m_lastPacketsSent = 0; | ||
73 | |||
67 | private int m_probesWithNoIngressPackets = 0; | 74 | private int m_probesWithNoIngressPackets = 0; |
68 | private int m_lastPacketsReceived = 0; | 75 | private int m_lastPacketsReceived = 0; |
69 | private byte[] ZeroOutBuffer = new byte[4096]; | 76 | private byte[] ZeroOutBuffer = new byte[4096]; |
@@ -409,6 +416,7 @@ namespace OpenSim.Region.ClientStack | |||
409 | { | 416 | { |
410 | // this will normally trigger at least one packet (ping response) | 417 | // this will normally trigger at least one packet (ping response) |
411 | SendStartPingCheck(0); | 418 | SendStartPingCheck(0); |
419 | |||
412 | } | 420 | } |
413 | } | 421 | } |
414 | else | 422 | else |
@@ -416,6 +424,7 @@ namespace OpenSim.Region.ClientStack | |||
416 | // Something received in the meantime - we can reset the counters | 424 | // Something received in the meantime - we can reset the counters |
417 | m_probesWithNoIngressPackets = 0; | 425 | m_probesWithNoIngressPackets = 0; |
418 | m_lastPacketsReceived = m_packetsReceived; | 426 | m_lastPacketsReceived = m_packetsReceived; |
427 | |||
419 | } | 428 | } |
420 | } | 429 | } |
421 | 430 | ||
@@ -566,6 +575,9 @@ namespace OpenSim.Region.ClientStack | |||
566 | public event FriendActionDelegate OnDenyFriendRequest; | 575 | public event FriendActionDelegate OnDenyFriendRequest; |
567 | public event FriendshipTermination OnTerminateFriendship; | 576 | public event FriendshipTermination OnTerminateFriendship; |
568 | 577 | ||
578 | public event PacketStats OnPacketStats; | ||
579 | |||
580 | |||
569 | #region Scene/Avatar to Client | 581 | #region Scene/Avatar to Client |
570 | 582 | ||
571 | /// <summary> | 583 | /// <summary> |
@@ -2245,6 +2257,7 @@ namespace OpenSim.Region.ClientStack | |||
2245 | try | 2257 | try |
2246 | { | 2258 | { |
2247 | m_needAck.Add(Pack.Header.Sequence, Pack); | 2259 | m_needAck.Add(Pack.Header.Sequence, Pack); |
2260 | m_unAckedBytes += Pack.ToBytes().Length; | ||
2248 | } | 2261 | } |
2249 | catch (Exception) // HACKY | 2262 | catch (Exception) // HACKY |
2250 | { | 2263 | { |
@@ -2298,6 +2311,7 @@ namespace OpenSim.Region.ClientStack | |||
2298 | if (Pack.Header.Reliable) //DIRTY HACK | 2311 | if (Pack.Header.Reliable) //DIRTY HACK |
2299 | { | 2312 | { |
2300 | AddAck(Pack); // this adds the need to ack this packet later | 2313 | AddAck(Pack); // this adds the need to ack this packet later |
2314 | |||
2301 | 2315 | ||
2302 | if (Pack.Type != PacketType.PacketAck && Pack.Type != PacketType.LogoutRequest) | 2316 | if (Pack.Type != PacketType.PacketAck && Pack.Type != PacketType.LogoutRequest) |
2303 | { | 2317 | { |
@@ -2343,6 +2357,7 @@ namespace OpenSim.Region.ClientStack | |||
2343 | { | 2357 | { |
2344 | foreach (uint ack in NewPack.Header.AckList) | 2358 | foreach (uint ack in NewPack.Header.AckList) |
2345 | { | 2359 | { |
2360 | m_unAckedBytes -= m_needAck[ack].ToBytes().Length; | ||
2346 | m_needAck.Remove(ack); | 2361 | m_needAck.Remove(ack); |
2347 | } | 2362 | } |
2348 | } | 2363 | } |
@@ -2358,6 +2373,7 @@ namespace OpenSim.Region.ClientStack | |||
2358 | { | 2373 | { |
2359 | foreach (PacketAckPacket.PacketsBlock block in ackPacket.Packets) | 2374 | foreach (PacketAckPacket.PacketsBlock block in ackPacket.Packets) |
2360 | { | 2375 | { |
2376 | m_unAckedBytes -= m_needAck[block.ID].ToBytes().Length; | ||
2361 | m_needAck.Remove(block.ID); | 2377 | m_needAck.Remove(block.ID); |
2362 | } | 2378 | } |
2363 | } | 2379 | } |
@@ -2387,6 +2403,7 @@ namespace OpenSim.Region.ClientStack | |||
2387 | item.Incoming = false; | 2403 | item.Incoming = false; |
2388 | item.throttleType = throttlePacketType; // Packet throttle type | 2404 | item.throttleType = throttlePacketType; // Packet throttle type |
2389 | m_packetQueue.Enqueue(item); | 2405 | m_packetQueue.Enqueue(item); |
2406 | m_packetsSent++; | ||
2390 | } | 2407 | } |
2391 | 2408 | ||
2392 | # region Low Level Packet Methods | 2409 | # region Low Level Packet Methods |
@@ -2472,8 +2489,21 @@ namespace OpenSim.Region.ClientStack | |||
2472 | 2489 | ||
2473 | protected void AckTimer_Elapsed(object sender, ElapsedEventArgs ea) | 2490 | protected void AckTimer_Elapsed(object sender, ElapsedEventArgs ea) |
2474 | { | 2491 | { |
2492 | |||
2475 | SendAcks(); | 2493 | SendAcks(); |
2476 | ResendUnacked(); | 2494 | ResendUnacked(); |
2495 | SendPacketStats(); | ||
2496 | |||
2497 | } | ||
2498 | |||
2499 | protected void SendPacketStats() | ||
2500 | { | ||
2501 | if (OnPacketStats != null) | ||
2502 | { | ||
2503 | OnPacketStats(m_packetsReceived - m_lastPacketsReceived, m_packetsSent - m_lastPacketsSent, m_unAckedBytes); | ||
2504 | m_lastPacketsReceived = m_packetsReceived; | ||
2505 | m_lastPacketsSent = m_packetsSent; | ||
2506 | } | ||
2477 | } | 2507 | } |
2478 | 2508 | ||
2479 | #endregion | 2509 | #endregion |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 9af43f5..16055de 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs | |||
@@ -1228,6 +1228,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1228 | 1228 | ||
1229 | client.OnGrabObject += ProcessObjectGrab; | 1229 | client.OnGrabObject += ProcessObjectGrab; |
1230 | client.OnAvatarPickerRequest += ProcessAvatarPickerRequest; | 1230 | client.OnAvatarPickerRequest += ProcessAvatarPickerRequest; |
1231 | client.OnPacketStats += AddPacketStats; | ||
1231 | 1232 | ||
1232 | EventManager.TriggerOnNewClient(client); | 1233 | EventManager.TriggerOnNewClient(client); |
1233 | } | 1234 | } |
@@ -1759,6 +1760,13 @@ namespace OpenSim.Region.Environment.Scenes | |||
1759 | return CommsManager.GetUserFriendList(ownerID); | 1760 | return CommsManager.GetUserFriendList(ownerID); |
1760 | } | 1761 | } |
1761 | 1762 | ||
1763 | public void AddPacketStats(int inPackets, int outPackets, int unAckedBytes) | ||
1764 | { | ||
1765 | m_statsReporter.AddInPackets(inPackets); | ||
1766 | m_statsReporter.AddOutPackets(outPackets); | ||
1767 | m_statsReporter.AddunAckedBytes(unAckedBytes); | ||
1768 | } | ||
1769 | |||
1762 | #endregion | 1770 | #endregion |
1763 | 1771 | ||
1764 | #region Console Commands | 1772 | #region Console Commands |
diff --git a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs index 809a13b..ecc2df4 100644 --- a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs +++ b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs | |||
@@ -142,6 +142,7 @@ namespace SimpleApp | |||
142 | public event FriendActionDelegate OnApproveFriendRequest; | 142 | public event FriendActionDelegate OnApproveFriendRequest; |
143 | public event FriendActionDelegate OnDenyFriendRequest; | 143 | public event FriendActionDelegate OnDenyFriendRequest; |
144 | public event FriendshipTermination OnTerminateFriendship; | 144 | public event FriendshipTermination OnTerminateFriendship; |
145 | public event PacketStats OnPacketStats; | ||
145 | 146 | ||
146 | #pragma warning restore 67 | 147 | #pragma warning restore 67 |
147 | 148 | ||