GLAST/LAT > DAQ and FSW > FSW > Doxygen Index > IMM / V0-0-2

Constituent: imm     Tag: linux-gcc


Interface   Data Structures   File List   Data Fields   Globals  

FPM_pool.c File Reference

Memory pool manager pool control routines. More...

#include <ctype.h>
#include <string.h>
#include "PBS/FPA.h"
#include "PBS/MBA.h"
#include "PBS/MTX.h"
#include "PBS/RW.ih"
#include "MSG/MSG_pubdefs.h"
#include "IMM/FPM_pubdefs.h"
#include "IMM/FPM_msgs.h"
#include "FPM_prvdefs.h"

Include dependency graph for FPM_pool.c:

Include dependency graph

Functions

void deletePool (FPM_Pool *pcb, FPM_PoolStat *psb)
 Delete fixed packet allocation memory pool and control block.

unsigned int validName (const char *name, const char *func)
 Validate a pool name.

unsigned int validPool (unsigned int poolCnt, const FPM_PoolDsc *poolDsc, const char *func)
 Validate a memory pool description.

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).

FPM_PoolFPM_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_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.

void FPM_stopCheck (FPM_Pool *pcb)
 Check if pool is drained (and if it is, complete stop processing).

unsigned int FPM_stopPool (FPM_Pool *pcb, FPM_cb_StopPool *poolRtn, void *poolPrm)
 Stop a fixed packet allocation memory pool.


Variables

const char * FPM_mem_states [FPM_L_MEM_STATES]
 String constants for FPM memory states.


Detailed Description

Memory pool manager pool control routines.

CVS $Id: FPM_pool.c,v 1.2 2005/03/25 01:01:41 apw Exp $
Author:
A.P.Waite
FPM_pool.c provides the memory pool manager pool control routines.

Function Documentation

void deletePool FPM_Pool pcb,
FPM_PoolStat psb
[static]
 

Delete fixed packet allocation memory pool and control block.

Parameters:
pcb (in) Memory pool control block
psb (in) Memory pool statistics block
deletePool() deletes an FPM memory pool complete with the associated pool control block and pool statistics block.

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.

Parameters:
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
Return values:
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
FPM_createPool() creates a memory pool based on the memory pool descriptors passed to the routine. Each descriptor descibes one fixed packet allocator, giving the fixed packet size (expressed in powers of two) and packet count. The descriptors are treated as an array, and /e must describe the fixed packet allocators in order of increasing packet size.

Here is the call graph for this function:

unsigned int FPM_deletePool FPM_Pool pcb  ) 
 

Delete a memory pool (and release its resources).

Parameters:
pcb (in) Memory pool control block
Return values:
FPM_POOLPTR Pool control block pointer invalid
FPM_POOLSTAT Pool control block not in state initialized
FPM_SUCCESS Success
FPM_deletePool() deletes an memory pool and releases all the associated resources.

Here is the call graph for this function:

FPM_Pool* FPM_getPoolHandle const char *  name  ) 
 

Return the pool handle corresponding to a pool name.

Parameters:
name (in) Name of memory pool to search for
FPM_getPoolHandle() searches through the list of pools for the one named name and if found, returns its handle. Any error results in a NULL return value.

unsigned int FPM_getPoolHist FPM_Pool pcb,
FPM_PoolHist phb
 

Get the contents of the histogram block for a pool.

Parameters:
pcb (in) Memory pool control block
phb (out) Memory pool histogram block
Return values:
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
FPM_getPoolHist() returns a pool's histogram block into a block of caller provided memory, along with time stamps. The histogram accumulates requested allocation sizes (in powers of two). It accumulates continuously while the pool is started. If the pool is stopped, the histogram for the most recent "started" period is returned. If the pool has never been started, a zeroed histogram block is returned.

Any errors also result in a zeroed histogram block being returned.

const char* FPM_getPoolName FPM_Pool pcb  ) 
 

Return the name of a memory pool.

Parameters:
pcb (in) Memory pool control block
Returns:
A pointer to the pool name. Any error (NULL pool control block pointer, invalid pool control block pointer, ...) causes the routine to return a pointer to the string <nonam>.

