inline to optimized iperf

This commit is contained in:
Mathieu Lacage
2010-03-16 19:25:56 +01:00
parent dfa55631f1
commit 65a88bfab3
4 changed files with 25 additions and 15 deletions

View File

@@ -280,6 +280,11 @@ Buffer::Buffer (uint32_t dataSize, bool initialize)
bool
Buffer::CheckInternalState (void) const
{
#if 0
// If you want to modify any code in this file, enable this checking code.
// Otherwise, there is not much point is enabling it because the
// current implementation has been fairly seriously tested and the cost
// of this constant checking is pretty high, even for a debug build.
bool offsetsOk =
m_start <= m_zeroAreaStart &&
m_zeroAreaStart <= m_zeroAreaEnd &&
@@ -300,6 +305,9 @@ Buffer::CheckInternalState (void) const
", " << (internalSizeOk?"true":"false") << " ");
}
return ok;
#else
return true;
#endif
}
void
@@ -376,13 +384,6 @@ Buffer::~Buffer ()
}
}
uint32_t
Buffer::GetSize (void) const
{
NS_ASSERT (CheckInternalState ());
return m_end - m_start;
}
Buffer::Iterator
Buffer::Begin (void) const
{

View File

@@ -393,7 +393,7 @@ public:
/**
* \return the number of bytes stored in this buffer.
*/
uint32_t GetSize (void) const;
inline uint32_t GetSize (void) const;
/**
* \return a pointer to the start of the internal
@@ -633,6 +633,11 @@ Buffer::Iterator::ReadU8 (void)
}
}
uint32_t
Buffer::GetSize (void) const
{
return m_end - m_start;
}
} // namespace ns3

View File

@@ -225,12 +225,6 @@ Packet::GetNixVector (void) const
return m_nixVector;
}
uint32_t
Packet::GetSize (void) const
{
return m_buffer.GetSize ();
}
void
Packet::AddHeader (const Header &header)
{

View File

@@ -254,7 +254,7 @@ public:
* \returns the size in bytes of the packet (including the zero-filled
* initial payload)
*/
uint32_t GetSize (void) const;
inline uint32_t GetSize (void) const;
/**
* Add header to this packet. This method invokes the
* Header::GetSerializedSize and Header::Serialize
@@ -613,4 +613,14 @@ std::ostream& operator<< (std::ostream& os, const Packet &packet);
} // namespace ns3
namespace ns3 {
uint32_t
Packet::GetSize (void) const
{
return m_buffer.GetSize ();
}
} // namespace ns3
#endif /* PACKET_H */