escript  Revision_
Classes | Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
escript::Taipan Class Reference

Taipan array manager, C++ version. Based on TaipanMemManager C module by Lutz Gross. More...

#include <Taipan.h>

Classes

struct  Taipan_MemTable
 
struct  Taipan_StatTable
 

Public Types

typedef long size_type
 

Public Member Functions

 Taipan ()
 Default constructor for Taipan data-array manager. More...
 
 ~Taipan ()
 Default destructor for Taipan data-array manager. More...
 
double * new_array (size_type dim, size_type N)
 Taipan data-array allocator. More...
 
void delete_array (double *array)
 Taipan data-array deallocator. More...
 
void release_unused_arrays ()
 frees all arrays that are currently unused. More...
 
int num_arrays ()
 Calculate the total number of arrays currently under management. More...
 
int num_arrays (size_type N)
 Calculate the total number of arrays of N blocks currently under management. More...
 
int num_free (size_type N)
 Calculate the total number of free arrays of N blocks currently under management. More...
 
long num_elements ()
 Return the total number of array elements currently under management. More...
 
void dump_stats ()
 Print out statistics on the memory under management. More...
 
void clear_stats ()
 Clear record of statistics on the memory under management. More...
 

Private Types

typedef struct escript::Taipan::Taipan_StatTable Taipan_StatTable
 
typedef struct escript::Taipan::Taipan_MemTable Taipan_MemTable
 

Private Member Functions

void operator= (const Taipan &c)
 

Private Attributes

Taipan_StatTablestatTable
 
Taipan_MemTablememTable_Root
 
long totalElements
 

Detailed Description

Taipan array manager, C++ version. Based on TaipanMemManager C module by Lutz Gross.

Description: Taipan: data-array manager.

The Taipan data-array manager holds a set of (dim x N) arrays distributed across a number of threads. If a (dim x N) array is requested via the Taipan allocator, the buffer of managed arrays is searched for a free array of this size on the current number of threads. If none is available, a new one is allocated and added to the buffer of managed arrays.

When a managed array is deallocated, the array is marked as free but not returned to the system as long as at least one array of N is in use. Otherwise all arrays of N are deallocated as it is assumed that these arrays not be used anymore. The exceptions to this strategy are arrays with N=0 or N=1, these arrays are never deallocated, but are kept for possible reuse.

Member Typedef Documentation

◆ size_type

◆ Taipan_MemTable

◆ Taipan_StatTable

Constructor & Destructor Documentation

◆ Taipan()

escript::Taipan::Taipan ( )

Default constructor for Taipan data-array manager.

Description: Default constructor for Taipan data-array manager.

Preconditions: Describe any preconditions

Throws: Describe any exceptions thrown

References clear_stats(), and statTable.

◆ ~Taipan()

escript::Taipan::~Taipan ( )

Default destructor for Taipan data-array manager.

Description: Default destructor for Taipan data-array manager.

Preconditions: Describe any preconditions

Throws: Describe any exceptions thrown

References escript::Taipan::Taipan_MemTable::array, escript::Taipan::Taipan_MemTable::dim, dump_stats(), memTable_Root, escript::Taipan::Taipan_MemTable::N, escript::Taipan::Taipan_MemTable::next, statTable, and totalElements.

Member Function Documentation

◆ clear_stats()

void escript::Taipan::clear_stats ( )

◆ delete_array()

void escript::Taipan::delete_array ( double *  array)

◆ dump_stats()

void escript::Taipan::dump_stats ( )

◆ new_array()

double * escript::Taipan::new_array ( size_type  dim,
size_type  N 
)

◆ num_arrays() [1/2]

int escript::Taipan::num_arrays ( )

Calculate the total number of arrays currently under management.

References memTable_Root, escript::Taipan::Taipan_MemTable::next, and totalElements.

Referenced by dump_stats(), and num_arrays().

◆ num_arrays() [2/2]

int escript::Taipan::num_arrays ( size_type  N)

Calculate the total number of arrays of N blocks currently under management.

References memTable_Root, escript::Taipan::Taipan_MemTable::N, escript::Taipan::Taipan_MemTable::next, num_arrays(), and totalElements.

◆ num_elements()

long escript::Taipan::num_elements ( )

Return the total number of array elements currently under management.

References totalElements.

Referenced by dump_stats().

◆ num_free()

int escript::Taipan::num_free ( size_type  N)

Calculate the total number of free arrays of N blocks currently under management.

References escript::Taipan::Taipan_MemTable::free, memTable_Root, escript::Taipan::Taipan_MemTable::N, escript::Taipan::Taipan_MemTable::next, and totalElements.

◆ operator=()

void escript::Taipan::operator= ( const Taipan c)
inlineprivate

Declared (private) as a precaution to ensure that noone tries to copy instances.

◆ release_unused_arrays()

void escript::Taipan::release_unused_arrays ( )

Member Data Documentation

◆ memTable_Root

Taipan_MemTable* escript::Taipan::memTable_Root
private

◆ statTable

Taipan_StatTable* escript::Taipan::statTable
private

◆ totalElements

long escript::Taipan::totalElements
private

The documentation for this class was generated from the following files: