XrdOucBuffPool Class Reference

#include <XrdOucBuffer.hh>

Collaboration diagram for XrdOucBuffPool:
Collaboration graph
[legend]

List of all members.

Classes

struct  BuffSlot

Public Member Functions

XrdOucBufferAlloc (int sz)
int MaxSize () const
 XrdOucBuffPool (int minsz=4096, int maxsz=65536, int minh=1, int maxh=16, int rate=1)
 ~XrdOucBuffPool ()

Private Attributes

BuffSlotbSlot
int incBsz
int shfBsz
int rndBsz
int maxBsz
int slots

Static Private Attributes

static int alignit

Friends

class XrdOucBuffer

Detailed Description

These classes allow for buffer management to minimize data copying. They are typically used in conjunction with the XrdOucErrInfo class. The XrdOucBuffPool class defines a pool of buffers and one such object must exist for each buffer pool (there can be many such pools). This object manufactures XrdOucBuffer objects. You can also create XrdOucBuffers without using a buffer pool (i.e. one time buffers). See the XrdOucBuffer constructor for details on how to do this and the associated caveats.


Constructor & Destructor Documentation

XrdOucBuffPool::XrdOucBuffPool ( int  minsz = 4096,
int  maxsz = 65536,
int  minh = 1,
int  maxh = 16,
int  rate = 1 
)

Constructor

Parameters:
minsz - the minimum size a buffer can have. If it is smaller than 1024 it is set to 1024. The minsz is also adjusted to be equal to the closest smaller value of 1024*(2**n) (i.e. 1K, 2k, 4K, etc). If it's greater than 16MB, it is set to 16MB.
maxsz - the maximum size a buffer can have and must be >= minsz. If it's >minsz it is rounded up to the next minsz increment. Buffer sizes are always allocated in minsz increments.
minh - the minimum number of buffers that should be held in reserve when a buffer is recycled.
maxh - the maximum number of buffers that should be held in reserve when a buffer is recycled. The value applies to the smallest buffer size and is progessively reduced as the buffer size increases. If maxh < minh it is set to minh.
rate - specifies how quickly the hold vale is to be reduced as buffer sizes increase. A rate of 0 specifies a purely linear decrease. Higher values logrithmically decrease the hold.
XrdOucBuffPool::~XrdOucBuffPool (  )  [inline]

Destructor - You must not destroy this object prior to recycling all oustanding buffers allocated out of this pool.

References bSlot.


Member Function Documentation

XrdOucBuffer* XrdOucBuffPool::Alloc ( int  sz  ) 

Allocate a buffer object.

Parameters:
sz - the desired size. It os rounded up to be a multiple of incBsz but cannot exceed maxBsz.
Returns:
!0 - pointer to usable buffer object of suitable size.
=0 - insufficient memort ro allocate a buffer.
int XrdOucBuffPool::MaxSize (  )  const [inline]

Obtain the maximum size a buffer can have.

Returns:
The maximum size a buffer can be.

References maxBsz.


Friends And Related Function Documentation

friend class XrdOucBuffer [friend]

Member Data Documentation

int XrdOucBuffPool::alignit [static, private]
int XrdOucBuffPool::incBsz [private]
int XrdOucBuffPool::maxBsz [private]

Referenced by MaxSize().

int XrdOucBuffPool::rndBsz [private]
int XrdOucBuffPool::shfBsz [private]
int XrdOucBuffPool::slots [private]

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 8 May 2020 for xrootd by  doxygen 1.6.1