BUF_maxbuff
2-24
C Interface
Syntax
count = BUF_maxbuff(buf);
Parameters
BUF_Handle buf;
/* buffer pool object Handle */
Return Value
Uns
count;
/*maximum number of buffers used */
Reentrant
no
Description
BUF_maxbuff returns the maximum number of buffers that have been
allocated from the specified buffer pool at any time. The count measures
the number of buffers in use, not the total number of times buffers have
been allocated.
The buf parameter is the handle that identifies the buffer pool object. This
handle is the one returned by the call to BUF_create.
BUF_maxbuff distinguishes free and allocated buffers via a stamp
mechanism. Allocated buffers are marked with the BUF_ALLOCSTAMP
stamp (0xcafe). If the application happens to change this stamp to the
BUF_FREESTAMP stamp (0xbeef), the count may be inaccurate. Note
that this is not an application error. This stamp is only used for
BUF_maxbuff, and changing it does not affect program execution.
The time required to successfully execute BUF_maxbuff is not
deterministic (that is, the time varies over multiple calls).
Constraints and
Calling Context
❏
BUF_maxbuff cannot be called from a SWI or HWI.
❏
The application must implement synchronization to ensure that other
threads do not perform BUF_alloc during the execution of
BUF_maxbuff. Otherwise, the count returned by BUF_maxbuff may
be inaccurate.
Example
extern BUF_Obj bufferPool;
BUF_Handle buffPoolHandle = &bufferPool;
Int maxbuff;
maxbuff = BUF_maxbuff(buffPoolHandle);
LOG_printf(&trace, "Max buffers used: %d", maxbuff);
See Also
BUF_maxbuff
Check the maximum number of buffers from the buffer pool