BUF_stat
Application Program Interface
2-25
C Interface
Syntax
BUF_stat(buf,statbuf);
Parameters
BUF_Handle buf;
/* buffer pool object handle */
BUF_Stat
*statbuf;
/* pointer to buffer status structure */
Return Value
none
Reentrant
yes
Description
BUF_stat returns the status of the specified buffer pool.
The buf parameter is the handle that identifies the buffer pool object. This
handle is the one returned by the call to BUF_create.
The statbuf parameter must be a structure of type BUF_Stat. The
BUF_stat function fills in all the fields of the structure. The BUF_Stat type
has the following fields:
typedef struct BUF_Stat {
MEM_sizep postalignsize; /* Size after align */
MEM_sizep size; /* Original size of buffer */
Uns totalbuffers; /* Total # of buffers in pool */
Uns freebuffers; /* # of free buffers in pool */
} BUF_Stat;
Size values are expressed in Minimum Addressable Data Units
(MADUs). BUF_stat collects statistics with interrupts disabled to ensure
the correctness of the statistics gathered.
The time required to successfully execute BUF_stat is deterministic
(constant over multiple calls).
Example
extern BUF_Obj bufferPool;
BUF_Handle buffPoolHandle = &bufferPool;
BUF_Stat stat;
BUF_stat(buffPoolHandle, &stat);
LOG_printf(&trace, "Free buffers Available: %d",
stat.freebuffers);
See Also
BUF_stat
Determine the status of a buffer pool