More converstion in progress
Signed-off-by: AMZN-Olex <5432499+AMZN-Olex@users.noreply.github.com>
This commit is contained in:
@@ -105,14 +105,15 @@ namespace Multiplayer
|
||||
template <typename TYPE>
|
||||
inline void SerializeNetworkPropertyHelper
|
||||
(
|
||||
AzNetworking::ISerializer& serializer,
|
||||
bool modifyRecord,
|
||||
AzNetworking::FixedSizeBitsetView& bitset,
|
||||
int32_t bitIndex,
|
||||
TYPE& value,
|
||||
const char* name,
|
||||
NetComponentId componentId,
|
||||
PropertyIndex propertyIndex,
|
||||
AzNetworking::ISerializer& serializer,
|
||||
bool modifyRecord,
|
||||
AzNetworking::FixedSizeBitsetView& bitset,
|
||||
int32_t bitIndex,
|
||||
TYPE& value,
|
||||
const char* name,
|
||||
AZ::EntityId entityId,
|
||||
NetComponentId componentId,
|
||||
PropertyIndex propertyIndex,
|
||||
MultiplayerStats& stats
|
||||
)
|
||||
{
|
||||
@@ -133,11 +134,11 @@ namespace Multiplayer
|
||||
{
|
||||
if (modifyRecord)
|
||||
{
|
||||
stats.RecordPropertyReceived(componentId, propertyIndex, updateSize);
|
||||
stats.RecordPropertyReceived(entityId, componentId, propertyIndex, updateSize);
|
||||
}
|
||||
else
|
||||
{
|
||||
stats.RecordPropertySent(componentId, propertyIndex, updateSize);
|
||||
stats.RecordPropertySent(entityId, componentId, propertyIndex, updateSize);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,6 +50,8 @@ namespace Multiplayer
|
||||
AZStd::vector<ComponentStats> m_componentStats;
|
||||
|
||||
void ReserveComponentStats(NetComponentId netComponentId, uint16_t propertyCount, uint16_t rpcCount);
|
||||
void RecordEntitySerializeStart(AZ::EntityId entityId, const char* entityName);
|
||||
void RecordEntitySerializeStop(AZ::EntityId entityId, const char* entityName);
|
||||
void RecordPropertySent(NetComponentId netComponentId, PropertyIndex propertyId, uint32_t totalBytes);
|
||||
void RecordPropertyReceived(NetComponentId netComponentId, PropertyIndex propertyId, uint32_t totalBytes);
|
||||
void RecordRpcSent(NetComponentId netComponentId, RpcIndex rpcId, uint32_t totalBytes);
|
||||
|
||||
@@ -447,12 +447,16 @@ namespace Multiplayer
|
||||
|
||||
bool NetBindComponent::SerializeStateDeltaMessage(ReplicationRecord& replicationRecord, AzNetworking::ISerializer& serializer)
|
||||
{
|
||||
GetMultiplayer()->GetStats().RecordEntitySerializeStart(GetEntityId(), GetEntity()->GetName().c_str());
|
||||
|
||||
bool success = true;
|
||||
for (auto iter = m_multiplayerSerializationComponentVector.begin(); iter != m_multiplayerSerializationComponentVector.end(); ++iter)
|
||||
{
|
||||
success &= (*iter)->SerializeStateDeltaMessage(replicationRecord, serializer);
|
||||
}
|
||||
|
||||
GetMultiplayer()->GetStats().RecordEntitySerializeStop(GetEntityId(), GetEntity()->GetName().c_str());
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,14 +1,11 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "MultiplayerDebugByteReporter.h"
|
||||
|
||||
#include <iomanip>
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/Component/EntityId.h>
|
||||
#include <Multiplayer/MultiplayerTypes.h>
|
||||
|
||||
namespace MultiplayerDiagnostics
|
||||
{
|
||||
class MultilayerIPerEntityStats
|
||||
{
|
||||
public:
|
||||
virtual ~MultilayerIPerEntityStats();
|
||||
|
||||
virtual void RecordEntitySerializeStart(AZ::EntityId entityId, const char* entityName) = 0;
|
||||
virtual void RecordEntitySerializeStop(AZ::EntityId entityId, const char* entityName) = 0;
|
||||
virtual void RecordPropertySent(Multiplayer::NetComponentId netComponentId, Multiplayer::PropertyIndex propertyId, uint32_t totalBytes);
|
||||
virtual void RecordPropertyReceived(Multiplayer::NetComponentId netComponentId, Multiplayer::PropertyIndex propertyId, uint32_t totalBytes);
|
||||
};
|
||||
}
|
||||
@@ -1,18 +1,16 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "MultiplayerDebugPerEntityReporter.h"
|
||||
#include <GridMate/Replica/ReplicaChunk.h>
|
||||
#include <GridMate/Replica/ReplicaChunkDescriptor.h>
|
||||
#include <GridMate/Replica/RemoteProcedureCall.h>
|
||||
#include <Multiplayer/IMultiplayer.h>
|
||||
|
||||
#if defined(IMGUI_ENABLED)
|
||||
#include <imgui/imgui.h>
|
||||
@@ -115,151 +113,151 @@ namespace MultiplayerDiagnostics
|
||||
|
||||
MultiplayerDebugPerEntityReporter::MultiplayerDebugPerEntityReporter ()
|
||||
{
|
||||
GridMate::Debug::CarrierDrillerBus::Handler::BusConnect();
|
||||
//GridMate::Debug::CarrierDrillerBus::Handler::BusConnect();
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------------------------
|
||||
MultiplayerDebugPerEntityReporter::~MultiplayerDebugPerEntityReporter()
|
||||
{
|
||||
GridMate::Debug::ReplicaDrillerBus::Handler::BusDisconnect();
|
||||
GridMate::Debug::CarrierDrillerBus::Handler::BusDisconnect();
|
||||
/*GridMate::Debug::ReplicaDrillerBus::Handler::BusDisconnect();
|
||||
GridMate::Debug::CarrierDrillerBus::Handler::BusDisconnect();*/
|
||||
}
|
||||
|
||||
void MultiplayerDebugPerEntityReporter::OnReceiveReplicaBegin(GridMate::Replica*, const void*, size_t)
|
||||
{
|
||||
m_currentReceivingEntityReport.Reset();
|
||||
}
|
||||
//void MultiplayerDebugPerEntityReporter::OnReceiveReplicaBegin(GridMate::Replica*, const void*, size_t)
|
||||
//{
|
||||
// m_currentReceivingEntityReport.Reset();
|
||||
//}
|
||||
|
||||
void MultiplayerDebugPerEntityReporter::OnReceiveReplicaEnd(GridMate::Replica* replica)
|
||||
{
|
||||
m_receivingEntityReports[replica->GetDebugName()].Combine(m_currentReceivingEntityReport);
|
||||
}
|
||||
//void MultiplayerDebugPerEntityReporter::OnReceiveReplicaEnd(GridMate::Replica* replica)
|
||||
//{
|
||||
// m_receivingEntityReports[replica->GetDebugName()].Combine(m_currentReceivingEntityReport);
|
||||
//}
|
||||
|
||||
void MultiplayerDebugPerEntityReporter::OnReceiveReplicaChunkEnd(GridMate::ReplicaChunkBase* chunk, AZ::u32 chunkIndex)
|
||||
{
|
||||
AZ_UNUSED(chunk);
|
||||
AZ_UNUSED(chunkIndex);
|
||||
m_currentReceivingEntityReport.ReportFragmentEnd();
|
||||
}
|
||||
//void MultiplayerDebugPerEntityReporter::OnReceiveReplicaChunkEnd(GridMate::ReplicaChunkBase* chunk, AZ::u32 chunkIndex)
|
||||
//{
|
||||
// AZ_UNUSED(chunk);
|
||||
// AZ_UNUSED(chunkIndex);
|
||||
// m_currentReceivingEntityReport.ReportFragmentEnd();
|
||||
//}
|
||||
|
||||
void MultiplayerDebugPerEntityReporter::OnReceiveDataSet(GridMate::ReplicaChunkBase* chunk, AZ::u32 chunkIndex,
|
||||
GridMate::DataSetBase* dataSet, GridMate::PeerId, GridMate::PeerId, const void*, size_t len)
|
||||
{
|
||||
m_currentReceivingEntityReport.ReportField(chunkIndex, chunk->GetDescriptor()->GetChunkName(), chunk->GetDescriptor()->GetDataSetName(chunk, dataSet), len);
|
||||
}
|
||||
//void MultiplayerDebugPerEntityReporter::OnReceiveDataSet(GridMate::ReplicaChunkBase* chunk, AZ::u32 chunkIndex,
|
||||
// GridMate::DataSetBase* dataSet, GridMate::PeerId, GridMate::PeerId, const void*, size_t len)
|
||||
//{
|
||||
// m_currentReceivingEntityReport.ReportField(chunkIndex, chunk->GetDescriptor()->GetChunkName(), chunk->GetDescriptor()->GetDataSetName(chunk, dataSet), len);
|
||||
//}
|
||||
|
||||
void MultiplayerDebugPerEntityReporter::OnReceiveRpc (GridMate::ReplicaChunkBase* chunk,
|
||||
AZ::u32 chunkIndex,
|
||||
GridMate::Internal::RpcRequest* rpc,
|
||||
GridMate::PeerId from,
|
||||
GridMate::PeerId to,
|
||||
const void* data,
|
||||
size_t len)
|
||||
{
|
||||
AZ_UNUSED( from );
|
||||
AZ_UNUSED( to );
|
||||
AZ_UNUSED( data );
|
||||
//void MultiplayerDebugPerEntityReporter::OnReceiveRpc (GridMate::ReplicaChunkBase* chunk,
|
||||
// AZ::u32 chunkIndex,
|
||||
// GridMate::Internal::RpcRequest* rpc,
|
||||
// GridMate::PeerId from,
|
||||
// GridMate::PeerId to,
|
||||
// const void* data,
|
||||
// size_t len)
|
||||
//{
|
||||
// AZ_UNUSED( from );
|
||||
// AZ_UNUSED( to );
|
||||
// AZ_UNUSED( data );
|
||||
|
||||
m_currentReceivingEntityReport.ReportField(chunkIndex, chunk->GetDescriptor()->GetChunkName(), chunk->GetDescriptor()->GetRpcName(chunk, rpc->m_rpc), len);
|
||||
}
|
||||
// m_currentReceivingEntityReport.ReportField(chunkIndex, chunk->GetDescriptor()->GetChunkName(), chunk->GetDescriptor()->GetRpcName(chunk, rpc->m_rpc), len);
|
||||
//}
|
||||
|
||||
void MultiplayerDebugPerEntityReporter::OnSendReplicaBegin (GridMate::Replica*)
|
||||
{
|
||||
m_currentSendingEntityReport.Reset();
|
||||
}
|
||||
//void MultiplayerDebugPerEntityReporter::OnSendReplicaBegin (GridMate::Replica*)
|
||||
//{
|
||||
// m_currentSendingEntityReport.Reset();
|
||||
//}
|
||||
|
||||
void MultiplayerDebugPerEntityReporter::OnSendReplicaEnd (GridMate::Replica* replica, const void*, size_t)
|
||||
{
|
||||
m_sendingEntityReports[replica->GetDebugName()].Combine(m_currentSendingEntityReport);
|
||||
}
|
||||
//void MultiplayerDebugPerEntityReporter::OnSendReplicaEnd (GridMate::Replica* replica, const void*, size_t)
|
||||
//{
|
||||
// m_sendingEntityReports[replica->GetDebugName()].Combine(m_currentSendingEntityReport);
|
||||
//}
|
||||
|
||||
void MultiplayerDebugPerEntityReporter::OnSendReplicaChunkEnd (GridMate::ReplicaChunkBase* chunk,
|
||||
AZ::u32 chunkIndex,
|
||||
const void*,
|
||||
size_t)
|
||||
{
|
||||
AZ_UNUSED(chunk);
|
||||
AZ_UNUSED(chunkIndex);
|
||||
m_currentSendingEntityReport.ReportFragmentEnd();
|
||||
}
|
||||
//void MultiplayerDebugPerEntityReporter::OnSendReplicaChunkEnd (GridMate::ReplicaChunkBase* chunk,
|
||||
// AZ::u32 chunkIndex,
|
||||
// const void*,
|
||||
// size_t)
|
||||
//{
|
||||
// AZ_UNUSED(chunk);
|
||||
// AZ_UNUSED(chunkIndex);
|
||||
// m_currentSendingEntityReport.ReportFragmentEnd();
|
||||
//}
|
||||
|
||||
void MultiplayerDebugPerEntityReporter::OnSendDataSet (GridMate::ReplicaChunkBase* chunk,
|
||||
AZ::u32 chunkIndex,
|
||||
GridMate::DataSetBase* dataSet,
|
||||
GridMate::PeerId,
|
||||
GridMate::PeerId,
|
||||
const void*,
|
||||
size_t len)
|
||||
{
|
||||
m_currentSendingEntityReport.ReportField(chunkIndex, chunk->GetDescriptor()->GetChunkName(), chunk->GetDescriptor()->GetDataSetName(chunk, dataSet), len);
|
||||
}
|
||||
//void MultiplayerDebugPerEntityReporter::OnSendDataSet (GridMate::ReplicaChunkBase* chunk,
|
||||
// AZ::u32 chunkIndex,
|
||||
// GridMate::DataSetBase* dataSet,
|
||||
// GridMate::PeerId,
|
||||
// GridMate::PeerId,
|
||||
// const void*,
|
||||
// size_t len)
|
||||
//{
|
||||
// m_currentSendingEntityReport.ReportField(chunkIndex, chunk->GetDescriptor()->GetChunkName(), chunk->GetDescriptor()->GetDataSetName(chunk, dataSet), len);
|
||||
//}
|
||||
|
||||
void MultiplayerDebugPerEntityReporter::OnSendRpc (GridMate::ReplicaChunkBase* chunk,
|
||||
AZ::u32 chunkIndex,
|
||||
GridMate::Internal::RpcRequest* rpc,
|
||||
GridMate::PeerId,
|
||||
GridMate::PeerId,
|
||||
const void*,
|
||||
size_t len)
|
||||
{
|
||||
m_currentSendingEntityReport.ReportField(chunkIndex, chunk->GetDescriptor()->GetChunkName(), chunk->GetDescriptor()->GetRpcName(chunk, rpc->m_rpc), len);
|
||||
}
|
||||
//void MultiplayerDebugPerEntityReporter::OnSendRpc (GridMate::ReplicaChunkBase* chunk,
|
||||
// AZ::u32 chunkIndex,
|
||||
// GridMate::Internal::RpcRequest* rpc,
|
||||
// GridMate::PeerId,
|
||||
// GridMate::PeerId,
|
||||
// const void*,
|
||||
// size_t len)
|
||||
//{
|
||||
// m_currentSendingEntityReport.ReportField(chunkIndex, chunk->GetDescriptor()->GetChunkName(), chunk->GetDescriptor()->GetRpcName(chunk, rpc->m_rpc), len);
|
||||
//}
|
||||
|
||||
void MultiplayerDebugPerEntityReporter::OnIncomingConnection (GridMate::Carrier*, GridMate::ConnectionID)
|
||||
{
|
||||
}
|
||||
//void MultiplayerDebugPerEntityReporter::OnIncomingConnection (GridMate::Carrier*, GridMate::ConnectionID)
|
||||
//{
|
||||
//}
|
||||
|
||||
void MultiplayerDebugPerEntityReporter::OnFailedToConnect (GridMate::Carrier*,
|
||||
GridMate::ConnectionID,
|
||||
GridMate::CarrierDisconnectReason)
|
||||
{
|
||||
m_lastSecondStats.clear();
|
||||
}
|
||||
//void MultiplayerDebugPerEntityReporter::OnFailedToConnect (GridMate::Carrier*,
|
||||
// GridMate::ConnectionID,
|
||||
// GridMate::CarrierDisconnectReason)
|
||||
//{
|
||||
// m_lastSecondStats.clear();
|
||||
//}
|
||||
|
||||
void MultiplayerDebugPerEntityReporter::OnConnectionEstablished (GridMate::Carrier*, GridMate::ConnectionID)
|
||||
{
|
||||
}
|
||||
//void MultiplayerDebugPerEntityReporter::OnConnectionEstablished (GridMate::Carrier*, GridMate::ConnectionID)
|
||||
//{
|
||||
//}
|
||||
|
||||
void MultiplayerDebugPerEntityReporter::OnDisconnect (GridMate::Carrier*,
|
||||
GridMate::ConnectionID,
|
||||
GridMate::CarrierDisconnectReason)
|
||||
{
|
||||
/*
|
||||
* CarrierDrillerBus doesn't provide enough information to correctly keep track of network traffic for all peers.
|
||||
* This is a work around until that is fixed to at least not over report the bandwidth amount.
|
||||
*/
|
||||
m_lastSecondStats.clear();
|
||||
}
|
||||
//void MultiplayerDebugPerEntityReporter::OnDisconnect (GridMate::Carrier*,
|
||||
// GridMate::ConnectionID,
|
||||
// GridMate::CarrierDisconnectReason)
|
||||
//{
|
||||
// /*
|
||||
// * CarrierDrillerBus doesn't provide enough information to correctly keep track of network traffic for all peers.
|
||||
// * This is a work around until that is fixed to at least not over report the bandwidth amount.
|
||||
// */
|
||||
// m_lastSecondStats.clear();
|
||||
//}
|
||||
|
||||
void MultiplayerDebugPerEntityReporter::OnDriverError (GridMate::Carrier*,
|
||||
GridMate::ConnectionID,
|
||||
const GridMate::DriverError&)
|
||||
{
|
||||
m_lastSecondStats.clear();
|
||||
}
|
||||
//void MultiplayerDebugPerEntityReporter::OnDriverError (GridMate::Carrier*,
|
||||
// GridMate::ConnectionID,
|
||||
// const GridMate::DriverError&)
|
||||
//{
|
||||
// m_lastSecondStats.clear();
|
||||
//}
|
||||
|
||||
void MultiplayerDebugPerEntityReporter::OnSecurityError (GridMate::Carrier*,
|
||||
GridMate::ConnectionID,
|
||||
const GridMate::SecurityError&)
|
||||
{
|
||||
m_lastSecondStats.clear();
|
||||
}
|
||||
//void MultiplayerDebugPerEntityReporter::OnSecurityError (GridMate::Carrier*,
|
||||
// GridMate::ConnectionID,
|
||||
// const GridMate::SecurityError&)
|
||||
//{
|
||||
// m_lastSecondStats.clear();
|
||||
//}
|
||||
|
||||
void MultiplayerDebugPerEntityReporter::OnUpdateStatistics (const GridMate::string& address,
|
||||
const GridMate::TrafficControl::Statistics&,
|
||||
const GridMate::TrafficControl::Statistics&,
|
||||
const GridMate::TrafficControl::Statistics& effectiveLastSecond,
|
||||
const GridMate::TrafficControl::Statistics&)
|
||||
{
|
||||
m_lastSecondStats[address] = effectiveLastSecond;
|
||||
}
|
||||
//void MultiplayerDebugPerEntityReporter::OnUpdateStatistics (const GridMate::string& address,
|
||||
// const GridMate::TrafficControl::Statistics&,
|
||||
// const GridMate::TrafficControl::Statistics&,
|
||||
// const GridMate::TrafficControl::Statistics& effectiveLastSecond,
|
||||
// const GridMate::TrafficControl::Statistics&)
|
||||
//{
|
||||
// m_lastSecondStats[address] = effectiveLastSecond;
|
||||
//}
|
||||
|
||||
void MultiplayerDebugPerEntityReporter::OnConnectionStateChanged (GridMate::Carrier*,
|
||||
GridMate::ConnectionID,
|
||||
GridMate::Carrier::ConnectionStates)
|
||||
{
|
||||
m_lastSecondStats.clear();
|
||||
}
|
||||
//void MultiplayerDebugPerEntityReporter::OnConnectionStateChanged (GridMate::Carrier*,
|
||||
// GridMate::ConnectionID,
|
||||
// GridMate::Carrier::ConnectionStates)
|
||||
//{
|
||||
// m_lastSecondStats.clear();
|
||||
//}
|
||||
|
||||
void MultiplayerDebugPerEntityReporter::UpdateTrafficStatistics()
|
||||
{
|
||||
@@ -320,11 +318,11 @@ namespace MultiplayerDiagnostics
|
||||
{
|
||||
if (m_isTrackingMessages)
|
||||
{
|
||||
GridMate::Debug::ReplicaDrillerBus::Handler::BusConnect();
|
||||
//GridMate::Debug::ReplicaDrillerBus::Handler::BusConnect();
|
||||
}
|
||||
else
|
||||
{
|
||||
GridMate::Debug::ReplicaDrillerBus::Handler::BusDisconnect();
|
||||
//GridMate::Debug::ReplicaDrillerBus::Handler::BusDisconnect();
|
||||
|
||||
m_currentReceivingEntityReport.Reset();
|
||||
m_receivingEntityReports.clear();
|
||||
@@ -382,4 +380,34 @@ namespace MultiplayerDiagnostics
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void MultiplayerDebugPerEntityReporter::RecordEntitySerializeStart(AZ::EntityId entityId, const char* entityName)
|
||||
{
|
||||
}
|
||||
|
||||
void MultiplayerDebugPerEntityReporter::RecordEntitySerializeStop(AZ::EntityId entityId, const char* entityName)
|
||||
{
|
||||
}
|
||||
|
||||
void MultiplayerDebugPerEntityReporter::RecordPropertySent(
|
||||
AZ::EntityId entityId,
|
||||
Multiplayer::NetComponentId netComponentId,
|
||||
Multiplayer::PropertyIndex propertyId,
|
||||
uint32_t totalBytes)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
void MultiplayerDebugPerEntityReporter::RecordPropertyReceived(
|
||||
Multiplayer::NetComponentId netComponentId,
|
||||
Multiplayer::PropertyIndex propertyId,
|
||||
uint32_t totalBytes)
|
||||
{
|
||||
if (Multiplayer::MultiplayerComponentRegistry* componentRegistry = Multiplayer::GetMultiplayerComponentRegistry())
|
||||
{
|
||||
m_currentReceivingEntityReport.ReportField(static_cast<AZ::u32>(netComponentId),
|
||||
componentRegistry->GetComponentName(netComponentId),
|
||||
componentRegistry->GetComponentPropertyName(netComponentId, propertyId), totalBytes);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,18 +1,20 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include <GridMate/Drillers/ReplicaDriller.h>
|
||||
#include "MultiplayerDebugByteReporter.h"
|
||||
|
||||
#include <AzCore/Component/EntityId.h>
|
||||
#include <AzCore/Interface/Interface.h>
|
||||
#include <Debug/MultiplayerDebugPerEntityInterface.h>
|
||||
#include <GridMate/Drillers/CarrierDriller.h>
|
||||
#include <Multiplayer/MultiplayerTypes.h>
|
||||
|
||||
namespace MultiplayerDiagnostics
|
||||
{
|
||||
@@ -20,55 +22,60 @@ namespace MultiplayerDiagnostics
|
||||
* \brief GridMate network live analysis tool via ImGui.
|
||||
*/
|
||||
class MultiplayerDebugPerEntityReporter
|
||||
: public GridMate::Debug::ReplicaDrillerBus::Handler
|
||||
, public GridMate::Debug::CarrierDrillerBus::Handler
|
||||
: public AZ::Interface<MultilayerIPerEntityStats>::Registrar
|
||||
{
|
||||
public:
|
||||
MultiplayerDebugPerEntityReporter();
|
||||
virtual ~MultiplayerDebugPerEntityReporter();
|
||||
~MultiplayerDebugPerEntityReporter() override;
|
||||
|
||||
// main update loop
|
||||
void OnImGuiUpdate();
|
||||
|
||||
// ReplicaDrillerBus - receive
|
||||
//! MultilayerIPerEntityStats
|
||||
// @{
|
||||
void RecordEntitySerializeStart(AZ::EntityId entityId, const char* entityName);
|
||||
void RecordEntitySerializeStop(AZ::EntityId entityId, const char* entityName);
|
||||
void RecordPropertySent(Multiplayer::NetComponentId netComponentId, Multiplayer::PropertyIndex propertyId, uint32_t totalBytes) override;
|
||||
void RecordPropertyReceived(Multiplayer::NetComponentId netComponentId, Multiplayer::PropertyIndex propertyId, uint32_t totalBytes) override;
|
||||
// }@
|
||||
|
||||
void OnReceiveReplicaBegin(GridMate::Replica* replica, const void* data, size_t len) override;
|
||||
void OnReceiveReplicaEnd(GridMate::Replica* replica) override;
|
||||
/*void OnReceiveReplicaBegin(AZ::EntityId entityId, const void* data, size_t len) override;
|
||||
void OnReceiveReplicaEnd(AZ::EntityId entityId) override;
|
||||
void OnReceiveReplicaChunkEnd(GridMate::ReplicaChunkBase* chunk, AZ::u32 chunkIndex) override;
|
||||
void OnReceiveDataSet(GridMate::ReplicaChunkBase* chunk, AZ::u32 chunkIndex, GridMate::DataSetBase* dataSet, GridMate::PeerId from, GridMate::PeerId to, const void* data, size_t len) override;
|
||||
void OnReceiveRpc(GridMate::ReplicaChunkBase* chunk, AZ::u32 chunkIndex, GridMate::Internal::RpcRequest* rpc, GridMate::PeerId from, GridMate::PeerId to, const void* data, size_t len) override;
|
||||
void OnReceiveRpc(GridMate::ReplicaChunkBase* chunk, AZ::u32 chunkIndex, GridMate::Internal::RpcRequest* rpc, GridMate::PeerId from, GridMate::PeerId to, const void* data, size_t len) override;*/
|
||||
|
||||
// ReplicaDrillerBus - sending
|
||||
|
||||
void OnSendReplicaBegin(GridMate::Replica* replica) override;
|
||||
void OnSendReplicaEnd(GridMate::Replica* replica, const void* data, size_t len) override;
|
||||
/*void OnSendReplicaBegin(AZ::EntityId entityId) override;
|
||||
void OnSendReplicaEnd(AZ::EntityId entityId, const void* data, size_t len) override;
|
||||
void OnSendReplicaChunkEnd(GridMate::ReplicaChunkBase* chunk, AZ::u32 chunkIndex, const void* data, size_t len) override;
|
||||
void OnSendDataSet(GridMate::ReplicaChunkBase* chunk, AZ::u32 chunkIndex, GridMate::DataSetBase* dataSet, GridMate::PeerId from, GridMate::PeerId to, const void* data, size_t len) override;
|
||||
void OnSendRpc(GridMate::ReplicaChunkBase* chunk, AZ::u32 chunkIndex, GridMate::Internal::RpcRequest* rpc, GridMate::PeerId from, GridMate::PeerId to, const void* data, size_t len) override;
|
||||
void OnSendRpc(GridMate::ReplicaChunkBase* chunk, AZ::u32 chunkIndex, GridMate::Internal::RpcRequest* rpc, GridMate::PeerId from, GridMate::PeerId to, const void* data, size_t len) override;*/
|
||||
|
||||
// CarrierDrillerBus
|
||||
void OnIncomingConnection (GridMate::Carrier* carrier, GridMate::ConnectionID id) override;
|
||||
void OnFailedToConnect (GridMate::Carrier* carrier,
|
||||
GridMate::ConnectionID id,
|
||||
GridMate::CarrierDisconnectReason reason) override;
|
||||
void OnConnectionEstablished (GridMate::Carrier* carrier, GridMate::ConnectionID id) override;
|
||||
void OnDisconnect (GridMate::Carrier* carrier,
|
||||
GridMate::ConnectionID id,
|
||||
GridMate::CarrierDisconnectReason reason) override;
|
||||
void OnDriverError (GridMate::Carrier* carrier,
|
||||
GridMate::ConnectionID id,
|
||||
const GridMate::DriverError& error) override;
|
||||
void OnSecurityError (GridMate::Carrier* carrier,
|
||||
GridMate::ConnectionID id,
|
||||
const GridMate::SecurityError& error) override;
|
||||
void OnUpdateStatistics (const GridMate::string& address,
|
||||
const GridMate::TrafficControl::Statistics& lastSecond,
|
||||
const GridMate::TrafficControl::Statistics& lifeTime,
|
||||
const GridMate::TrafficControl::Statistics& effectiveLastSecond,
|
||||
const GridMate::TrafficControl::Statistics& effectiveLifeTime) override;
|
||||
void OnConnectionStateChanged (GridMate::Carrier* carrier,
|
||||
GridMate::ConnectionID id,
|
||||
GridMate::Carrier::ConnectionStates newState) override;
|
||||
//// CarrierDrillerBus
|
||||
//void OnIncomingConnection (GridMate::Carrier* carrier, GridMate::ConnectionID id) override;
|
||||
//void OnFailedToConnect (GridMate::Carrier* carrier,
|
||||
// GridMate::ConnectionID id,
|
||||
// GridMate::CarrierDisconnectReason reason) override;
|
||||
//void OnConnectionEstablished (GridMate::Carrier* carrier, GridMate::ConnectionID id) override;
|
||||
//void OnDisconnect (GridMate::Carrier* carrier,
|
||||
// GridMate::ConnectionID id,
|
||||
// GridMate::CarrierDisconnectReason reason) override;
|
||||
//void OnDriverError (GridMate::Carrier* carrier,
|
||||
// GridMate::ConnectionID id,
|
||||
// const GridMate::DriverError& error) override;
|
||||
//void OnSecurityError (GridMate::Carrier* carrier,
|
||||
// GridMate::ConnectionID id,
|
||||
// const GridMate::SecurityError& error) override;
|
||||
//void OnUpdateStatistics (const GridMate::string& address,
|
||||
// const GridMate::TrafficControl::Statistics& lastSecond,
|
||||
// const GridMate::TrafficControl::Statistics& lifeTime,
|
||||
// const GridMate::TrafficControl::Statistics& effectiveLastSecond,
|
||||
// const GridMate::TrafficControl::Statistics& effectiveLifeTime) override;
|
||||
//void OnConnectionStateChanged (GridMate::Carrier* carrier,
|
||||
// GridMate::ConnectionID id,
|
||||
// GridMate::Carrier::ConnectionStates newState) override;
|
||||
|
||||
private:
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <Debug/MultiplayerDebugPerEntityInterface.h>
|
||||
#include <Multiplayer/MultiplayerStats.h>
|
||||
|
||||
namespace Multiplayer
|
||||
@@ -29,8 +30,29 @@ namespace Multiplayer
|
||||
m_componentStats[netComponentIndex].m_rpcsRecv.resize(rpcCount);
|
||||
}
|
||||
|
||||
void MultiplayerStats::RecordEntitySerializeStart(AZ::EntityId entityId, const char* entityName)
|
||||
{
|
||||
if (auto* perEntityStats = AZ::Interface<MultiplayerDiagnostics::MultilayerIPerEntityStats>::Get())
|
||||
{
|
||||
perEntityStats->RecordEntitySerializeStart(entityId, entityName);
|
||||
}
|
||||
}
|
||||
|
||||
void MultiplayerStats::RecordEntitySerializeStop(AZ::EntityId entityId, const char* entityName)
|
||||
{
|
||||
if (auto* perEntityStats = AZ::Interface<MultiplayerDiagnostics::MultilayerIPerEntityStats>::Get())
|
||||
{
|
||||
perEntityStats->RecordEntitySerializeStop(entityId, entityName);
|
||||
}
|
||||
}
|
||||
|
||||
void MultiplayerStats::RecordPropertySent(NetComponentId netComponentId, PropertyIndex propertyId, uint32_t totalBytes)
|
||||
{
|
||||
if (auto* perEntityStats = AZ::Interface<MultiplayerDiagnostics::MultilayerIPerEntityStats>::Get())
|
||||
{
|
||||
perEntityStats->RecordPropertySent(netComponentId, propertyId, totalBytes);
|
||||
}
|
||||
|
||||
const uint16_t netComponentIndex = aznumeric_cast<uint16_t>(netComponentId);
|
||||
const uint16_t propertyIndex = aznumeric_cast<uint16_t>(propertyId);
|
||||
m_componentStats[netComponentIndex].m_propertyUpdatesSent[propertyIndex].m_totalCalls++;
|
||||
@@ -41,6 +63,11 @@ namespace Multiplayer
|
||||
|
||||
void MultiplayerStats::RecordPropertyReceived(NetComponentId netComponentId, PropertyIndex propertyId, uint32_t totalBytes)
|
||||
{
|
||||
if (auto* perEntityStats = AZ::Interface<MultiplayerDiagnostics::MultilayerIPerEntityStats>::Get())
|
||||
{
|
||||
perEntityStats->RecordPropertyReceived(netComponentId, propertyId, totalBytes);
|
||||
}
|
||||
|
||||
const uint16_t netComponentIndex = aznumeric_cast<uint16_t>(netComponentId);
|
||||
const uint16_t propertyIndex = aznumeric_cast<uint16_t>(propertyId);
|
||||
m_componentStats[netComponentIndex].m_propertyUpdatesRecv[propertyIndex].m_totalCalls++;
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
set(FILES
|
||||
Source/Debug/MultiplayerDebugByteReporter.cpp
|
||||
Source/Debug/MultiplayerDebugByteReporter.h
|
||||
Source/Debug/MultiplayerDebugPerEntityInterface.h
|
||||
Source/Debug/MultiplayerDebugPerEntityReporter.cpp
|
||||
Source/Debug/MultiplayerDebugPerEntityReporter.h
|
||||
Source/Debug/MultiplayerDebugModule.cpp
|
||||
|
||||
Reference in New Issue
Block a user