![]() |
XRootD
|
#include <XrdOucBuffer.hh>
Public Member Functions | |
XrdOucBuffPool (int minsz=4096, int maxsz=65536, int minh=1, int maxh=16, int rate=1) | |
~XrdOucBuffPool () | |
XrdOucBuffer * | Alloc (int sz) |
int | MaxSize () const |
Friends | |
class | XrdOucBuffer |
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.
Definition at line 54 of file XrdOucBuffer.hh.
XrdOucBuffPool::XrdOucBuffPool | ( | int | minsz = 4096 , |
int | maxsz = 65536 , |
||
int | minh = 1 , |
||
int | maxh = 16 , |
||
int | rate = 1 |
||
) |
Constructor
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. |
Definition at line 53 of file XrdOucBuffer.cc.
|
inline |
Destructor - You must not destroy this object prior to recycling all oustanding buffers allocated out of this pool.
Definition at line 109 of file XrdOucBuffer.hh.
XrdOucBuffer * XrdOucBuffPool::Alloc | ( | int | sz | ) |
Allocate a buffer object.
sz | - the desired size. It os rounded up to be a multiple of incBsz but cannot exceed maxBsz. |
Definition at line 100 of file XrdOucBuffer.cc.
References XrdOucBuffer.
Referenced by XrdCmsClientMan::XrdCmsClientMan(), XrdOfsPrepGPIReal::PrepGPI::query(), and XrdSsiFileSess::write().
|
inline |
Obtain the maximum size a buffer can have.
Definition at line 77 of file XrdOucBuffer.hh.
|
friend |
Definition at line 56 of file XrdOucBuffer.hh.
Referenced by Alloc().