GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> IMM / dev > imm / mv2304
#include <PBS/FPA.h>
#include <PBS/TOC.h>
#include <PBS/WCT.h>
Classes | |
struct | _FPM_AllocStat |
Structure for per allocator instrumentation statistics. More... | |
struct | _FPM_PoolStat |
Structure for complete FPM pool instrumentation statistics. More... | |
struct | _FPM_PoolDsc |
Structure to describe a memory pool. More... | |
struct | _FPM_PoolHist |
Structure for per pool instrumentation counts (histogram). More... | |
Defines | |
#define | FPM_L_POOLNAME (8) |
Typedefs | |
typedef struct _FPM_Pool | FPM_Pool |
Typedef for struct _FPM_Pool. | |
typedef unsigned int | FPM_cb_ScanPool (void *prm, FPM_Pool *pcb) |
Signature for an FPM memory pool scan routine. | |
typedef void | FPM_cb_StopPool (void *prm) |
Signature for an FPM memory pool stop completion routine. | |
typedef struct _FPM_AllocStat | FPM_AllocStat |
Typedef for struct _MSG_AllocStat. | |
typedef struct _FPM_PoolStat | FPM_PoolStat |
Typedef for struct _MSG_PoolStat. | |
typedef struct _FPM_PoolDsc | FPM_PoolDsc |
Typedef for struct _FPM_PoolDsc. | |
typedef struct _FPM_PoolHist | FPM_PoolHist |
Typedef for struct _MSG_PoolHist. | |
Functions | |
void * | FPM_alloc (FPM_Pool *pcb, unsigned int siz, unsigned int *status) |
Allocate a packet from an FPM memory pool. | |
void * | FPM_allocITC (FPM_Pool *pcb, unsigned int siz, void **rtn, void **cb0, void **cb1, void **cb2) |
Allocate memory packet without timeout (ITC courtesy entry point). | |
void * | FPM_allocW (FPM_Pool *pcb, unsigned int siz, unsigned int *status) |
Allocate a packet from an FPM memory pool. | |
void * | FPM_allocW_toc (FPM_Pool *pcb, unsigned int siz, const TOC *toc, unsigned int *status) |
Allocate a packet from an FPM memory pool. | |
unsigned int | FPM_createPool (FPM_Pool **pcb, const char *poolNam, unsigned int poolCnt, FPM_PoolDsc *poolDsc, FPA_type typ) |
Create memory pool from collection of fixed packet allocators. | |
unsigned int | FPM_deletePool (FPM_Pool *pcb) |
Delete a memory pool (and release its resources). | |
unsigned int | FPM_free (FPM_Pool *pcb, void *pkt) |
Free a packet back to an FPM memory pool. | |
FPM_Pool * | FPM_getPoolHandle (const char *name) |
Return the pool handle corresponding to a pool name. | |
unsigned int | FPM_getPoolHist (FPM_Pool *pcb, FPM_PoolHist *phb) |
Get the contents of the histogram block for a pool. | |
const char * | FPM_getPoolName (FPM_Pool *pcb) |
Return the name of a memory pool. | |
unsigned int | FPM_getPoolStat (FPM_Pool *pcb, FPM_PoolStat *psb, unsigned int reset) |
Get the contents of the statistics block for a pool. | |
unsigned int | FPM_initialize (void) |
Initialize the memory pool manager. | |
unsigned int | FPM_scanPool (FPM_cb_ScanPool *rtn, void *prm) |
Scan through the list of memory pools. | |
unsigned int | FPM_sizeofPoolStat (FPM_Pool *pcb) |
Return the size (bytes) neede to hols a pool statistics block. | |
unsigned int | FPM_startPool (FPM_Pool *pcb) |
Start a fixed packet allocation memory pool. | |
unsigned int | FPM_stopPool (FPM_Pool *pcb, FPM_cb_StopPool *poolRtn, void *poolPrm) |
Stop a fixed packet allocation memory pool. |
CVS $Id: FPM_pubdefs.h,v 1.3 2011/03/25 20:22:50 apw Exp $
void* FPM_alloc | ( | FPM_Pool * | pcb, | |
unsigned int | siz, | |||
unsigned int * | status | |||
) |
Allocate a packet from an FPM memory pool.
pcb | (in) Memory pool control block | |
siz | (in) Number of bytes to allocate | |
status | (out) Completion status (pointer can be NULL) |
NULL | Memory allocation failed | |
x | Pointer to allocated memory |
FPM_POOLDRY | No packets left in pool to satisfy allocation | |
FPM_POOLPTR | Pool control block pointer invalid | |
FPM_POOLSTAT | Pool control block not in state started | |
FPM_POOLSIZE | Pool has no allocator big enough | |
FPM_SUCCESS | Success |
References FPM_allocAny().
void* FPM_allocITC | ( | FPM_Pool * | pcb, | |
unsigned int | siz, | |||
void ** | rtn, | |||
void ** | cb0, | |||
void ** | cb1, | |||
void ** | cb2 | |||
) |
Allocate memory packet without timeout (ITC courtesy entry point).
pcb | (in) Memory pool control block | |
siz | (in) Number of bytes to allocate | |
rtn | (out) Processing completion callback routine | |
cb0 | (out) Processing completion callback user parameter 0 | |
cb1 | (out) Processing completion callback user parameter 1 | |
cb2 | (out) Processing completion callback user parameter 2 |
NULL | Memory allocation failed | |
x | Pointer to allocated memory |
References FPM_allocAny(), and FPM_freeITC().
void* FPM_allocW | ( | FPM_Pool * | pcb, | |
unsigned int | siz, | |||
unsigned int * | status | |||
) |
Allocate a packet from an FPM memory pool.
pcb | (in) Memory pool control block | |
siz | (in) Number of bytes to allocate | |
status | (out) Completion status (pointer can be NULL) |
NULL | Memory allocation failed | |
x | Pointer to allocated memory |
FPM_POOLDRY | No packets left in pool to satisfy allocation | |
FPM_POOLPTR | Pool control block pointer invalid | |
FPM_POOLSTAT | Pool control block not in state started | |
FPM_POOLSIZE | Pool has no allocator big enough | |
FPM_SUCCESS | Success |
References FPM_allocAny().
void* FPM_allocW_toc | ( | FPM_Pool * | pcb, | |
unsigned int | siz, | |||
const TOC * | toc, | |||
unsigned int * | status | |||
) |
Allocate a packet from an FPM memory pool.
pcb | (in) Memory pool control block | |
siz | (in) Number of bytes to allocate | |
toc | (in) Time-out control | |
status | (out) Completion status (pointer can be NULL) |
NULL | Memory allocation failed | |
x | Pointer to allocated memory |
FPM_POOLDRY | No packets left in pool to satisfy allocation | |
FPM_POOLPTR | Pool control block pointer invalid | |
FPM_POOLSTAT | Pool control block not in state started | |
FPM_POOLSIZE | Pool has no allocator big enough | |
FPM_SUCCESS | Success |
References FPM_allocAny().
unsigned int FPM_createPool | ( | FPM_Pool ** | pcb, | |
const char * | poolNam, | |||
unsigned int | poolCnt, | |||
FPM_PoolDsc * | poolDsc, | |||
FPA_type | typ | |||
) |
Create memory pool from collection of fixed packet allocators.
pcb | (out) Memory pool control block | |
poolNam | (in) Pool name | |
poolCnt | (in) Pool allocator descriptor count | |
poolDsc | (in) Pool allocator descriptors | |
typ | (in) FPA pend type |
FPM_ALOCFAIL | Memory allocation failure | |
FPM_CTLSTAT | FPM control block not in state initialized | |
FPM_FPAINIT | FPA initialization failure | |
FPM_NOTINIT | FPM system not initialized | |
FPM_PDSCCNT | Pool descriptor list size out of range | |
FPM_PDSCORDR | Pool descriptor list not sorted in ascending order | |
FPM_PDSCPKTN | Pool descriptor allocator count below minimum | |
FPM_PDSCPKTS | Pool descriptor allocator size out of range | |
FPM_PNAMLEN | Pool name length out of valid range | |
FPM_PNAMNULL | Pool name is a NULL pointer | |
FPM_PNAMSNTX | Pool name s has invalid syntax | |
FPM_SUCCESS | Success |
References _FPM_Allocator::acb, _FPM_AllocStat::alloc, _FPM_PoolStat::alloc, _FPM_Pool::alloc, _FPM_Pool::chk, _FPM_Control::cnt, _FPM_PoolDsc::cnt, deletePool(), FPM_fcb, FPM_MEM_INITIALIZED, FPM_MEM_UNINITIALIZED, _FPM_AllocStat::free, _FPM_AllocStat::hwm_reset, _FPM_AllocStat::hwm_start, _FPM_AllocStat::lwm_reset, _FPM_AllocStat::lwm_start, _FPM_Pool::map, _FPM_Allocator::mem, _FPM_Control::mtx, _FPM_Pool::nalloc, _FPM_PoolStat::name, _FPM_AllocStat::now, _FPM_Pool::nxt, _FPM_Control::nxt, _FPM_Pool::psb, _FPM_AllocStat::siz, _FPM_PoolDsc::siz, _FPM_Pool::state, validName(), and validPool().
unsigned int FPM_deletePool | ( | FPM_Pool * | pcb | ) |
Delete a memory pool (and release its resources).
pcb | (in) Memory pool control block |
FPM_POOLPTR | Pool control block pointer invalid | |
FPM_POOLSTAT | Pool control block not in state initialized | |
FPM_SUCCESS | Success |
References _FPM_Pool::chk, _FPM_Control::cnt, deletePool(), FPM_fcb, FPM_MEM_INITIALIZED, _FPM_Control::mtx, _FPM_Pool::nxt, _FPM_Control::nxt, _FPM_Pool::psb, and _FPM_Pool::state.
unsigned int FPM_free | ( | FPM_Pool * | pcb, | |
void * | pkt | |||
) |
Free a packet back to an FPM memory pool.
pcb | (in) Memory pool control block | |
pkt | (in) Packet to free |
FPM_POOLMISS | Packet pointer not valid in this pool | |
FPM_POOLPTR | Pool control block pointer invalid | |
FPM_SUCCESS | Success |
References _FPM_Allocator::acb, _FPM_PoolStat::alloc, _FPM_Pool::alloc, _FPM_Pool::chk, _FPM_Pool::cur, FPM_fcb, FPM_getPoolName(), FPM_MEM_STOPPING, FPM_stopCheck(), _FPM_AllocStat::free, _FPM_AllocStat::hwm_reset, _FPM_Allocator::mem, _FPM_AllocStat::now, _FPM_Pool::psb, _FPM_Control::rwi, and _FPM_Pool::state.
Referenced by FPM_freeITC().
FPM_Pool * FPM_getPoolHandle | ( | const char * | name | ) |
Return the pool handle corresponding to a pool name.
name | (in) Name of memory pool to search for |
References FPM_fcb, _FPM_Control::mtx, _FPM_PoolStat::name, _FPM_Pool::nxt, _FPM_Control::nxt, and _FPM_Pool::psb.
unsigned int FPM_getPoolHist | ( | FPM_Pool * | pcb, | |
FPM_PoolHist * | phb | |||
) |
Get the contents of the histogram block for a pool.
pcb | (in) Memory pool control block | |
phb | (out) Memory pool histogram block |
FPM_NOTINIT | FPM system not initialized | |
FPM_POOLPTR | Pool control block pointer invalid | |
FPM_POOLSIZE | Pool doesn't have an allocator that size | |
FPM_SUCCESS | Success |
Any errors also result in a zeroed histogram block being returned.
References _FPM_Pool::chk, FPM_fcb, FPM_MEM_STARTED, FPM_MEM_STOPPING, _FPM_PoolHist::hist, _FPM_Pool::hist, _FPM_Control::mtx, _FPM_PoolStat::name, _FPM_PoolHist::name, _FPM_Pool::psb, _FPM_Control::rwi, _FPM_PoolStat::start, _FPM_PoolHist::start, _FPM_Pool::state, _FPM_PoolStat::stop, and _FPM_PoolHist::stop.
const char * FPM_getPoolName | ( | FPM_Pool * | pcb | ) |
Return the name of a memory pool.
pcb | (in) Memory pool control block |
<nonam>
. References _FPM_Pool::chk, FPM_fcb, _FPM_PoolStat::name, and _FPM_Pool::psb.
Referenced by FPM_free().
unsigned int FPM_getPoolStat | ( | FPM_Pool * | pcb, | |
FPM_PoolStat * | psb, | |||
unsigned int | reset | |||
) |
Get the contents of the statistics block for a pool.
pcb | (in) Memory pool control block | |
psb | (out) Pool statistics block | |
reset | (in) Reset flag (0/1 => no reset/reset) |
FPM_NOTINIT | FPM system not initialized | |
FPM_POOLPTR | Pool control block pointer invalid | |
FPM_POOLSIZE | Pool doesn't have an allocator that size | |
FPM_SUCCESS | Success |
Pool statistics include allocation high and low water marks since the pool was started. These can be of marginal utility (the hwm never moves off the original number of packets allocated, and if the pool exhausts, the lwm gets stuck on zero). The statistics therefore keep a second, resettable set of high and low water marks. Setting the reset parameter to this routine will cause them to reset to the currently allocated number of packets (and take a timestamp of when the reset occured). These are the only statistics affected by the reset flag. All other statistics accumulate from memory pool start.
If called while the memory pool is not started, the statistics returned apply to the most recent "started" period. If the memory pool has never been started, a zeroed statistice block is returned.
Any errors also result in a zeroed statistics block being returned.
References _FPM_PoolStat::alloc, _FPM_Pool::chk, FPM_fcb, FPM_MEM_STARTED, FPM_MEM_STOPPING, _FPM_AllocStat::hwm_reset, _FPM_AllocStat::lwm_reset, _FPM_Control::mtx, _FPM_Pool::nalloc, _FPM_AllocStat::now, _FPM_Pool::psb, _FPM_PoolStat::reset, _FPM_Control::rwi, _FPM_Pool::state, and _FPM_PoolStat::stop.
unsigned int FPM_initialize | ( | void | ) |
Initialize the memory pool manager.
FPM_ALOCFAIL | Memory allocation failure | |
FPM_MUALOCFL | Mutex allocation failure | |
FPM_SUCCESS | Success |
References _FPM_Control::mtx, and _FPM_Control::rwi.
unsigned int FPM_scanPool | ( | FPM_cb_ScanPool * | rtn, | |
void * | prm | |||
) |
Scan through the list of memory pools.
rtn | (in) Scan callback routine | |
prm | (in) Scan callback parameter |
FPM_NOTINIT | FPM system not initialized | |
FPM_PARMNULL | Callback routine is a NULL pointer | |
FPM_SUCCESS | Success |
References FPM_fcb, _FPM_Control::mtx, _FPM_Pool::nxt, and _FPM_Control::nxt.
unsigned int FPM_sizeofPoolStat | ( | FPM_Pool * | pcb | ) |
Return the size (bytes) neede to hols a pool statistics block.
pcb | (in) Memory pool control block |
0 | Invalid request (pcb makes no sense) | |
x | Size of memory required |
References _FPM_Pool::chk, and _FPM_Pool::nalloc.
unsigned int FPM_startPool | ( | FPM_Pool * | pcb | ) |
Start a fixed packet allocation memory pool.
pcb | (in) Memory pool control block |
FPM_POOLPTR | Pool control block pointer invalid | |
FPM_POOLSTAT | Pool control block not in state initialized | |
FPM_SUCCESS | Success |
References _FPM_AllocStat::alloc, _FPM_PoolStat::alloc, _FPM_Pool::chk, FPM_fcb, FPM_MEM_INITIALIZED, FPM_MEM_STARTED, _FPM_AllocStat::free, _FPM_Pool::hist, _FPM_AllocStat::hwm_reset, _FPM_AllocStat::hwm_start, _FPM_AllocStat::lwm_reset, _FPM_AllocStat::lwm_start, _FPM_Control::mtx, _FPM_AllocStat::now, _FPM_Pool::psb, _FPM_PoolStat::reset, _FPM_PoolStat::start, _FPM_Pool::state, and _FPM_PoolStat::stop.
unsigned int FPM_stopPool | ( | FPM_Pool * | pcb, | |
FPM_cb_StopPool * | poolRtn, | |||
void * | poolPrm | |||
) |
Stop a fixed packet allocation memory pool.
pcb | (in) Memory pool control block | |
poolRtn | (in) Completion callback routine | |
poolPrm | (in) Completion callback parameter |
FPM_POOLPTR | Pool control block pointer invalid | |
FPM_POOLSTAT | Pool control block not in state initialized | |
FPM_SUCCESS | Success |
References _FPM_Pool::chk, FPM_fcb, FPM_MEM_STARTED, FPM_MEM_STOPPING, FPM_stopCheck(), _FPM_Control::mtx, _FPM_Pool::prm, _FPM_Pool::rtn, and _FPM_Pool::state.