backend/mmapcache.h File Reference


Detailed Description

Mmapcache stores a MRU cache of all established mmaped memory regions which are currently not in use.

The mmapcache also manages the upper limit about how much memory can be mmaped.

Definition in file mmapcache.h.

#include "lib/error.h"
#include "lib/mrucache.h"
#include "lib/mutex.h"
#include "backend/mmap.h"
#include <nobug.h>

Include dependency graph for mmapcache.h:

Go to the source code of this file.

Classes

struct  lumiera_mmapcache_struct

Typedefs

typedef struct
lumiera_mmapcache_struct 
lumiera_mmapcache
typedef lumiera_mmapcache * LumieraMMapcache

Functions

int lumiera_mmapcache_age (LumieraMMapcache self)
 Destroy and free the nelem oldest elements.
void lumiera_mmapcache_announce (LumieraMMapcache self, LumieraMMap map)
 Announce a new mmap object to the cache quotas.
void lumiera_mmapcache_checkin (LumieraMMapcache self, LumieraMMap handle)
 Put a mmap into the cache Mmaps which are checked in are subject of cache aging and might get destroyed and reused.
LumieraMMap lumiera_mmapcache_checkout (LumieraMMapcache self, LumieraMMap handle)
 Remove a mmap from cache aging Mmaps which are subject of cache aging must be checked out before they can be used.
void lumiera_mmapcache_delete (void)
 Delete the mmap cache.
void lumiera_mmapcache_forget (LumieraMMapcache self, LumieraMMap map)
 Remove a mmap object from the cache quotas.
LumieraMMap lumiera_mmapcache_mmap_acquire (LumieraMMapcache self)
 Get a fresh mmap object.
void lumiera_mmapcache_new (size_t limit)
 Initializes the mmapcache.

Variables

LumieraMMapcache lumiera_mcache


Function Documentation

void lumiera_mmapcache_new ( size_t  limit  ) 

Initializes the mmapcache.

Parameters:
limit the mmapcache will drop elements when the sum of all mmapings gives over limit

void lumiera_mmapcache_delete ( void   ) 

Delete the mmap cache.

No mmaps in the cache must be locked, this would be a fatal error. The handles are closed automatically.

LumieraMMap lumiera_mmapcache_mmap_acquire ( LumieraMMapcache  self  ) 

Get a fresh mmap object.

when mmaped_limit is reached, the oldest mmap object gets dropped else a new allocated object is returned

Parameters:
self pointer to the cache
Returns:
the new mmap

void lumiera_mmapcache_announce ( LumieraMMapcache  self,
LumieraMMap  map 
)

Announce a new mmap object to the cache quotas.

Update the statistics kept in the cache, the map object is still considered to be checked out

Parameters:
self pointer to the cache
map object to be announced

void lumiera_mmapcache_forget ( LumieraMMapcache  self,
LumieraMMap  map 
)

Remove a mmap object from the cache quotas.

Update the statistics kept in the cache, called by mmap's destructor only

Parameters:
self pointer to the cache
map object to be removed

int lumiera_mmapcache_age ( LumieraMMapcache  self  ) 

Destroy and free the nelem oldest elements.

Used to free up resources and memory.

Parameters:
self cache where to free elements.
Returns:
nelem-(numer of elements which got freed), that is 0 if all requested elements got freed

LumieraMMap lumiera_mmapcache_checkout ( LumieraMMapcache  self,
LumieraMMap  handle 
)

Remove a mmap from cache aging Mmaps which are subject of cache aging must be checked out before they can be used.

Parameters:
self the mmapcache
handle the mmap to be checked out

void lumiera_mmapcache_checkin ( LumieraMMapcache  self,
LumieraMMap  handle 
)

Put a mmap into the cache Mmaps which are checked in are subject of cache aging and might get destroyed and reused.

Parameters:
self the mmapcache
handle the mmap to be checked in


Generated on Fri Nov 7 22:15:10 2008 for Lumiera by  doxygen 1.5.6