mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-11 07:43:33 +08:00
Optimized padding, added more sizeof() outputs
This commit is contained in:
@@ -99,10 +99,10 @@ public:
|
||||
class UAVCAN_EXPORT TransferListenerBase : public LinkedListNode<TransferListenerBase>, Noncopyable
|
||||
{
|
||||
const DataTypeDescriptor& data_type_;
|
||||
const TransferCRC crc_base_; ///< Pre-initialized with data type hash, thus constant
|
||||
MapBase<TransferBufferManagerKey, TransferReceiver>& receivers_;
|
||||
ITransferBufferManager& bufmgr_;
|
||||
TransferPerfCounter& perf_;
|
||||
const TransferCRC crc_base_; ///< Pre-initialized with data type hash, thus constant
|
||||
bool allow_anonymous_transfers_;
|
||||
|
||||
class TimedOutReceiverPredicate
|
||||
@@ -126,10 +126,10 @@ protected:
|
||||
MapBase<TransferBufferManagerKey, TransferReceiver>& receivers,
|
||||
ITransferBufferManager& bufmgr)
|
||||
: data_type_(data_type)
|
||||
, crc_base_(data_type.getSignature().toTransferCRC())
|
||||
, receivers_(receivers)
|
||||
, bufmgr_(bufmgr)
|
||||
, perf_(perf)
|
||||
, crc_base_(data_type.getSignature().toTransferCRC())
|
||||
, allow_anonymous_transfers_(false)
|
||||
{ }
|
||||
|
||||
|
||||
@@ -144,6 +144,9 @@ TEST(ServiceServer, Empty)
|
||||
|
||||
uavcan::ServiceServer<root_ns_a::EmptyService, EmptyServerImpl::Binder> server(node);
|
||||
|
||||
std::cout << "sizeof(ServiceServer<root_ns_a::EmptyService, EmptyServerImpl::Binder>): "
|
||||
<< sizeof(uavcan::ServiceServer<root_ns_a::EmptyService, EmptyServerImpl::Binder>) << std::endl;
|
||||
|
||||
ASSERT_EQ(0, node.getDispatcher().getNumServiceRequestListeners());
|
||||
ASSERT_GE(0, server.start(impl.bind()));
|
||||
ASSERT_EQ(1, node.getDispatcher().getNumServiceRequestListeners());
|
||||
|
||||
@@ -176,6 +176,8 @@ TEST(dynamic_node_id_server_Server, Basic)
|
||||
|
||||
TEST(dynamic_node_id_server, ObjectSizes)
|
||||
{
|
||||
using namespace uavcan;
|
||||
using namespace uavcan::protocol::dynamic_node_id::server;
|
||||
using namespace uavcan::dynamic_node_id_server;
|
||||
|
||||
std::cout << "distributed::Log: " << sizeof(distributed::Log) << std::endl;
|
||||
@@ -184,4 +186,10 @@ TEST(dynamic_node_id_server, ObjectSizes)
|
||||
std::cout << "distributed::RaftCore: " << sizeof(distributed::RaftCore) << std::endl;
|
||||
std::cout << "distributed::Server: " << sizeof(distributed::Server) << std::endl;
|
||||
std::cout << "AllocationRequestManager: " << sizeof(AllocationRequestManager) << std::endl;
|
||||
|
||||
std::cout << "ServiceServer<AppendEntries>: " << sizeof(ServiceServer<AppendEntries>) << std::endl;
|
||||
std::cout << "ServiceClient<AppendEntries>: " << sizeof(ServiceClient<AppendEntries>) << std::endl;
|
||||
std::cout << "ServiceServer<RequestVote>: " << sizeof(ServiceServer<RequestVote>) << std::endl;
|
||||
std::cout << "ServiceClient<RequestVote,~,5>:"
|
||||
<< sizeof(ServiceClient<RequestVote, void (*)(const ServiceCallResult<RequestVote>&), 5>) << std::endl;
|
||||
}
|
||||
|
||||
@@ -289,3 +289,10 @@ TEST(TransferListener, AnonymousTransfers)
|
||||
|
||||
ASSERT_TRUE(subscriber.isEmpty());
|
||||
}
|
||||
|
||||
TEST(TransferListener, Sizes)
|
||||
{
|
||||
using namespace uavcan;
|
||||
|
||||
std::cout << "sizeof(TransferListener<64, 1, 2>): " << sizeof(TransferListener<64, 1, 2>) << std::endl;
|
||||
}
|
||||
|
||||
@@ -102,6 +102,8 @@ TEST(TransferReceiver, Basic)
|
||||
uavcan::ITransferBufferManager& bufmgr = context.bufmgr;
|
||||
uavcan::TransferBufferAccessor bk(context.bufmgr, RxFrameGenerator::DEFAULT_KEY);
|
||||
|
||||
std::cout << "sizeof(TransferReceiver): " << sizeof(TransferReceiver) << std::endl;
|
||||
|
||||
/*
|
||||
* Empty
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user