unsigned int FPM_getPoolStat FPM_Pool pcb,
FPM_PoolStat psb,
unsigned int  reset
 

Get the contents of the statistics block for a pool.

Parameters:
pcb (in) Memory pool control block
psb (out) Pool statistics block
reset (in) Reset flag (0/1 => no reset/reset)
Return values:
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
FPM_getPoolStat() returns a pool's statistics block into a block of caller provided memory. To find out how big the user provided piece of memory should be, use FPM_sizeofPoolStat().

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.

unsigned int FPM_scanPool FPM_cb_ScanPool rtn,
void *  prm
 

Scan through the list of memory pools.

Parameters:
rtn (in) Scan callback routine
prm (in) Scan callback parameter
Return values:
FPM_NOTINIT FPM system not initialized
FPM_PARMNULL Callback routine is a NULL pointer
FPM_SUCCESS Success
FPM_scanPool() scans though the list of known pools and calls back the user provided routine for each in turn. A non-success return code from the user's callback routine aborts the scan.

unsigned int FPM_sizeofPoolStat FPM_Pool pcb  ) 
 

Return the size (bytes) neede to hols a pool statistics block.

Parameters:
pcb (in) Memory pool control block
Return values:
0 Invalid request (pcb makes no sense)
x Size of memory required

unsigned int FPM_startPool FPM_Pool pcb  ) 
 

Start a fixed packet allocation memory pool.

Parameters:
pcb (in) Memory pool control block
Return values:
FPM_POOLPTR Pool control block pointer invalid
FPM_POOLSTAT Pool control block not in state initialized
FPM_SUCCESS Success
FPM_startPool() starts a memory pool (make it available for allocation requests).

void FPM_stopCheck FPM_Pool pcb  ) 
 

Check if pool is drained (and if it is, complete stop processing).

Parameters:
pcb (in) Memory pool control block
FPM_stopCheck() checks a pool to see if all the packets are back on the free lists, and if so, completes the process of stopping the pool.

unsigned int FPM_stopPool FPM_Pool pcb,
FPM_cb_StopPool poolRtn,
void *  poolPrm
 

Stop a fixed packet allocation memory pool.

Parameters:
pcb (in) Memory pool control block
poolRtn (in) Completion callback routine
poolPrm (in) Completion callback parameter
Return values:
FPM_POOLPTR Pool control block pointer invalid
FPM_POOLSTAT Pool control block not in state initialized
FPM_SUCCESS Success
FPM_stopPool() starts the process of stopping a memory pool. Note that this is not instantaneous. The pool is not officially stopped until all packets managed by the pool are back on the free lists. If the caller needs to synchronize on exactly when the pool transitions from FPM_MEM_STOPPING to FPM_MEM_INITIALIZED, then please use the completion callback.

Here is the call graph for this function:

unsigned int validName const char *  name,
const char *  func
[static]
 

Validate a pool name.

Parameters:
name (in) Pool name
func (in) Name of calling routine
Return values:
FPM_PNAMLEN Pool name length out of valid range
FPM_PNAMNULL Pool name is a NULL pointer
FPM_PNAMSNTX Pool name has invalid syntax
FPM_SUCCESS Success
FPM_validName() validates a memory pool name.

unsigned int validPool unsigned int  poolCnt,
const FPM_PoolDsc poolDsc,
const char *  func
[static]
 

Validate a memory pool description.

Parameters:
poolCnt (in) Pool descriptor count
poolDsc (in) Pool descriptors
func (in) Name of calling routine
Return values:
FPM_PDSCCNT Pool descriptor list size out of range
FPM_PDSCORDR Pool descriptor list not sorted in ascending order
FPM_PDSCPKTN Pool descriptor packet count below minimum
FPM_PDSCPKTS Pool descriptor allocator size out of range
FPM_SUCCESS Success
FPM_validPool() validates a memory pool description.


Variable Documentation

const char* FPM_mem_states[FPM_L_MEM_STATES]
 

Initial value:

{
    "uninitialized",
    "initialized",
    "started",
    "stopping"
}
String constants for FPM memory states.


Generated on Thu Mar 24 20:33:26 2005 by doxygen 1.3.3