CernVM-FS  2.12.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SqliteMemoryManager::LookasideBufferArena Class Reference

#include <sqlitemem.h>

Public Member Functions

 LookasideBufferArena ()
 
 ~LookasideBufferArena ()
 
void * GetBuffer ()
 
void PutBuffer (void *buffer)
 
bool IsEmpty ()
 
bool Contains (void *buffer)
 

Static Public Attributes

static const unsigned kBufferSize
 
static const unsigned kBuffersPerArena = 128
 
static const unsigned kArenaSize = kBuffersPerArena * kBufferSize
 
static const unsigned kNoBitmaps = kBuffersPerArena / (sizeof(int) * 8)
 

Private Attributes

void * arena_
 
int freemap_ [kNoBitmaps]
 

Detailed Description

A continuous chunk of memory from which fixed-sized chunks are given as lookaside buffers to SQlite database connections. A bitmap indicates used and free buffers. One arena serves 128 database connections and assuming less than 10000 concurrently open catalogs, the number of mmap'd regions stays under 100.

Definition at line 93 of file sqlitemem.h.

Constructor & Destructor Documentation

SqliteMemoryManager::LookasideBufferArena::LookasideBufferArena ( )

Definition at line 54 of file sqlitemem.cc.

SqliteMemoryManager::LookasideBufferArena::~LookasideBufferArena ( )

Definition at line 62 of file sqlitemem.cc.

Member Function Documentation

bool SqliteMemoryManager::LookasideBufferArena::Contains ( void *  buffer)

Definition at line 45 of file sqlitemem.cc.

void * SqliteMemoryManager::LookasideBufferArena::GetBuffer ( )

Definition at line 23 of file sqlitemem.cc.

Referenced by SqliteMemoryManager::GetLookasideBuffer().

Here is the caller graph for this function:

bool SqliteMemoryManager::LookasideBufferArena::IsEmpty ( )

Definition at line 36 of file sqlitemem.cc.

void SqliteMemoryManager::LookasideBufferArena::PutBuffer ( void *  buffer)

Definition at line 67 of file sqlitemem.cc.

Here is the call graph for this function:

Member Data Documentation

void* SqliteMemoryManager::LookasideBufferArena::arena_
private

An mmap'd memory block.

Definition at line 127 of file sqlitemem.h.

int SqliteMemoryManager::LookasideBufferArena::freemap_[kNoBitmaps]
private

Indicates free/used slots. A used slot has its bit set to zero, an unused slot has its bit set to 1.

Definition at line 133 of file sqlitemem.h.

Referenced by LookasideBufferArena().

const unsigned SqliteMemoryManager::LookasideBufferArena::kArenaSize = kBuffersPerArena * kBufferSize
static

512kB = 128 4kB buffers.

Definition at line 109 of file sqlitemem.h.

const unsigned SqliteMemoryManager::LookasideBufferArena::kBufferSize
static
Initial value:

Accumulates to 4kB.

Definition at line 98 of file sqlitemem.h.

const unsigned SqliteMemoryManager::LookasideBufferArena::kBuffersPerArena = 128
static

Has to be a multiple of the number of bits in the int type. One arena can serve 128 concurrent sqlite database connections.

Definition at line 105 of file sqlitemem.h.

const unsigned SqliteMemoryManager::LookasideBufferArena::kNoBitmaps = kBuffersPerArena / (sizeof(int) * 8)
static

Number of bitmap ints for 128 buffers.

Definition at line 113 of file sqlitemem.h.

Referenced by LookasideBufferArena().


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